From f445da32f3b7c875827354397170c2642f1e217a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=B4=E4=BC=9F=E7=90=A6?= Date: Thu, 29 Jun 2023 17:59:30 +0800 Subject: [PATCH] =?UTF-8?q?audio=20XTS=20NDK=E6=B5=8B=E8=AF=95=E5=A5=97?= =?UTF-8?q?=E4=B8=8A=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 戴伟琦 --- multimedia/BUILD.gn | 1 + .../audio_js_standard/audio_ndk_test/BUILD.gn | 40 ++ .../audio_ndk_test/Test.json | 23 + .../audio_ndk_test/entry/src/main/config.json | 111 +++ .../entry/src/main/cpp/BUILD.gn | 52 ++ .../entry/src/main/cpp/napi/audioTest.cpp | 668 ++++++++++++++++++ .../entry/src/main/ets/MainAbility/app.ets | 33 + .../src/main/ets/MainAbility/pages/index.ets | 37 + .../entry/src/main/ets/TestAbility/app.ets | 33 + .../src/main/ets/TestAbility/pages/index.ets | 50 ++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 78 ++ .../entry/src/main/ets/test/List.test.ets | 19 + .../entry/src/main/ets/test/NativeApiTest.ets | 614 ++++++++++++++++ .../main/resources/base/element/string.json | 20 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../src/main/resources/rawfile/test/aa.xml | 2 + .../signature/openharmony_sx.p7b | Bin 0 -> 3503 bytes 17 files changed, 1781 insertions(+) create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/BUILD.gn create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/Test.json create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/config.json create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/BUILD.gn create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/napi/audioTest.cpp create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/app.ets create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/pages/index.ets create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestAbility/app.ets create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestAbility/pages/index.ets create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/List.test.ets create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/NativeApiTest.ets create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/base/element/string.json create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/base/media/icon.png create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/rawfile/test/aa.xml create mode 100644 multimedia/audio/audio_js_standard/audio_ndk_test/signature/openharmony_sx.p7b diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index 78258f024..30374f86e 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -26,6 +26,7 @@ group("multimedia") { "audio/audio_js_standard/audioInterruptRender:audioRenderInterrupt", "audio/audio_js_standard/audioManager:audio_manager_js_hap", "audio/audio_js_standard/audioRenderer:audio_renderer_js_hap", + "audio/audio_js_standard/audio_ndk_test:audioDemo_ndk_hap", "audio/audio_js_standard/audioVoip:audio_voip_js_hap", "avsession/avsession_js_standard/avsessionManager:avsession_framework_js_hap", "camera/camera_js_standard:camera_framework_ets_hap", diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/BUILD.gn b/multimedia/audio/audio_js_standard/audio_ndk_test/BUILD.gn new file mode 100644 index 000000000..bcd88b7fd --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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("//build/ohos.gni") +import("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("audioDemo_ndk_hap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":pixelmap_ets_assets", + ":pixelmap_ets_resources", + ":pixelmap_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioNapiEtsTest" + shared_libraries = [ "./entry/src/main/cpp:audioNdkTest" ] + part_name = "audio_framework" + subsystem_name = "multimedia" +} + +ohos_js_assets("pixelmap_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("pixelmap_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("pixelmap_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/Test.json b/multimedia/audio/audio_js_standard/audio_ndk_test/Test.json new file mode 100644 index 000000000..a39ae0239 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "ohos.audio.napitest", + "package-name": "ohos.audio.napitest", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioNapiEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [] + } + ] +} diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/config.json b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/config.json new file mode 100644 index 000000000..587f0179b --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/config.json @@ -0,0 +1,111 @@ +{ + "app": { + "bundleName": "ohos.audio.napitest", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.audio.napitest", + "name": ".MyApplication", + "mainAbility": "ohos.audio.napitest.MainAbility", + + "deviceType": [ + "tablet", + "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.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + } + ], + "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 + } + } + ] + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/BUILD.gn b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/BUILD.gn new file mode 100644 index 000000000..4d67d02b3 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/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/config/ohos/config.gni") +import("//build/ohos.gni") +import("//foundation/arkui/napi/napi.gni") +config("config") { + visibility = [ ":*" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Wunused-variable", + ] +} + + +ohos_shared_library("audioNdkTest") { + sources = [ + "./napi/audioTest.cpp", + ] + if (use_musl) { + libs = [ rebase_path(libcxx_ndk_shared_file) ] + } + include_dirs = [ + "//foundation/multimedia/audio_framework/interfaces/kits/c/", + "//foundation/multimedia/audio_framework/interfaces/kits/c/common/", + "//foundation/multimedia/audio_framework/interfaces/kits/c/audio_renderer/", + "//foundation/multimedia/audio_framework/interfaces/kits/c/audio_capturer/", + ] + configs = [ ":config" ] + deps = [ + "//foundation/multimedia/audio_framework/frameworks/native/ohaudio:ohaudio" + ] + external_deps = [ + "napi:ace_napi", + ] + + output_extension = "so" + part_name = "audio_framework" + subsystem_name = "multimedia" +} diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/napi/audioTest.cpp b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/napi/audioTest.cpp new file mode 100644 index 000000000..135bcf6da --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/cpp/napi/audioTest.cpp @@ -0,0 +1,668 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 "napi/native_api.h" +#include "native_audiocapturer.h" +#include "native_audiorenderer.h" +#include "native_audiostream_base.h" +#include "native_audiostreambuilder.h" + +static napi_value CreateAudioCapture(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder; + OH_AudioStream_Type type = AUDIOSTREAM_TYPE_CAPTURER; + OH_AudioStream_Result result = OH_AudioStreamBuilder_Create(&builder, type); + OH_AudioStreamBuilder_Destroy(builder); + // int result = 5; + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +OH_AudioStreamBuilder *CreateCapturerBuilder() +{ + OH_AudioStreamBuilder *builder; + OH_AudioStream_Type type = AUDIOSTREAM_TYPE_CAPTURER; + OH_AudioStreamBuilder_Create(&builder, type); + return builder; +} + +// OH_Audio_Capture_Generate_001 + +static napi_value AudioCaptureGenerate(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + + OH_AudioCapturer *audioCapturer; + OH_AudioStream_Result result = OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_Generate_002 +static napi_value AudioCaptureGenerateErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder; + OH_AudioStream_Type type = AUDIOSTREAM_TYPE_RERNDERER; + OH_AudioStreamBuilder_Create(&builder, type); + + OH_AudioCapturer *audioCapturer; + OH_AudioStream_Result result = OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// Audio_Capturer_Start_001 +static napi_value AudioCaptureStart(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStream_Result result = OH_AudioCapturer_Start(audioCapturer); + + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// Audio_Capturer_Start_002 +static napi_value AudioCaptureStartErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioCapturer_Start(audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Start(audioCapturer); + + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_Pause_001 +static napi_value AudioCapturePause(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioCapturer_Start(audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Pause(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Capture_Pause_002 +static napi_value AudioCapturePauseErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Pause(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_Stop_001 +static napi_value AudioCaptureStop(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioCapturer_Start(audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Stop(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_Stop_002 +static napi_value AudioCaptureStopErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Stop(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Capture_Flush_001 +static napi_value AudioCaptureFlush(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioCapturer_Start(audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Flush(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Capture_Flush_002 +static napi_value AudioCaptureFlushErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Flush(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_Release_001 +static napi_value AudioCaptureRelease(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioCapturer_Start(audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Release(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Capture_Release_002 +static napi_value AudioCaptureReleaseErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStream_Result result = OH_AudioCapturer_Release(audioCapturer); + OH_AudioCapturer_Release(audioCapturer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_GetParameter_001 +static napi_value AudioCaptureGetParameter(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStream_LatencyMode latencyMode = AUDIOSTREAM_LATENCY_MODE_NORMAL; + OH_AudioStream_Result result = OH_AudioCapturer_GetLatencyMode(audioCapturer, &latencyMode); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_AudioCapturer_GetCurrentState_001 +static napi_value AudioCaptureGetCurrentState(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStream_State state; + OH_AudioStream_Result result = OH_AudioCapturer_GetCurrentState(audioCapturer, &state); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_GetStreamId +static napi_value AudioCaptureGetStreamId(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + uint32_t streamId; + OH_AudioStream_Result result = OH_AudioCapturer_GetStreamId(audioCapturer, &streamId); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_GetSamplingRate_001 +static napi_value AudioCaptureGetSamplingRate(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + int32_t rate; + OH_AudioStream_Result result = OH_AudioCapturer_GetSamplingRate(audioCapturer, &rate); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_GetSampleFormat_001 +static napi_value AudioCaptureGetSampleFormat(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStream_SampleFormat sampleFormat; + OH_AudioStream_Result result = OH_AudioCapturer_GetSampleFormat(audioCapturer, &sampleFormat); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_GetEncodingType_001 +static napi_value AudioCaptureGetEncodingType(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStream_EncodingType encodingType; + OH_AudioStream_Result result = OH_AudioCapturer_GetEncodingType(audioCapturer, &encodingType); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Capture_GetCapturerInfo_001 +static napi_value AudioCaptureGetCapturerInfo(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateCapturerBuilder(); + OH_AudioCapturer *audioCapturer; + OH_AudioStreamBuilder_GenerateCapturer(builder, &audioCapturer); + + OH_AudioStream_SourceType sourceType; + OH_AudioStream_Result result = OH_AudioCapturer_GetCapturerInfo(audioCapturer, &sourceType); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// ----------------------- + +OH_AudioStreamBuilder *CreateRenderBuilder() +{ + OH_AudioStreamBuilder *builder; + OH_AudioStream_Type type = AUDIOSTREAM_TYPE_RERNDERER; + OH_AudioStreamBuilder_Create(&builder, type); + return builder; +} + +// OH_Audio_Render_Generate_001 +static napi_value AudioRenderGenerate(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStream_Result result = OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Generate_002 +static napi_value AudioRenderGenerateErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder; + OH_AudioStream_Type type = AUDIOSTREAM_TYPE_CAPTURER; + OH_AudioStreamBuilder_Create(&builder, type); + + OH_AudioRenderer *audioRenderer; + OH_AudioStream_Result result = OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// Audio_Render_Start_001 +static napi_value AudioRenderStart(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Start(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// Audio_Render_Start_002 +static napi_value AudioRenderStartErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioRenderer_Start(audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Start(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Pause_001 +static napi_value AudioRenderPause(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioRenderer_Start(audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Pause(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Pause_002 +static napi_value AudioRenderPauseErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Pause(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Stop_001 +static napi_value AudioRenderStop(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioRenderer_Start(audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Stop(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Stop_002 +static napi_value AudioRenderStopErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Stop(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Flush_001 +static napi_value AudioRenderFlush(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioRenderer_Start(audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Flush(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Render_Flush_002 +static napi_value AudioRenderFlushErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Flush(audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_Release_001 +static napi_value AudioRenderRelease(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioRenderer_Start(audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Render_Release_002 +static napi_value AudioRenderReleaseErr(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioRenderer_Release(audioRenderer); + OH_AudioStream_Result result = OH_AudioRenderer_Release(audioRenderer); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_AudioRenderer_GetCurrentState_001 +static napi_value AudioRenderGetCurrentState(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_State state; + OH_AudioStream_Result result = OH_AudioRenderer_GetCurrentState(audioRenderer, &state); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_GetParameter_001 + +static napi_value AudioRenderGetParameter(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_LatencyMode latencyMode = AUDIOSTREAM_LATENCY_MODE_NORMAL; + OH_AudioStream_Result result = OH_AudioRenderer_GetLatencyMode(audioRenderer, &latencyMode); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_GetParameter_002 + +static napi_value AudioRenderGetStreamId(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + + uint32_t streamId; + OH_AudioStream_Result result = OH_AudioRenderer_GetStreamId(audioRenderer, &streamId); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_GetSamplingRate_001 +static napi_value AudioRenderGetSamplingRate(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + int32_t rate; + OH_AudioStream_Result result = OH_AudioRenderer_GetSamplingRate(audioRenderer, &rate); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_GetSampleFormat_001 + +static napi_value AudioRenderGetSampleFormat(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_SampleFormat sampleFormat; + OH_AudioStream_Result result = OH_AudioRenderer_GetSampleFormat(audioRenderer, &sampleFormat); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} + +// OH_Audio_Render_GetEncodingType_001 +static napi_value AudioRenderGetEncodingType(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_EncodingType encodingType; + OH_AudioStream_Result result = OH_AudioRenderer_GetEncodingType(audioRenderer, &encodingType); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +// OH_Audio_Render_GetRendererInfo_001 +static napi_value AudioRenderGetRendererInfo(napi_env env, napi_callback_info info) +{ + OH_AudioStreamBuilder *builder = CreateRenderBuilder(); + + OH_AudioRenderer *audioRenderer; + OH_AudioStreamBuilder_GenerateRenderer(builder, &audioRenderer); + OH_AudioStream_Usage usage; + OH_AudioStream_Content content; + OH_AudioStream_Result result = OH_AudioRenderer_GetRendererInfo(audioRenderer, &usage, &content); + OH_AudioStreamBuilder_Destroy(builder); + napi_value res; + napi_create_int32(env, result, &res); + return res; +} +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) +{ + napi_property_descriptor desc[] = { + {"createAudioCapture", nullptr, CreateAudioCapture, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGenerate", nullptr, AudioCaptureGenerate, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGenerateErr", nullptr, AudioCaptureGenerateErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureStart", nullptr, AudioCaptureStart, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureStartErr", nullptr, AudioCaptureStartErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCapturePause", nullptr, AudioCapturePause, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCapturePauseErr", nullptr, AudioCapturePauseErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureStop", nullptr, AudioCaptureStop, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureStopErr", nullptr, AudioCaptureStopErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureFlush", nullptr, AudioCaptureFlush, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureFlushErr", nullptr, AudioCaptureFlushErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureRelease", nullptr, AudioCaptureRelease, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureReleaseErr", nullptr, AudioCaptureReleaseErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetParameter", nullptr, AudioCaptureGetParameter, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetCurrentState", nullptr, AudioCaptureGetCurrentState, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetStreamId", nullptr, AudioCaptureGetStreamId, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetSamplingRate", nullptr, AudioCaptureGetSamplingRate, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetSampleFormat", nullptr, AudioCaptureGetSampleFormat, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetEncodingType", nullptr, AudioCaptureGetEncodingType, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioCaptureGetCapturerInfo", nullptr, AudioCaptureGetCapturerInfo, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGenerate", nullptr, AudioRenderGenerate, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGenerateErr", nullptr, AudioRenderGenerateErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderStart", nullptr, AudioRenderStart, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderStartErr", nullptr, AudioRenderStartErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderPause", nullptr, AudioRenderPause, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderPauseErr", nullptr, AudioRenderPauseErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderStop", nullptr, AudioRenderStop, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderStopErr", nullptr, AudioRenderStopErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderFlush", nullptr, AudioRenderFlush, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderFlushErr", nullptr, AudioRenderFlushErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderRelease", nullptr, AudioRenderRelease, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderReleaseErr", nullptr, AudioRenderReleaseErr, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetCurrentState", nullptr, AudioRenderGetCurrentState, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetParameter", nullptr, AudioRenderGetParameter, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetStreamId", nullptr, AudioRenderGetStreamId, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetSamplingRate", nullptr, AudioRenderGetSamplingRate, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetSampleFormat", nullptr, AudioRenderGetSampleFormat, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetEncodingType", nullptr, AudioRenderGetEncodingType, nullptr, nullptr, nullptr, napi_default, nullptr}, + {"audioRenderGetRendererInfo", nullptr, AudioRenderGetRendererInfo, nullptr, nullptr, nullptr, napi_default, nullptr}, + }; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +/* + * module define + */ +static napi_module g_module = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "audioNdkTest", + .nm_priv = ((void *)0), + .reserved = {0}}; + +/* + * module register + */ +extern "C" __attribute__((constructor)) void MyPixelMapRegisterModule(void) +{ + napi_module_register(&g_module); +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/app.ets b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 000000000..6b29cb804 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/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/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/pages/index.ets b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 000000000..94c7613fa --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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('IMAGE ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestAbility/app.ets b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 000000000..6b29cb804 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestAbility/pages/index.ets b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 000000000..0d0efe0a8 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..07cb0b784 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/List.test.ets b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..edb8d881c --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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 napiTest from './NativeApiTest' + +export default function testsuite() { + napiTest() +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/NativeApiTest.ets b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/NativeApiTest.ets new file mode 100644 index 000000000..82190d5a2 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/ets/test/NativeApiTest.ets @@ -0,0 +1,614 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES 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 { UiDriver, BY } from '@ohos.UiTest' +// @ts-nocheck +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' +// @ts-ignore +import myaudioNdk from "libaudioNdkTest.so" +const Tag = 'audio_ndk_test:' +export default function nativeApiImageJsunit() { + describe('napiTest', function () { + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + async function getPermission() { + let permissions = ['ohos.permission.MICROPHONE']; + featureAbility.getContext().requestPermissionsFromUser(permissions, 0, (data) => { + console.info(Tag + "request success" + JSON.stringify(data)); + }) + } + async function driveFn() { + console.info(Tag + `come in driveFn`); + let driver = await UiDriver.create(); + console.info(Tag + `driver is ${JSON.stringify(driver)}`); + await sleep(100); + console.info(Tag + `UiDriver start`); + let button = await driver.findComponent(BY.text('允许')); + console.info(Tag + `button is ${JSON.stringify(button)}`); + await sleep(100); + await button.click(); + } + beforeAll(async function () { + await getPermission(); + await sleep(100); + await driveFn(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + console.info('beforeEach case'); + }) + + afterEach(function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + /* * + * @tc.number : TC_001 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_001', 0, async function (done) { + let a = myaudioNdk.createAudioCapture(); + console.info(Tag + "TC_001-------------createAudioCapture:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_002 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_002', 0, async function (done) { + let a = myaudioNdk.audioCaptureGenerate(); + console.info(Tag, "TC_002-------------audioCaptureGenerate:" + a); + expect(a).assertEqual(0) + done() + }) + + /* * + * @tc.number : TC_003 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_003', 0, async function (done) { + let a = myaudioNdk.audioCaptureGenerateErr(); + console.info("TC_003-------------audioCaptureGenerateErr:" + a); + expect(a).assertEqual(1) + done() + }) + + /* * + * @tc.number : TC_004 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_004', 0, async function (done) { + let a = myaudioNdk.audioCaptureStart(); + console.info("TC_004-------------audioCaptureStart:" + a); + expect(a).assertEqual(0) + done() + }) + + /* * + * @tc.number : TC_005 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_005', 0, async function (done) { + let a = myaudioNdk.audioCaptureStartErr(); + console.info("TC_005-------------audioCaptureStartErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_006 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_006', 0, async function (done) { + let a = myaudioNdk.audioCapturePause(); + console.info("TC_006-------------audioCapturePause:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_007 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_007', 0, async function (done) { + let a = myaudioNdk.audioCapturePauseErr(); + console.info("TC_007-------------audioCapturePauseErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_008 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_008', 0, async function (done) { + let a = myaudioNdk.audioCaptureStop(); + console.info("TC_008-------------audioCaptureStop:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_009 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_009', 0, async function (done) { + let a = myaudioNdk.audioCaptureStopErr(); + console.info("TC_009-------------audioCaptureStopErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_010 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_010', 0, async function (done) { + let a = myaudioNdk.audioCaptureFlush(); + console.info("TC_010-------------audioCaptureFlush:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_011 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_011', 0, async function (done) { + let a = myaudioNdk.audioCaptureFlushErr(); + console.info("TC_011-------------audioCaptureFlushErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_012 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_012', 0, async function (done) { + let a = myaudioNdk.audioCaptureRelease(); + console.info("TC_012-------------audioCaptureRelease:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_013 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_013', 0, async function (done) { + let a = myaudioNdk.audioCaptureReleaseErr(); + console.info("TC_013-------------audioCaptureReleaseErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_014 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_014', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetParameter(); + console.info("TC_014-------------audioCaptureGetParameter:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_015 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_015', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetCurrentState(); + console.info("TC_015-------------audioCaptureGetCurrentState:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_016 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_016', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetStreamId(); + console.info("TC_016-------------audioCaptureGetStreamId:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_017 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_017', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetSamplingRate(); + console.info("TC_017-------------audioCaptureGetSamplingRate:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_018 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_018', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetSampleFormat(); + console.info("TC_018-------------audioCaptureGetSampleFormat:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_019 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_019', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetEncodingType(); + console.info("TC_019-------------audioCaptureGetEncodingType:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_020 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_020', 0, async function (done) { + let a = myaudioNdk.audioCaptureGetCapturerInfo(); + console.info("TC_020-------------audioCaptureGetCapturerInfo:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_021 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_021', 0, async function (done) { + let a = myaudioNdk.audioRenderGenerate(); + console.info("TC_021-------------audioRenderGenerate:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_022 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_022', 0, async function (done) { + let a = myaudioNdk.audioRenderGenerateErr(); + console.info("TC_022-------------audioRenderGenerateErr:" + a); + expect(a).assertEqual(1) + done() + }) + /* * + * @tc.number : TC_023 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_023', 0, async function (done) { + let a = myaudioNdk.audioRenderStart(); + console.info("TC_023-------------audioRenderStart:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_024 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_024', 0, async function (done) { + let a = myaudioNdk.audioRenderStartErr(); + console.info("TC_024-------------audioRenderStartErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_025 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_025', 0, async function (done) { + let a = myaudioNdk.audioRenderPause(); + console.info("TC_025-------------audioRenderPause:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_026 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_026', 0, async function (done) { + let a = myaudioNdk.audioRenderPauseErr(); + console.info("TC_026-------------audioRenderPauseErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_027 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_027', 0, async function (done) { + let a = myaudioNdk.audioRenderStop(); + console.info("TC_027-------------audioRenderStop:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_028 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_028', 0, async function (done) { + let a = myaudioNdk.audioRenderStopErr(); + console.info("TC_028-------------audioRenderStopErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_029 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_029', 0, async function (done) { + let a = myaudioNdk.audioRenderFlush(); + console.info("TC_029-------------audioRenderFlush:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_030 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_030', 0, async function (done) { + let a = myaudioNdk.audioRenderFlushErr(); + console.info("TC_030-------------audioRenderFlushErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_031 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_031', 0, async function (done) { + let a = myaudioNdk.audioRenderRelease(); + console.info("TC_031-------------audioRenderRelease:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_032 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_032', 0, async function (done) { + let a = myaudioNdk.audioRenderReleaseErr(); + console.info("TC_032-------------audioRenderReleaseErr:" + a); + expect(a).assertEqual(2) + done() + }) + /* * + * @tc.number : TC_033 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_033', 0, async function (done) { + let a = myaudioNdk.audioRenderGetCurrentState(); + console.info("TC_033-------------audioRenderGetCurrentState:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_034 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_034', 0, async function (done) { + let a = myaudioNdk.audioRenderGetParameter(); + console.info("TC_034-------------audioRenderGetParameter:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_035 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_035', 0, async function (done) { + let a = myaudioNdk.audioRenderGetStreamId(); + console.info("TC_035-------------audioRenderGetStreamId:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_036 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_036', 0, async function (done) { + let a = myaudioNdk.audioRenderGetSamplingRate(); + console.info("TC_036-------------audioRenderGetSamplingRate:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_037 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_037', 0, async function (done) { + let a = myaudioNdk.audioRenderGetSampleFormat(); + console.info("TC_037-------------audioRenderGetSampleFormat:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_038 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_038', 0, async function (done) { + let a = myaudioNdk.audioRenderGetEncodingType(); + console.info("TC_038-------------audioRenderGetEncodingType:" + a); + expect(a).assertEqual(0) + done() + }) + /* * + * @tc.number : TC_039 + * @tc.name : Test OH_GetImageInfo, OH_AccessPixels, OH_UnAccessPixels + * @tc.desc : + * @tc.size : + * @tc.type : Functional + * @tc.level : FWK Layer + */ + it('TC_039', 0, async function (done) { + let a = myaudioNdk.audioRenderGetRendererInfo(); + console.info("TC_039-------------audioRenderGetRendererInfo:" + a); + expect(a).assertEqual(0) + done() + }) + }) +} diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/base/element/string.json new file mode 100644 index 000000000..498677efb --- /dev/null +++ b/multimedia/audio/audio_js_standard/audio_ndk_test/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/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/audio_ndk_test/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz_d%c_!X+6-;1`GC9_FpjoHev5fEV7RhJ>r=mh-jp$fqbqRJ=obwdgLDVP5+s zy1=_DWG0Y-Jb3t^WXmkr(d9~08k-|#Ly zaNOmT(^9tIb&eb4%CzIT zAm3CUtWSr1t4?h1kk#NBi{U|pJslvME{q|_eS^3En>SOqSxyuN1x;Is@8~m?*>}** znrRFArP!K_52RpX*&JHMR<^lVdm8ypJ}0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-AiamN>!3~Lxw&{H(b{B(7xSRm6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}y + diff --git a/multimedia/audio/audio_js_standard/audio_ndk_test/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/audio_ndk_test/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..e7725b8c900e912397e72a7e89e65b036e607d05 GIT binary patch literal 3503 zcmcgvYj6|S6}Dam0|JA2mxmDq6F~M|S+XT3A?!*kX@ys^WXYC{h*?Rihb`^O(#k7~ zLL51v0RoiLfC-P7HQQ-h|}WI&;&?aD6}it1)G5%oy?#g z+BxT*d-mINzVqF=ASvFHnKgZ}e(?`tUO#?IQoI2q#m#&k4-$icnOXA}>v^O=$mfBi z2!9aBYe|Y`36r9d1(JF)5)IIl)J=OxNeMLbzJnq{oI?WTgM1*FDT&1b9?nz%S+Pr{ zBBcs1_a`q>c%&)?P)Z3E37|r`*Goc5E}Cfwr#45(AW1|?&OwC3QcobtL;|iDlX_oI z1RbpoPz>pd5GgMgSWg54o&eJz;jmFOBXyBpI+8-BP|1}=3YkJVGwmn53>o3vMM{;t zxR7%%oGEd|C{K`-1}HC`+U_Ci$sipjBhoZ4RAefqfWCnA8Oc4U8i`U!A|U##ClD zYhcy}<2pR9PQV7lXRJVAhZU|hnz#%WGmH8hnhLXd4$3lRZe2yJT&HbtRjOj76|KS% zw+@DEs5*|Dt%XR?RqOY=Lr}eos`XXqD*R5$WkqXnHJXls<2dnfl-Z83E?uz3VYh@` zGP%zTP*(4E8}S;H#cSXO4uchoo2+=elJgohwQ;-#kKgyzAT(}{vTAc0qYh;a8fy(| z!x5|-mme>6QV+c|uCv1S?(d9RQB=iNRVpxt-N3kH3I(RM1Ra$iK1TzGx?^ywlhT8S zqEIdC*2TjPnHCUSEikPi=;FTDEwizeR@jR8+&$IBkW{6eRCld$1YwP87`D0`Cbiid zu2gtEwGO>euBZq0LRe44Az4is;z2cZRBOSiAkrR+n;eO9os%-KxHqc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