未验证 提交 cb7cbac7 编写于 作者: O openharmony_ci 提交者: Gitee

!9150 audio XTS NDk上库

Merge pull request !9150 from 戴伟琦/master
......@@ -5,7 +5,7 @@
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
......@@ -27,6 +27,7 @@ group("multimedia") {
"audio/audio_js_standard/audioManager:audio_manager_js_hap",
"audio/audio_js_standard/audioRenderer:audio_renderer_js_hap",
"audio/audio_js_standard/audioVoip:audio_voip_js_hap",
"audio/audio_js_standard/audio_ndk_test:audioDemo_ndk_hap",
"avsession/avsession_js_standard/avsessionManager:avsession_framework_js_hap",
"camera/camera_js_standard:camera_framework_ets_hap",
"image/image_js_standard/image:image_js_hap",
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES 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"
}
{
"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": []
}
]
}
{
"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
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES 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")
AUDIO_ROOT_DIR = "//foundation/multimedia/audio_framework/"
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 = [
"$AUDIO_ROOT_DIR/interfaces/kits/c/",
"$AUDIO_ROOT_DIR/interfaces/kits/c/common/",
"$AUDIO_ROOT_DIR/interfaces/kits/c/audio_renderer/",
"$AUDIO_ROOT_DIR/interfaces/kits/c/audio_capturer/",
]
configs = [ ":config" ]
deps = [ "$AUDIO_ROOT_DIR/frameworks/native/ohaudio:ohaudio" ]
external_deps = [ "napi:ace_napi" ]
output_extension = "so"
part_name = "audio_framework"
subsystem_name = "multimedia"
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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);
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_RENDERER;
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_RENDERER;
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
// @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
// @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%')
}
}
// @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
// @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
// @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
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES 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()
})
})
}
{
"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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册