diff --git a/build_lite/BUILD.gn b/build_lite/BUILD.gn index 87bd9c9ac3499bc0653f81fccdf8bcc2ec815758..971bebe2973eb416c3eaa585ee2a5412428766e9 100644 --- a/build_lite/BUILD.gn +++ b/build_lite/BUILD.gn @@ -12,8 +12,8 @@ # limitations under the License. import("//build/lite/config/subsystem/aafwk/config.gni") -import("//test/xts/tools/lite/build/suite_lite.gni") import("//build/lite/config/test.gni") +import("//test/xts/tools/lite/build/suite_lite.gni") lite_component("acts_component") { all_features = [] @@ -40,6 +40,7 @@ lite_component("acts_component") { "//test/xts/acts/iot_hardware_lite/iot_controller_hal:ActsWifiIotTest", "//test/xts/acts/kernel_lite/kernelcmsis_hal:ActsCMSISTest", "//test/xts/acts/utils_lite/kv_store_hal:ActsKvStoreTest", + #"//test/xts/acts/security_lite/huks_hal:ActsSecurityDataTest", "//test/xts/acts/hiviewdfx_lite/hilog_hal:ActsDfxFuncTest", "//test/xts/acts/hiviewdfx_lite/hievent_hal:ActsHieventLiteTest", @@ -59,13 +60,14 @@ lite_component("acts_component") { "//test/xts/acts/startup_lite/bootstrap_posix:ActsBootstrapTest", "//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest", "//test/xts/acts/open_posix_testsuite/conformance/interfaces:ActsOpenPosixTest", - #"//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest", + "//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest", + "//test/xts/acts/multimedia_lite/media_lite_posix/audio_native:ActsMediaAudioTest", "//test/xts/acts/distributed_schedule_lite/system_ability_manager_posix:ActsSamgrTest", #"//test/xts/acts/distributedschedule_lite/distributed_schedule_posix:ActsDMSTest", "//test/xts/acts/security_lite/permission_posix/pms:ActsPMSTest", "//test/xts/acts/hiviewdfx_lite/hilog_posix:ActsHilogTest", - + "//test/xts/acts/multimedia_lite/media_lite_posix/recorder_native:ActsMediaRecorderTest", #"//test/xts/acts/graphic_lite/graphic_utils:uikit_test1", @@ -85,6 +87,7 @@ lite_component("acts_component") { all_features += [ "//test/xts/acts/utils_lite/kv_store_posix:ActsKvStoreTest", "//test/xts/acts/startup_lite/syspara_posix:ActsParameterTest", + #"//test/xts/acts/security_lite/huks_posix:ActsSecurityDataTest", #"//test/xts/acts/multimedia_lite/camera_lite_posix/camera_native:ActsMediaCameraTest", #"//test/xts/acts/multimedia_lite/media_lite_posix/player_native:ActsMediaPlayerTest", diff --git a/multimedia_lite/media_lite_posix/audio_native/BUILD.gn b/multimedia_lite/media_lite_posix/audio_native/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ac85066f2a44b7e2fba3c322b7a148ab142d974d --- /dev/null +++ b/multimedia_lite/media_lite_posix/audio_native/BUILD.gn @@ -0,0 +1,47 @@ +# Copyright (C) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import("//test/xts/tools/lite/build/suite_lite.gni") + +hcpptest_suite("ActsMediaAudioTest") { + suite_name = "acts" + sources = [ "src/ActsMediaAudioTest.cpp" ] + ldflags = [ "-lstdc++" ] + ldflags += [ "-lm" ] + if (ohos_kernel_type == "linux") { + ldflags += [ "-lpthread" ] + } + ldflags += [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ] + + include_dirs = [ + "src", + "//test/xts/acts/multimedia_lite/utils_posix/common/include", + "//foundation/multimedia/audio_lite/frameworks/audio_encoder/include", + "//foundation/multimedia/audio_lite/frameworks/audio_source/include", + "//foundation/multimedia/audio_lite/interfaces/kits", + "//foundation/multimedia/utils/lite/include", + "//drivers/peripheral/audio/interfaces/include", + "//drivers/peripheral/codec/interfaces/include", + "//drivers/peripheral/format/interfaces/include", + "//foundation/multimedia/audio_lite/test/unittest", + ] + + deps = [ + "//foundation/multimedia/audio_lite/frameworks:audio_capturer_lite", + "//foundation/multimedia/utils/lite:media_common", + "//third_party/bounds_checking_function:libsec_shared", + ] + + cflags = [ "-Wno-error" ] +} diff --git a/multimedia_lite/media_lite_posix/audio_native/Test.json b/multimedia_lite/media_lite_posix/audio_native/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..aaf4e2db74f758515af0eb3f9a02fd2d3dd9609b --- /dev/null +++ b/multimedia_lite/media_lite_posix/audio_native/Test.json @@ -0,0 +1,25 @@ +{ + "description": "Config for hcpptest demo test cases", + "environment": [ + { + "type": "device", + "label": "ipcamera" + } + ], + "kits": [ + { + "type": "MountKit", + "server": "NfsServer", + "mount": [ + { + "source": "testcases/multimedia", + "target": "/test_root/multimedia" + } + ] + } + ], + "driver": { + "type": "CppTestLite", + "execute": "/test_root/multimedia/ActsMediaAudioTest.bin" + } +} \ No newline at end of file diff --git a/multimedia_lite/media_lite_posix/audio_native/src/ActsMediaAudioTest.cpp b/multimedia_lite/media_lite_posix/audio_native/src/ActsMediaAudioTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2bb2fd393ac0f2a7427c9572867917ae888ff1ab --- /dev/null +++ b/multimedia_lite/media_lite_posix/audio_native/src/ActsMediaAudioTest.cpp @@ -0,0 +1,2206 @@ +/* + * Copyright (C) 2020-2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "ActsMediaAudioTest.h" +#include "codec_type.h" +#include "media_errors.h" + +using namespace std; +using namespace OHOS::Audio; +using namespace testing::ext; + + +namespace OHOS { +const int32_t BUFFER_SIZE = 1024; +const int32_t SAMPLE_RATE = 24000; +const int32_t BIT_RATE = 1024; +const int32_t CHANNEL_COUNT = 2; + +void AudioliteTest::SetUpTestCase(void) {} + +void AudioliteTest::TearDownTestCase(void) {} + +void AudioliteTest::SetUp() +{ + audioCapInfo.channelCount = CHANNEL_COUNT; + audioCapInfo.sampleRate = SAMPLE_RATE; + audioCapInfo.bitRate = BIT_RATE; + audioCapInfo.inputSource = AUDIO_SOURCE_DEFAULT; + audioCapInfo.bitWidth = BIT_WIDTH_16; +} + +void AudioliteTest::TearDown() {} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0100 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_buffer_001, TestSize.Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0200 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_buffer_002, TestSize.Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0300 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audioCapturer_003, TestSize.Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0400 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audioCapturer_004, TestSize.Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0500 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audioCapturer_005, TestSize.Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0600 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_006, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0700 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_007, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0800 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_008, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_0900 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_009, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 24000; + info.channelCount = 2; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1000 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_010, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 48000; + info.channelCount = 2; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1100 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_011, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1200 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_012, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1300 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_013, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1400 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 8; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_014, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 24000; + info.channelCount = 2; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1500 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 2; Bit_width 8; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_015, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 48000; + info.channelCount = 2; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1600 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_016, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1700 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_017, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1800 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_018, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_1900 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 8; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_019, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2000 + * @tc.name : Audio Capture Test-Format DEFAULT; Channel 1; Bit_width 8; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_020, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AUDIO_DEFAULT; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2100 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_021, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2200 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_022, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2300 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_023, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2400 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_024, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2500 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_025, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2600 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_026, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2700 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_027, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2800 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_028, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_2900 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_029, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 24000; + info.channelCount = 2; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3000 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_030, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 48000; + info.channelCount = 2; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3100 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_031, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3200 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_032, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3300 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_033, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3400 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 8; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_034, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 24000; + info.channelCount = 2; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3500 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 2; Bit_width 8; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_035, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 48000; + info.channelCount = 2; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3600 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_036, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3700 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_037, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3800 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_038, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_3900 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 8; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_039, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4000 + * @tc.name : Audio Capture Test-Format AAC_LC; Channel 1; Bit_width 8; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_040, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LC; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4100 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_041, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4200 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_042, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4300 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_043, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4400 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_044, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4500 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_045, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4600 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_046, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4700 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_047, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4800 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_048, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_4900 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_049, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 24000; + info.channelCount = 2; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5000 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_050, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 48000; + info.channelCount = 2; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5100 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_051, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5200 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_052, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5300 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_053, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5400 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 8; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_054, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 24000; + info.channelCount = 2; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5500 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 2; Bit_width 8; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_055, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 48000; + info.channelCount = 2; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5600 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_056, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5700 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_057, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5800 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_058, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_5900 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 8; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_059, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6000 + * @tc.name : Audio Capture Test-Format AAC_HE_V1; Channel 1; Bit_width 8; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_060, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_HE_V1; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6100 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 16; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_061, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6200 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 16; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_062, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6300 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 16; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_063, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6400 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 16; Sample Rate 24000; Bit Rate 24000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_064, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 24000; + info.channelCount = 1; + info.bitRate = 24000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6500 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 16; Sample Rate 48000; Bit Rate 48000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_065, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 48000; + info.channelCount = 1; + info.bitRate = 48000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6600 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 24; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_066, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6700 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 24; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_067, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6800 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 24; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_068, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_6900 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 24; Sample Rate 64000; Bit Rate 64000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_069, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 64000; + info.channelCount = 2; + info.bitRate = 64000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7000 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 16; Sample Rate 96000; Bit Rate 96000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_070, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 96000; + info.channelCount = 2; + info.bitRate = 96000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_16; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7100 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 8; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_071, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 8000; + info.channelCount = 2; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7200 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 8; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_072, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 16000; + info.channelCount = 2; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7300 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 8; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_073, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 32000; + info.channelCount = 2; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7400 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 8; Sample Rate 64000; Bit Rate 64000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_074, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 64000; + info.channelCount = 2; + info.bitRate = 64000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7500 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 2; Bit_width 8; Sample Rate 96000; Bit Rate 96000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_075, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 96000; + info.channelCount = 2; + info.bitRate = 96000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_8; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7600 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 24; Sample Rate 8000; Bit Rate 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_076, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 8000; + info.channelCount = 1; + info.bitRate = 8000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7700 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 24; Sample Rate 16000; Bit Rate 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_077, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 16000; + info.channelCount = 1; + info.bitRate = 16000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7800 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 24; Sample Rate 32000; Bit Rate 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_078, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 32000; + info.channelCount = 1; + info.bitRate = 32000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_7900 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 24; Sample Rate 64000; Bit Rate 64000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_079, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 64000; + info.channelCount = 1; + info.bitRate = 64000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} + +/* * + * @tc.number : SUB_MEDIA_AUDIO_TEST_8000 + * @tc.name : Audio Capture Test-Format AAC_LD; Channel 1; Bit_width 24; Sample Rate 96000; Bit Rate 96000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(AudioliteTest, audio_lite_audioCapturer_test_080, Level1) +{ + AudioCapturer *audioCapturer = new AudioCapturer(); + AudioCapturerInfo info; + info.inputSource = AUDIO_MIC; + info.audioFormat = AAC_LD; + info.sampleRate = 96000; + info.channelCount = 1; + info.bitRate = 96000; + info.streamType = TYPE_MEDIA; + info.bitWidth = BIT_WIDTH_24; + uint64_t frameCnt = audioCapturer->GetFrameCount(); + uint32_t framesize = static_cast((frameCnt * info.channelCount * info.bitWidth) / sizeof(uint8_t)); + uint8_t *buffer; + audioCapturer->SetCapturerInfo(info); + audioCapturer->Start(); + audioCapturer->Read(buffer, framesize, false); + EXPECT_TRUE(sizeof(buffer) > 0); + audioCapturer->Release(); + delete audioCapturer; +} +} // namespace OHOS diff --git a/multimedia_lite/media_lite_posix/audio_native/src/ActsMediaAudioTest.h b/multimedia_lite/media_lite_posix/audio_native/src/ActsMediaAudioTest.h new file mode 100644 index 0000000000000000000000000000000000000000..4b0d97c2e0c7a3b8349f1b9a2f6b20a4c224c3a6 --- /dev/null +++ b/multimedia_lite/media_lite_posix/audio_native/src/ActsMediaAudioTest.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef AUDIOLITETEST_H +#define AUDIOLITETEST_H + +#include + +#include "gtest/gtest.h" +#include "audio_capturer.h" + + +namespace OHOS { +const int RET_SUCCESS = 0; +const int RET_FAILURE = -1; + +struct OHOS::Audio::AudioCapturerInfo audioCapInfo; + +class AudioliteTest : public testing::Test { +public: + // SetUpTestCase: before all testcasee + static void SetUpTestCase(void); + // TearDownTestCase: after all testcase + static void TearDownTestCase(void); + // SetUp + void SetUp(void); + // TearDown + void TearDown(void); +}; +} // namespace OHOS +#endif // AUDIOLITETEST_H diff --git a/multimedia_lite/media_lite_posix/player_native/BUILD.gn b/multimedia_lite/media_lite_posix/player_native/BUILD.gn index d143462147678b42ee0e0e3666af8f8614f1fc03..f1534e20fcdbf5fb0f81800a6e769afcfd05bfec 100644 --- a/multimedia_lite/media_lite_posix/player_native/BUILD.gn +++ b/multimedia_lite/media_lite_posix/player_native/BUILD.gn @@ -11,27 +11,33 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/subsystem/aafwk/config.gni") import("//test/xts/tools/lite/build/suite_lite.gni") hcpptest_suite("ActsMediaPlayerTest") { suite_name = "acts" - sources = [ "src/ActsAudioPlayerTest.cpp" ] - if (ohos_kernel_type == "liteos_a" && - enable_ohos_appexecfwk_feature_ability == true) { - sources += [ "src/ActsVideoPlayerTest.cpp" ] - } - include_dirs = [ "src" ] + sources = [ "src/ActsMediaPlayerTest.cpp" ] ldflags = [ "-lstdc++" ] ldflags += [ "-lm" ] if (ohos_kernel_type == "linux") { ldflags += [ "-lpthread" ] } ldflags += [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ] + + include_dirs = [ + "src", + "//test/xts/acts/multimedia_lite/utils_posix/common/include", + "//third_party/bounds_checking_function/include", + "//foundation/ace/ace_engine_lite/interfaces/innerkits/builtin/base", + "//foundation/ace/ace_engine_lite/interfaces/innerkits/builtin/async", + "//foundation/multimedia/media_lite/interfaces/kits/player_lite", + "//foundation/multimedia/utils/lite/include", + "//foundation/multimedia/media_lite/test/unittest/player_lite", + ] + deps = [ "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", - #"//foundation/multimedia/camera_lite/frameworks:camera_lite", - #"//foundation/multimedia/media_lite/frameworks/recorder_lite:recorder_lite", + "//foundation/multimedia/utils/lite:media_common", + "//third_party/bounds_checking_function:libsec_shared", ] cflags = [ "-Wno-error" ] diff --git a/multimedia_lite/media_lite_posix/player_native/Test.json b/multimedia_lite/media_lite_posix/player_native/Test.json index 00ee2e1f760d35215d76a80cb32d02d958a8bc46..83bae2c02a2175f1687b3e60b75eddceefcab979 100644 --- a/multimedia_lite/media_lite_posix/player_native/Test.json +++ b/multimedia_lite/media_lite_posix/player_native/Test.json @@ -14,9 +14,6 @@ { "source": "testcases/multimedia", "target": "/test_root/multimedia" - },{ - "source": "resource/multimedia", - "target": "/test_root/multimedia" } ] } diff --git a/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp b/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp deleted file mode 100644 index 2cbc6330d950c840c5b60ac733f95b759338bae2..0000000000000000000000000000000000000000 --- a/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp +++ /dev/null @@ -1,1090 +0,0 @@ -/* Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 "unistd.h" -#include -#include -#include "securec.h" -#include "gtest/gtest.h" -#include "source.h" -#include "player.h" -#include "format.h" -#include "PlayerTest.h" -#include "fstream" -#include "iostream" -#include "thread" -#include - -#define DOFUNC_STR_NORET(func, str) \ - do { \ - HI_S32 s32Ret = 0; \ - s32Ret = func; \ - if (s32Ret != HI_SUCCESS) { \ - printf("[liteplayer_sample][%s:%d] ret:%d, %s \n", __FILE__, __LINE__, s32Ret, str); \ - return NULL; \ - } \ - } while (0) - -#define DOFUNC_STR_RET(func, str) \ - do { \ - HI_S32 s32Ret = 0; \ - s32Ret = func; \ - if (s32Ret != HI_SUCCESS) { \ - printf("[liteplayer_sample][%s:%d] ret:%d, %s \n", __FILE__, __LINE__, s32Ret, str); \ - return HI_FAILURE; \ - } \ - } while (0) - -#define IS_OK(ret) \ - do { \ - if (ret != 0) { \ - printf("[%s: %d] ret:%d\n", __func__, __LINE__, ret); \ - } \ - } while (0) - -using namespace std; -using namespace OHOS::Media; -using namespace testing::ext; - -namespace OHOS { -using OHOS::Media::Player; -using OHOS::Media::PlayerSeekMode; -using OHOS::Media::Source; -using OHOS::Media::Format; -using OHOS::Media::StreamSource; -using OHOS::Media::StreamCallback; - -StreamSourceSample::StreamSourceSample(void) -{ - aviableBuffer.clear(); - pthread_mutex_init(&m_mutex, nullptr); -} - -StreamSourceSample::~StreamSourceSample(void) -{ - aviableBuffer.clear(); - pthread_mutex_destroy(&m_mutex); -} - -void StreamSourceSample::SetStreamCallback(const std::shared_ptr &callback) -{ - m_callBack = callback; -} - -uint8_t *StreamSourceSample::GetBufferAddress(size_t idx) -{ - std::shared_ptr callback = m_callBack.lock(); - if (callback == nullptr) { - return nullptr; - } - return callback->GetBuffer(idx); -} - -void StreamSourceSample::QueueBuffer(size_t index, size_t offset, size_t size, int64_t timestampUs, uint32_t flags) -{ - std::shared_ptr callback = m_callBack.lock(); - if (callback == nullptr) { - return; - } - callback->QueueBuffer(index, offset, size, timestampUs, flags); -} - -void StreamSourceSample::OnBufferAvailable(size_t index, size_t offset, size_t size) -{ - IdleBuffer buffer; - pthread_mutex_lock(&m_mutex); - buffer.idx = index; - buffer.offset = offset; - buffer.size = size; - aviableBuffer.push_back(buffer); - pthread_mutex_unlock(&m_mutex); -} - -int StreamSourceSample::GetAvailableBuffer(IdleBuffer *buffer) -{ - pthread_mutex_lock(&m_mutex); - if (aviableBuffer.empty()) { - pthread_mutex_unlock(&m_mutex); - return -1; - } - *buffer = aviableBuffer[0]; - aviableBuffer.erase(aviableBuffer.begin()); - pthread_mutex_unlock(&m_mutex); - return 0; -} - -void *StreamProcess(void *arg) -{ - const int gReadLen = 1024; - const int usleepTime = 20000; - const int flags1 = 8; - const int flags2 = 4; - IdleBuffer buffer; - int ret; - uint8_t *data = nullptr; - size_t readLen; - size_t len; - TestSample *sample = (TestSample *)arg; - FILE* pFile = fopen(sample->filePath, "rb"); - if (pFile == nullptr) { - return nullptr; - } - prctl(PR_SET_NAME, "StreamProc", 0, 0, 0); - printf("[%s,%d] file:%s\n", __func__, __LINE__, sample->filePath); - while (sample->isThreadRunning) { - ret = sample->streamSample->GetAvailableBuffer(&buffer); - if (ret != 0) { - usleep(usleepTime); - continue; - } - data = sample->streamSample->GetBufferAddress(buffer.idx); - if (data == nullptr) { - printf("[%s, %d] get buffer null", __func__, __LINE__); - break; - } - len = (buffer.size < gReadLen) ? buffer.size : gReadLen; - readLen = fread(data + buffer.offset, 1, len, pFile); - if (readLen <= len && readLen > 0) { - sample->streamSample->QueueBuffer(buffer.idx, buffer.offset, readLen, 0, flags1); - } else { - sample->streamSample->QueueBuffer(buffer.idx, buffer.offset, readLen, 0, flags2); - break; - } - } - fclose(pFile); - printf("[%s,%d]\n", __func__, __LINE__); - return nullptr; -} - -void SetSchParam(void) -{ - struct sched_param param; - const int priorityNum = 9; - pthread_attr_t attr; - pthread_attr_getschedparam(&attr, ¶m); - param.sched_priority = priorityNum; - pthread_setschedparam(pthread_self(), SCHED_RR, ¶m); -} -} // namespace OHOS - -const char *g_audioFileName = "Audiochannel_001.aac"; -const char *g_audioFileName1 = "Audiochannel_002.m4a"; - -class ActsAudioPlayerTest : public testing::Test { -protected: -// SetUpTestCase:The preset action of the test suite is executed before the first TestCase - static void SetUpTestCase(void) - { - } -// TearDownTestCase:The test suite cleanup action is executed after the last TestCase - static void TearDownTestCase(void) - { - } -// SetUp:Execute before each test case - virtual void SetUp() - { - SetSchParam(); - g_tagTestSample.adaptr = std::make_shared(); - } -// TearDown:Execute after each test case - virtual void TearDown() - { - g_tagTestSample.adaptr->Reset(); - g_tagTestSample.adaptr->Release(); - const int audioType = 2; - if (g_tagTestSample.sourceType == audioType) { - pthread_mutex_lock(&g_tagTestSample.mutex); - g_tagTestSample.isThreadRunning = 0; - pthread_mutex_unlock(&g_tagTestSample.mutex); - pthread_join(g_tagTestSample.process, nullptr); - pthread_mutex_destroy(&g_tagTestSample.mutex); - } - } -}; - -static int32_t FileCheck1(const char* argv) -{ - if (realpath(argv, g_tagTestSample.filePath) == nullptr) { - printf("realpath input file failed, errno: %d!\n", errno); - return -1; - } - return 0; -} - -static int32_t CreateAndSetAudioSource1() -{ - std::string uri(g_tagTestSample.filePath); - std::map header; - Source source(uri, header); - int32_t ret = g_tagTestSample.adaptr->SetSource(source); - return ret; -} - -static int32_t FileCheck2(const char* argv) -{ - if (realpath(argv, g_tagTestSample.filePath) == nullptr) { - printf("realpath input file failed, errno: %d!\n", errno); - return -1; - } - struct stat stFileState = {0}; - if (lstat(g_tagTestSample.filePath, &stFileState) != 0) { - printf("lstat %s failed, please check the file exist, errno:%d\n", g_tagTestSample.filePath, errno); - return -1; - } - g_tagTestSample.streamSample = std::make_shared(); - return 0; -} - -static int32_t CreateAndSetAudioSource2() -{ - Format formats; - formats.PutStringValue(CODEC_MIME, MIME_AUDIO_AAC); - std::string value; - bool flag = formats.GetStringValue(CODEC_MIME, value); - EXPECT_EQ(true, flag); - Source source(g_tagTestSample.streamSample, formats); - int32_t ret1 = g_tagTestSample.adaptr->SetSource(source); - EXPECT_EQ(HI_SUCCESS, ret1); - flag = formats.CopyFrom(formats); - EXPECT_EQ(true, flag); - std::shared_ptr ret2 = source.GetSourceStream(); - std::map ret3 = formats.GetFormatMap(); - pthread_mutex_init(&g_tagTestSample.mutex, nullptr); - g_tagTestSample.isThreadRunning = 1; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setstacksize(&attr, 0x10000); - int32_t ret = pthread_create(&g_tagTestSample.process, &attr, StreamProcess, &g_tagTestSample); - if (ret != 0) { - printf("pthread_create failed %d\n", ret); - g_tagTestSample.isThreadRunning = 0; - return -1; - } - return 0; -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_FORMAT_0100 - * @tc.name : Set Audio Source 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetSource01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(5); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_FORMAT_0200 - * @tc.name : Set Audio Source 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetSource02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(5); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0100 - * @tc.name : Audio Prepare 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Prepare01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0200 - * @tc.name : Audio Prepare 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Prepare02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0300 - * @tc.name : Audio Play 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Play01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_FAILURE, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(8); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0400 - * @tc.name : Audio Play 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Play02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(8); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0500 - * @tc.name : Audio Stop 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Stop01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0600 - * @tc.name : Audio Stop 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Stop02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0700 - * @tc.name : Audio Stop 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Stop03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0800 - * @tc.name : Audio Stop 04 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Stop04, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_0900 - * @tc.name : Audio Stop 05 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Stop05, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1000 - * @tc.name : Audio Pause 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Pause01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1100 - * @tc.name : Audio Pause 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Pause02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1200 - * @tc.name : Audio Set Volume 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetVolume01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(20, 20); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1300 - * @tc.name : Audio Set Volume 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetVolume02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(300, 300); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1400 - * @tc.name : Audio Set Volume 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetVolume03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(0, 301); - sleep(10); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1500 - * @tc.name : Audio Set Volume 04 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetVolume04, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(5, 5); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1600 - * @tc.name : Audio Set Volume 05 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_SetVolume05, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(-5, 5); - EXPECT_EQ(HI_FAILURE, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1700 - * @tc.name : Get Current Time of Audio 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_GetCurrentTime01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck1(g_audioFileName1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource1(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(3); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1800 - * @tc.name : Get Current Time of Audio 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_GetCurrentTime02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck1(g_audioFileName1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource1(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Rewind(4, PLAYER_SEEK_NEXT_SYNC); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_1900 - * @tc.name : Get Current Time of Audio 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_GetCurrentTime03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck1(g_audioFileName1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource1(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Rewind(4, PLAYER_SEEK_NEXT_SYNC); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2000 - * @tc.name : Get Current Time of Audio 04 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_GetCurrentTime04, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck1(g_audioFileName1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource1(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2100 - * @tc.name : Judging Audio Single Loop Play 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_IsSingleLooping01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(15); - bool flag = g_tagTestSample.adaptr->IsSingleLooping(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2200 - * @tc.name : Judging Audio Single Loop Play 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_IsSingleLooping02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(15); - EXPECT_EQ(HI_SUCCESS, ret); - bool loop = true; - ret = g_tagTestSample.adaptr->EnableSingleLooping(loop); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsSingleLooping(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2300 - * @tc.name : Judging Audio Single Loop Play 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_IsSingleLooping03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - bool loop = true; - ret = g_tagTestSample.adaptr->EnableSingleLooping(loop); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(15); - bool flag = g_tagTestSample.adaptr->IsSingleLooping(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2400 - * @tc.name : Get Duration of Audio 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_GetDuration01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck1(g_audioFileName1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource1(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - int64_t duration; - ret = g_tagTestSample.adaptr->GetDuration(duration); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2500 - * @tc.name : Get Duration of Audio 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_GetDuration02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck1(g_audioFileName1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource1(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t duration; - ret = g_tagTestSample.adaptr->GetDuration(duration); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2600 - * @tc.name : Audio Reset 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Reset01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2700 - * @tc.name : Audio Reset 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Reset02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2800 - * @tc.name : Audio Release 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Release01, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Release(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_2900 - * @tc.name : Audio Release 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Release02, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(5); - ret = g_tagTestSample.adaptr->Release(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0100 - * @tc.name : Audio Play 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Play03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0200 - * @tc.name : Audio Play 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Play04, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0300 - * @tc.name : Audio Pause 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Pause03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0400 - * @tc.name : Audio Prepare 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsAudioPlayerTest, Test_Prepare03, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck2(g_audioFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetAudioSource2(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_FAILURE, ret); -} \ No newline at end of file diff --git a/multimedia_lite/media_lite_posix/player_native/src/ActsMediaPlayerTest.cpp b/multimedia_lite/media_lite_posix/player_native/src/ActsMediaPlayerTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..00ff1593deec667c089163514054a6e6f694f2ef --- /dev/null +++ b/multimedia_lite/media_lite_posix/player_native/src/ActsMediaPlayerTest.cpp @@ -0,0 +1,827 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 "ActsMediaPlayerTest.h" +#include +#include +#include "securec.h" +#include +#include +#include + +namespace OHOS { +const string g_avFileName = "1080P_25fps.mp4"; +const string g_audioFileName = "Audiochannel_002.m4a"; + +const int32_t HI_SUCCESS = 0; +const int32_t HI_FAILURE = -1; + +using OHOS::Media::Player; +using OHOS::Media::PlayerSeekMode; +using OHOS::Media::Source; +using OHOS::Media::Format; +using OHOS::Media::StreamSource; + +static void InitSurface() +{ + OHOS::g_surface->SetUserData("region_position_x", "0"); + OHOS::g_surface->SetUserData("region_position_y", "0"); + OHOS::g_surface->SetUserData("region_width", "720"); + OHOS::g_surface->SetUserData("region_height", "540"); +} + +class PlayerliteTest : public testing::Test { +protected: +// SetUpTestCase:The preset action of the test suite is executed before the first TestCase + static void SetUpTestCase(void) + { + } +// TearDownTestCase:The test suite cleanup action is executed after the last TestCase + static void TearDownTestCase(void) + { + } +// SetUp:Execute before each test case + virtual void SetUp() + { + g_tagTestSample.adaptr = std::make_shared(); + InitSurface(); + } +// TearDown:Execute after each test case + virtual void TearDown() + { + } +}; + +class PlayerliteCallback : public Media::PlayerCallback { +public: + PlayerliteCallback() = default; + + virtual ~PlayerliteCallback() = default; + + void OnPlaybackComplete() override; + + void OnError(int32_t errorType, int32_t errorCode) override; + + void OnInfo(int type, int extra) override; + + void OnVideoSizeChanged(int width, int height) override; + + void OnRewindToComplete() override; +}; + +void PlayerliteCallback::OnPlaybackComplete() +{ + cout << "PlayerTest::OnPlaybackComplete ..." << endl; +} + +void PlayerliteCallback::OnError(int32_t errorType, int32_t errorCode) +{ + cout << "PlayerTest::OnError ..." << endl; +} + +void PlayerliteCallback::OnInfo(int32_t type, int32_t extra) +{ + cout << "PlayerTest::OnInfo ..." << endl; +} + +void PlayerliteCallback::OnVideoSizeChanged(int width, int height) +{ + cout << "PlayerTest::OnVideoSizeChanged ..." << endl; +} + +void PlayerliteCallback::OnRewindToComplete() +{ + cout << "PlayerTest::OnRewindToComplete ..." << endl; +} + + +static int32_t FileCheck(const string &argv) +{ + if (sizeof(argv.c_str()) < sizeof(g_tagTestSample.filePath) && + realpath(argv.c_str(), g_tagTestSample.filePath) == nullptr) { + printf("realpath input file failed, errno: %d!\n", errno); + return -1; + } + return 0; +} + +static int32_t CreateAndSetSource() +{ + std::string uri(g_tagTestSample.filePath); + Source source(uri); + int32_t ret = g_tagTestSample.adaptr->SetSource(source); + string ret1 = source.GetSourceUri(); + return ret; +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0100 + * @tc.name : Video Prepare + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Prepare_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::string uri(g_tagTestSample.filePath); + Source source(uri); + ret = g_tagTestSample.adaptr->SetSource(source); + string ret1 = source.GetSourceUri(); + source.GetSourceType(); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + bool flag = g_tagTestSample.adaptr->IsPlaying(); + EXPECT_EQ(true, flag); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0200 + * @tc.name : Video Prepare + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Prepare_test_002, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0300 + * @tc.name : Video Play Playback Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Play_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + sleep(1); + EXPECT_EQ(HI_SUCCESS, ret); + bool flag = g_tagTestSample.adaptr->IsPlaying(); + EXPECT_EQ(true, flag); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0400 + * @tc.name : Video Stop Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Stop_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr cb; + g_tagTestSample.adaptr->SetPlayerCallback(cb); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(2); + ret = g_tagTestSample.adaptr->Stop(); + EXPECT_EQ(HI_SUCCESS, ret); + bool flag = g_tagTestSample.adaptr->IsPlaying(); + EXPECT_EQ(false, flag); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0500 + * @tc.name : Video Stop Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Stop_test_002, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Stop(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0600 + * @tc.name : Video Pause Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Pause_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(2); + ret = g_tagTestSample.adaptr->Pause(); + EXPECT_EQ(HI_SUCCESS, ret); + bool flag = g_tagTestSample.adaptr->IsPlaying(); + EXPECT_EQ(false, flag); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0700 + * @tc.name : Video Pause Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Pause_test_002, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Pause(); + EXPECT_EQ(HI_FAILURE, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0800 + * @tc.name : Video GetCurrentTime Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_GetCurrentTime_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(1); + int64_t currentPosition; + ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_0900 + * @tc.name : Video GetCurrentTime Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_GetCurrentTime_test_002, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + int64_t currentPosition; + ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(1); + bool flag = g_tagTestSample.adaptr->IsPlaying(); + EXPECT_EQ(true, flag); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1000 + * @tc.name : Video GetDuration Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_GetDuration_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(2); + ret = g_tagTestSample.adaptr->Pause(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Rewind(1, PLAYER_SEEK_NEXT_SYNC); + EXPECT_EQ(HI_SUCCESS, ret); + int64_t currentPosition; + ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1100 + * @tc.name : Video GetDuration Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_GetDuration_test_002, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + int64_t duration; + ret = g_tagTestSample.adaptr->GetDuration(duration); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1200 + * @tc.name : Video GetVideoSurfaceSize Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_GetVideoSurfaceSize_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + int32_t videoWidth; + ret = g_tagTestSample.adaptr->GetVideoWidth(videoWidth); + EXPECT_EQ(HI_SUCCESS, ret); + int32_t videoHeight; + ret = g_tagTestSample.adaptr->GetVideoHeight(videoHeight); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1300 + * @tc.name : Video Reset Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Reset_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(2); + ret = g_tagTestSample.adaptr->Reset(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1400 + * @tc.name : Video Release Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Release_test_001, Level1) +{ + int32_t ret = FileCheck(g_avFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(2); + ret = g_tagTestSample.adaptr->Release(); + EXPECT_EQ(HI_SUCCESS, ret); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1500 + * @tc.name : Audio SetSource Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_AudioSetSource_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(2); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1600 + * @tc.name : Audio Format Play->Pause->Play->Stop Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_AudioPlay_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Pause(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Stop(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1700 + * @tc.name : Audio Format Play Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_Play_test_002, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Stop(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_FAILURE, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1800 + * @tc.name : Audio Format Prepare Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioPrepare_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_1900 + * @tc.name : Audio Format Prepare Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioPrepare_test_002, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2000 + * @tc.name : Audio Format Stop Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioStop_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Stop(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2100 + * @tc.name : Audio Format Stop Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioStop_test_002, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Stop(); + EXPECT_EQ(HI_SUCCESS, ret); + bool flag = g_tagTestSample.adaptr->IsPlaying(); + EXPECT_EQ(false, flag); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2200 + * @tc.name : Audio Format Pause Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioPause_test_002, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Pause(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Pause(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2300 + * @tc.name : Audio Format SetVolume Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_SetVolume_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVolume(40, 40); + sleep(10); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2400 + * @tc.name : Audio Format SetVolume Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_SetVolume_test_002, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVolume(0, 0); + sleep(10); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2500 + * @tc.name : Audio Format SetVolume Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_SetVolume_test_003, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVolume(-1, -1); + sleep(10); + EXPECT_EQ(HI_FAILURE, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2600 + * @tc.name : Audio Format SetVolume Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_SetVolume_test_004, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVolume(300, 300); + sleep(10); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2700 + * @tc.name : Audio Format SetVolume Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_SetVolume_test_005, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->SetVolume(300, 301); + sleep(10); + EXPECT_EQ(HI_FAILURE, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2800 + * @tc.name : Audio Format GetCurrentTime Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioGetCurrentTime_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + sleep(3); + int64_t currentPosition; + ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_2900 + * @tc.name : Audio Format GetCurrentTime Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioGetCurrentTime_test_002, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Play(); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Pause(); + ret = g_tagTestSample.adaptr->Rewind(0, PLAYER_SEEK_NEXT_SYNC); + EXPECT_EQ(HI_SUCCESS, ret); + int64_t currentPosition; + ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); + EXPECT_EQ(HI_SUCCESS, ret); + g_tagTestSample.adaptr->Release(); +} + +/* * + * @tc.number : SUB_MEDIA_PLAYER_PLAY_3000 + * @tc.name : Audio Format Duration Test + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(PlayerliteTest, medialite_player_audioGetDuration_test_001, Level1) +{ + int32_t ret = FileCheck(g_audioFileName); + EXPECT_EQ(HI_SUCCESS, ret); + std::shared_ptr callBack; + callBack = std::make_shared(); + g_tagTestSample.adaptr->SetPlayerCallback(callBack); + ret = CreateAndSetSource(); + EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Prepare(); + EXPECT_EQ(HI_SUCCESS, ret); + int64_t duration; + ret = g_tagTestSample.adaptr->GetDuration(duration); + EXPECT_EQ(HI_SUCCESS, ret); +} +} // OHOS \ No newline at end of file diff --git a/multimedia_lite/media_lite_posix/player_native/src/ActsMediaPlayerTest.h b/multimedia_lite/media_lite_posix/player_native/src/ActsMediaPlayerTest.h new file mode 100644 index 0000000000000000000000000000000000000000..1b0bf49bcec6833e189c0573d6447489752e4c05 --- /dev/null +++ b/multimedia_lite/media_lite_posix/player_native/src/ActsMediaPlayerTest.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef PLAYER_LITE_TEST_H +#define PLAYER_LITE_TEST_H + +#include "gtest/gtest.h" +#include "player.h" + +namespace OHOS { +using OHOS::Media::Player; +using OHOS::Media::PlayerSeekMode; +using OHOS::Media::Source; +using OHOS::Media::Format; +using OHOS::Media::StreamSource; +using OHOS::Media::StreamCallback; +using OHOS::Media::SourceType; +using OHOS::Media::PlayerCallback; + +using namespace std; +using namespace OHOS::Media; +using namespace testing::ext; + +const int FILE_PATH_LEN = 2048; + +using TestSample = struct TagTestSample { + std::shared_ptr adaptr; + char filePath[FILE_PATH_LEN]; +}; + +static TagTestSample g_tagTestSample; +static Surface *g_surface = Surface::CreateSurface(); +} // namespace OHOS +#endif // PLAYER_LITE_TEST_H \ No newline at end of file diff --git a/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp b/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp deleted file mode 100755 index 24b6d0de48e6f7fd402a135617d6c7b18577e292..0000000000000000000000000000000000000000 --- a/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp +++ /dev/null @@ -1,983 +0,0 @@ -/* Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT 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 "PlayerTest.h" - -const char *g_videoFileName = "1080P_25fps.mp4"; - -static void InitSurface() -{ - g_surface->SetUserData("region_position_x", "0"); - g_surface->SetUserData("region_position_y", "0"); - g_surface->SetUserData("region_width", "720"); - g_surface->SetUserData("region_height", "540"); -} - -class ActsVideoPlayerTest : public testing::Test { -protected: -// SetUpTestCase:The preset action of the test suite is executed before the first TestCase - static void SetUpTestCase(void) - { - } -// TearDownTestCase:The test suite cleanup action is executed after the last TestCase - static void TearDownTestCase(void) - { - } -// SetUp:Execute before each test case - virtual void SetUp() - { - SetSchParam(); - g_tagTestSample.adaptr = std::make_shared(); - InitSurface(); - } -// TearDown:Execute after each test case - virtual void TearDown() - { - g_tagTestSample.adaptr->Reset(); - g_tagTestSample.adaptr->Release(); - const int audioType = 2; - if (g_tagTestSample.sourceType == audioType) { - pthread_mutex_lock(&g_tagTestSample.mutex); - g_tagTestSample.isThreadRunning = 0; - pthread_mutex_unlock(&g_tagTestSample.mutex); - pthread_join(g_tagTestSample.process, nullptr); - pthread_mutex_destroy(&g_tagTestSample.mutex); - } - } -}; - -static int32_t FileCheck(const char* argv) -{ - if (realpath(argv, g_tagTestSample.filePath) == nullptr) { - printf("realpath input file failed, errno: %d!\n", errno); - return -1; - } - return 0; -} - -static int32_t CreateAndSetVideoSource() -{ - std::string uri(g_tagTestSample.filePath); - Source source(uri); - int32_t ret = g_tagTestSample.adaptr->SetSource(source); - string ret1 = source.GetSourceUri(); - source.GetSourceType(); - return ret; -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_FORMAT_0300 - * @tc.name : Set Video Source 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_SetSource03, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - std::string uri(g_tagTestSample.filePath); - Source source(uri); - ret = g_tagTestSample.adaptr->SetSource(source); - string ret1 = source.GetSourceUri(); - source.GetSourceType(); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(1); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_FORMAT_0400 - * @tc.name : Set Video Source 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_SetSource04, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - Format formats; - formats.PutIntValue("frame-rate", 30); - int32_t value1; - bool flag = formats.GetIntValue("frame-rate", value1); - EXPECT_EQ(true, flag); - formats.PutLongValue("bitrate", 39200); - long long value2; - flag = formats.GetLongValue("bitrate", value2); - EXPECT_EQ(true, flag); - formats.PutFloatValue("color-format", 2413.5f); - float value3; - flag = formats.GetFloatValue("color-format", value3); - EXPECT_EQ(true, flag); - formats.PutDoubleValue("color-format", 9930708); - double value4; - flag = formats.GetDoubleValue("color-format", value4); - EXPECT_EQ(true, flag); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(10); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_FORMAT_0500 - * @tc.name : Set Video Source 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_SetSource05, Function | MediumTest | Level0) -{ - int32_t ret=FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - Format formats; - std::map ret3 = formats.GetFormatMap(); - FormatData Formats1(FORMAT_TYPE_INT32); - Formats1.SetValue(23); - int32_t vax1; - bool flag = Formats1.GetInt32Value(vax1); - EXPECT_EQ(true, flag); - cout<<"+++"<Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(10); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3000 - * @tc.name : Video Prepare 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Prepare04, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3100 - * @tc.name : Video Prepare 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Prepare05, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3200 - * @tc.name : Video Play 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Play05, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_FAILURE, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(2); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3300 - * @tc.name : Video Play 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Play06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(1); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(1); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3400 - * @tc.name : Video Stop 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Stop06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - std::shared_ptr cb; - g_tagTestSample.adaptr->SetPlayerCallback(cb); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3500 - * @tc.name : Video Stop 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Stop07, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3600 - * @tc.name : Video Stop 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Stop08, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3700 - * @tc.name : Video Stop 04 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Stop09, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(10); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3800 - * @tc.name : Video Stop 05 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Stop10, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(1); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_3900 - * @tc.name : Video Pause 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Pause04, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsPlaying(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4000 - * @tc.name : Video Pause 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Pause05, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4100 - * @tc.name : Video Set Volume 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_SetVolume06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(30, 30); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4200 - * @tc.name : Video Set Volume 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_SetVolume07, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(300, 300); - sleep(2); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4300 - * @tc.name : Video Set Volume 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_SetVolume08, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVolume(0, 0); - sleep(2); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4400 - * @tc.name : Judging Video Single Loop Play 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping04, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(10); - bool flag = g_tagTestSample.adaptr->IsSingleLooping(); - EXPECT_EQ(false, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4500 - * @tc.name : Judging Video Single Loop Play 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping05, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(10); - EXPECT_EQ(HI_SUCCESS, ret); - bool loop = true; - ret = g_tagTestSample.adaptr->EnableSingleLooping(loop); - EXPECT_EQ(HI_SUCCESS, ret); - bool flag = g_tagTestSample.adaptr->IsSingleLooping(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4600 - * @tc.name : Judging Video Single Loop Play 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - bool loop = true; - ret = g_tagTestSample.adaptr->EnableSingleLooping(loop); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(10); - bool flag = g_tagTestSample.adaptr->IsSingleLooping(); - EXPECT_EQ(true, flag); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4700 - * @tc.name : Get Current Time of Video 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_GetCurrentTime05, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(1); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4800 - * @tc.name : Get Current Time of Video 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_GetCurrentTime06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Rewind(1, PLAYER_SEEK_NEXT_SYNC); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_4900 - * @tc.name : Get Duration of Video 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_GetDuration03, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Rewind(1, PLAYER_SEEK_NEXT_SYNC); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t currentPosition; - ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5000 - * @tc.name : Get Duration of Video 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_GetDuration04, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - int64_t duration; - ret = g_tagTestSample.adaptr->GetDuration(duration); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5100 - * @tc.name : Get Duration of Video 03 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_GetDuration05, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - int64_t duration; - ret = g_tagTestSample.adaptr->GetDuration(duration); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5200 - * @tc.name : Get Video Surface Size 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_GetVideoSurfaceSize01, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - int32_t videoWidth; - ret = g_tagTestSample.adaptr->GetVideoWidth(videoWidth); - EXPECT_EQ(HI_SUCCESS, ret); - int32_t videoHeight; - ret = g_tagTestSample.adaptr->GetVideoHeight(videoHeight); - EXPECT_EQ(HI_SUCCESS, ret); -} - - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5300 - * @tc.name : Video Reset 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Reset03, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5400 - * @tc.name : Video Reset 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Reset04, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5500 - * @tc.name : Video Release 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Release03, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Release(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_PLAY_5600 - * @tc.name : Video Release 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Release04, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_SUCCESS, ret); - sleep(2); - ret = g_tagTestSample.adaptr->Release(); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0500 - * @tc.name : Video Play 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Play07, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(2); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Stop(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0600 - * @tc.name : Video Play 02 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Play08, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->SetVideoSurface(g_surface); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(2); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Play(); - sleep(2); - EXPECT_EQ(HI_SUCCESS, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0700 - * @tc.name : Video Pause 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Pause06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Pause(); - EXPECT_EQ(HI_FAILURE, ret); -} - -/* * - * @tc.number : SUB_MEDIA_PLAYER_DIFFERENT_SCENE_0800 - * @tc.name : Video Prepare 01 - * @tc.desc : [C- SOFTWARE -0200] - * @tc.size : MEDIUM - * @tc.type : FUNC - * @tc.level : Level 0 - */ -HWTEST_F(ActsVideoPlayerTest, Test_Prepare06, Function | MediumTest | Level0) -{ - int32_t ret = FileCheck(g_videoFileName); - EXPECT_EQ(HI_SUCCESS, ret); - ret = CreateAndSetVideoSource(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Reset(); - EXPECT_EQ(HI_SUCCESS, ret); - ret = g_tagTestSample.adaptr->Prepare(); - EXPECT_EQ(HI_FAILURE, ret); -} \ No newline at end of file diff --git a/multimedia_lite/media_lite_posix/player_native/src/PlayerTest.h b/multimedia_lite/media_lite_posix/player_native/src/PlayerTest.h deleted file mode 100644 index e412a608bbe34a0cc6b02f7af50f8317c447d615..0000000000000000000000000000000000000000 --- a/multimedia_lite/media_lite_posix/player_native/src/PlayerTest.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef TEST_XTS_ACTS_MULTIMEDIA_LITE_MULTIMEDIA_POSIX_PLAYER_SRC_PLAYERTEST_H -#define TEST_XTS_ACTS_MULTIMEDIA_LITE_MULTIMEDIA_POSIX_PLAYER_SRC_PLAYERTEST_H -#include -#include "unistd.h" -#include -#include "securec.h" -#include "gtest/gtest.h" -#include "source.h" -#include "player.h" -#include "format.h" -#include "fstream" -#include "iostream" -#include "thread" -#include -#endif - -const int FRAME_RATE_DEFAULT = 30; -const int FILE_PATH_LEN = 2048; - -#define DOFUNC_STR_NORET(func, str) \ - do { \ - HI_S32 s32Ret = 0; \ - s32Ret = func; \ - if (s32Ret != HI_SUCCESS) { \ - printf("[liteplayer_sample][%s:%d] ret:%d, %s \n", __FILE__, __LINE__, s32Ret, str); \ - return NULL; \ - } \ - } while (0) - -#define DOFUNC_STR_RET(func, str) \ - do { \ - HI_S32 s32Ret = 0; \ - s32Ret = func; \ - if (s32Ret != HI_SUCCESS) { \ - printf("[liteplayer_sample][%s:%d] ret:%d, %s \n", __FILE__, __LINE__, s32Ret, str); \ - return HI_FAILURE; \ - } \ - } while (0) - -#define IS_OK(ret) \ - do { \ - if (ret != 0) { \ - printf("[%s: %d] ret:%d\n", __func__, __LINE__, ret); \ - } \ - } while (0) - -namespace OHOS { -using OHOS::Media::Player; -using OHOS::Media::PlayerSeekMode; -using OHOS::Media::Source; -using OHOS::Media::Format; -using OHOS::Media::StreamSource; -using OHOS::Media::StreamCallback; -using OHOS::Media::SourceType; -using OHOS::Media::PlayerCallback; - -using namespace std; -using namespace OHOS::Media; -using namespace testing::ext; - -class StreamSourceSample; -using TestSample = struct TagTestSample { - std::shared_ptr adaptr; - pthread_t process; - pthread_mutex_t mutex; - int32_t isThreadRunning; - int32_t sourceType; - char filePath[FILE_PATH_LEN]; - std::shared_ptr streamSample; -}; - -using IdleBuffer = struct TagIdleBuffer { - size_t idx; - size_t offset; - size_t size; -}; - -class StreamSourceSample : public StreamSource { -public: - StreamSourceSample(void); - ~StreamSourceSample(void); - void OnBufferAvailable(size_t index, size_t offset, size_t size); - void SetStreamCallback(const std::shared_ptr &callback); - uint8_t *GetBufferAddress(size_t idx); - void QueueBuffer(size_t index, size_t offset, size_t size, int64_t timestampUs, uint32_t flags); - int GetAvailableBuffer(IdleBuffer *buffer); - std::weak_ptr m_callBack; - pthread_mutex_t m_mutex; -private: - std::vector aviableBuffer; -}; - -void *StreamProcess(const void *arg); -void SetSchParam(void); -} // namespace OHOS - -using namespace OHOS; -const int HI_SUCCESS = 0; -const int HI_FAILURE = -1; -static TagTestSample g_tagTestSample; -static Surface *g_surface = Surface::CreateSurface();