From 20b7ecfaa34ba0f648a7e8a7d3cb039b89c6f056 Mon Sep 17 00:00:00 2001 From: z_apperception Date: Thu, 14 Oct 2021 17:50:33 +0800 Subject: [PATCH] Signed-off-by: z_apperception --- .../media_lite_posix/recorder_native/BUILD.gn | 12 +- .../src/ActsMediaRecorderTest.cpp | 1830 +++++++++++++++++ .../src/ActsMediaRecorderTest.h | 48 + .../src/include/ActsMediaRecorderTest.h | 188 -- .../src/testcase/ActsMediaRecorderNDKTest.cpp | 1084 ---------- 5 files changed, 1888 insertions(+), 1274 deletions(-) create mode 100644 multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp create mode 100644 multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.h delete mode 100755 multimedia_lite/media_lite_posix/recorder_native/src/include/ActsMediaRecorderTest.h delete mode 100755 multimedia_lite/media_lite_posix/recorder_native/src/testcase/ActsMediaRecorderNDKTest.cpp diff --git a/multimedia_lite/media_lite_posix/recorder_native/BUILD.gn b/multimedia_lite/media_lite_posix/recorder_native/BUILD.gn index c97f96895..8ff2e121d 100644 --- a/multimedia_lite/media_lite_posix/recorder_native/BUILD.gn +++ b/multimedia_lite/media_lite_posix/recorder_native/BUILD.gn @@ -15,11 +15,19 @@ import("//test/xts/tools/lite/build/suite_lite.gni") hcpptest_suite("ActsMediaRecorderTest") { suite_name = "acts" - sources = [ "src/testcase/ActsMediaRecorderNDKTest.cpp" ] + sources = [ "src/ActsMediaRecorderTest.cpp" ] include_dirs = [ - "src/include", + "src", "//test/xts/acts/multimedia_lite/utils_posix/common/include", + "//third_party/bounds_checking_function/include", + "//drivers/peripheral/codec/interfaces/include", + "//foundation/multimedia/utils/lite/hals", + "//foundation/multimedia/media_lite/test/unittest/recorder_lite", + "//foundation/multimedia/media_lite/interfaces/kits/recorder_lite", + "//foundation/multimedia/media_lite/frameworks/recorder_lite", + "//foundation/multimedia/media_lite/frameworks/recorder_lite/recoder_sink/include", + "//foundation/multimedia/media_lite/frameworks/recorder_lite/recoder_source/include", ] deps = [ diff --git a/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp b/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp new file mode 100644 index 000000000..c5d8e63cc --- /dev/null +++ b/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.cpp @@ -0,0 +1,1830 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 "ActsMediaRecorderTest.h" + +#include "media_info.h" +#include "media_errors.h" +#include "recorder.h" + +#include + +using namespace std; +using namespace OHOS; +using namespace OHOS::Media; +using namespace testing::ext; + +namespace OHOS { +const int32_t RET_OK = 0; +const int32_t RET_NOK = -1; +static int32_t g_recorderSourceMaxCount = 4; // max recorder source setting + +void RecoderLiteTest::SetUpTestCase(void) {} + +void RecoderLiteTest::TearDownTestCase(void) {} + +void RecoderLiteTest::SetUp() {} + +void RecoderLiteTest::TearDown() {} + +void RecoderLiteTest::OnError(const int32_t errorType, const int32_t errorCode) +{ + cout << "RecoderLiteTest::OnError ..." << endl; +} + +void RecoderLiteTest::OnInfo(const int32_t type, const int32_t extra) +{ + cout << "RecoderLiteTest::OnInfo ..." << endl; +} + +namespace Media { +void TestVideoRecorderCallback::OnError(int32_t errorType, int32_t errorCode) +{ + cout << "TestVideoRecorderCallback::OnError ..." << endl; +} + +void TestVideoRecorderCallback::OnInfo(int32_t type, int32_t extra) +{ + cout << "TestVideoRecorderCallback::OnInfo ..." << endl; +} +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0100 + * @tc.name : Start recorder + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Start_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0200 + * @tc.name : Start recorder without recorder sink prepare + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Start_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_NE(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0300 + * @tc.name : Pasue recorder + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Pause_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Pause(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0400 + * @tc.name : Pause recorder - pause multiple times + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Pause_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Pause(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Pause(); + EXPECT_NE(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0500 + * @tc.name : Resume recorder + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Resume_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Pause(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Resume(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0600 + * @tc.name : Resume recorder - resume multiple times + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Resume_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Pause(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Resume(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Resume(); + EXPECT_NE(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0700 + * @tc.name : Stop recorder + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Stop_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Stop(true); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0800 + * @tc.name : Stop recorder - stop multiple times + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Stop_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Stop(true); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Stop(true); + EXPECT_NE(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_0900 + * @tc.name : Reset recorder + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Reset_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Reset(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1000 + * @tc.name : Reset recorder - Reset multiple times + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Reset_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Reset(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Reset(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1100 + * @tc.name : Release recorder + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Release_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + EXPECT_EQ(RET_OK, retStatus); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1200 + * @tc.name : Reset recorder - Reset multiple times + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Release_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + EXPECT_NE(RET_OK, retStatus); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1300 + * @tc.name : SetFileSplitDuration POST recording + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetFileSplitDuration_test_001, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + FileSplitType type = FILE_SPLIT_POST; + int64_t timestamp = -1; + uint32_t duration = 5; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetFileSplitDuration(type, timestamp, duration); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1400 + * @tc.name : SetFileSplitDuration PRE recording + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetFileSplitDuration_test_002, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + FileSplitType type = FILE_SPLIT_PRE; + int64_t timestamp = -1; + uint32_t duration = 5; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetFileSplitDuration(type, timestamp, duration); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1500 + * @tc.name : SetFileSplitDuration NORMAL recording + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetFileSplitDuration_test_003, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + FileSplitType type = FILE_SPLIT_NORMAL; + int64_t timestamp = -1; + uint32_t duration = 5; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetFileSplitDuration(type, timestamp, duration); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1600 + * @tc.name : SetFileSplitDuration NORMAL recording in PAUSE state + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetFileSplitDuration_test_004, Level1) +{ + int32_t retStatus = 0; + int32_t sourceId = 0; + int32_t audioSourceId = 0; + FileSplitType type = FILE_SPLIT_NORMAL; + int64_t timestamp = -1; + uint32_t duration = 5; + Recorder *recInstance = new Recorder(); + shared_ptr cb = std::make_shared (); + + retStatus = recInstance->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Prepare(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetRecorderCallback(cb); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Start(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->Pause(); + EXPECT_EQ(RET_OK, retStatus); + retStatus = recInstance->SetFileSplitDuration(type, timestamp, duration); + EXPECT_NE(RET_OK, retStatus); + retStatus = recInstance->Release(); + delete recInstance; + recInstance = nullptr; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1700 + * @tc.name : Set Video Source ES + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSource_test_001, Level1) +{ + cout << "medialite_recorder_SetVideoSource01 starting..." << endl; + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + cout << "medialite_recorder_SetVideoSource01 ending..." << endl; + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1800 + * @tc.name : Set Video Source YUV + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSource_test_002, Level1) +{ + cout << "medialite_recorder_SetVideoSource01 starting..." << endl; + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_YUV, sourceId); + EXPECT_EQ(SUCCESS, ret); + cout << "medialite_recorder_SetVideoSource01 ending..." << endl; + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_1900 + * @tc.name : Set Video Source RGB + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSource_test_003, Level1) +{ + cout << "medialite_recorder_SetVideoSource03 starting..." << endl; + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_RGB, sourceId); + EXPECT_EQ(RET_OK, ret); + cout << "medialite_recorder_SetVideoSource03 ending..." << endl; + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2000 + * @tc.name : Set Video Source invalid + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSource_test_004, Level1) +{ + cout << "medialite_recorder_SetVideoSource01 starting..." << endl; + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_BUTT, sourceId); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + cout << "medialite_recorder_SetVideoSource01 ending..." << endl; + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2100 + * @tc.name : Set Video Source Max count 4 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSource_test_005, Level1) +{ + cout << "medialite_recorder_SetVideoSource01 starting..." << endl; + Recorder *recorder = new Recorder(); + for (int32_t i = 0; i < g_recorderSourceMaxCount; i++) { + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, i); + EXPECT_EQ(RET_OK, ret); + } + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, g_recorderSourceMaxCount); + EXPECT_EQ(ERR_NOFREE_CHANNEL, ret); + cout << "medialite_recorder_SetVideoSource01 ending..." << endl; + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2200 + * @tc.name : Set Video Encoder with video surface + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncoder_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoEncoder(sourceId, HEVC); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2300 + * @tc.name : Set Video Encoder without video surface + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncoder_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 10000; + int32_t ret = recorder->SetVideoEncoder(sourceId, HEVC); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2400 + * @tc.name : Set Video Encoder with VIDEO_DEFAULT + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncoder_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoEncoder(sourceId, VIDEO_DEFAULT); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2500 + * @tc.name : Set Video Encoder with H264 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncoder_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoEncoder(sourceId, H264); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2600 + * @tc.name : Set Video Encoder with invalid video source + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncoder_test_005, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_BUTT, sourceId); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + ret = recorder->SetVideoEncoder(sourceId, HEVC); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2700 + * @tc.name : Set Video Size valid resolution + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSize_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t width = 1920; + int32_t height = 1080; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoSize(sourceId, width, height); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2800 + * @tc.name : Set Video Size invalid resolution + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSize_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t width = -1920; + int32_t height = -1080; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoSize(sourceId, width, height); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_2900 + * @tc.name : Set Video Size valid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSize_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 10000; + int32_t width = 1920; + int32_t height = 1080; + int32_t ret = recorder->SetVideoSize(sourceId, width, height); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3000 + * @tc.name : Set Video Size unsupported resolution + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSize_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t width = 1280; + int32_t height = 720; + int32_t ret = recorder->SetVideoSize(sourceId, width, height); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3100 + * @tc.name : Set Video Size invalid resolution + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoSize_test_005, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t width = 0; + int32_t height = 0; + int32_t ret = recorder->SetVideoSize(sourceId, width, height); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3200 + * @tc.name : Set Video FrameRate with valid value + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoFrameRate_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t frameRate = 30; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoFrameRate(sourceId, frameRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3300 + * @tc.name : Set Video FrameRate with invalid value + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoFrameRate_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t frameRate = -1; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoFrameRate(sourceId, frameRate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3400 + * @tc.name : Set Video FrameRate with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoFrameRate_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 10000; + int32_t frameRate = 30; + int32_t ret = recorder->SetVideoFrameRate(sourceId, frameRate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3500 + * @tc.name : Set Video Encoding BitRate with valid info + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncodingBitRate_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t rate = 4096; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoEncodingBitRate(sourceId, rate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3600 + * @tc.name : Set Video Encoding BitRate with invalid rate + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncodingBitRate_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t rate = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetVideoEncodingBitRate(sourceId, rate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3700 + * @tc.name : Set Video Encoding BitRate with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetVideoEncodingBitRate_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 10000; + int32_t rate = 4096; + int32_t ret = recorder->SetVideoEncodingBitRate(sourceId, rate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3800 + * @tc.name : Set Capture Rate with valid info + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetCaptureRate_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + double fps = 30.0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetCaptureRate(sourceId, fps); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_3900 + * @tc.name : Set Capture Rate with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetCaptureRate_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 10000; + double fps = 30.0; + int32_t ret = recorder->SetCaptureRate(sourceId, fps); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4000 + * @tc.name : Set Capture Rate with invalid fps + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetCaptureRate_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + double fps = -30.0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetCaptureRate(sourceId, fps); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4100 + * @tc.name : Set Audio Source with valid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSource_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4200 + * @tc.name : Set Audio Source with invalid source + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSource_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_SOURCE_INVALID, audioSourceId); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4300 + * @tc.name : Set Audio Source multiple times + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSource_test_003, Level1) +{ + int32_t sourceId; + int32_t ret; + Recorder *recorder = new Recorder(); + for (int32_t i = 0; i < g_recorderSourceMaxCount; i++) { + ret = recorder->SetAudioSource(AUDIO_MIC, sourceId); + cout << i << endl; + EXPECT_EQ(RET_OK, ret); + } + ret = recorder->SetAudioSource(AUDIO_MIC, sourceId); + EXPECT_EQ(ERR_NOFREE_CHANNEL, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4400 + * @tc.name : Set Audio Encoder with AAC_LC + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncoder(audioSourceId, AAC_LC); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4500 + * @tc.name : Set Audio Encoder with AUDIO_DEFAULT + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncoder(audioSourceId, AUDIO_DEFAULT); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4600 + * @tc.name : Set Audio Encoder with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 10000; + int32_t ret = recorder->SetAudioEncoder(audioSourceId, AAC_LC); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4700 + * @tc.name : Set Audio Encoder with valid data AAC_HE_V1 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncoder(audioSourceId, AAC_HE_V1); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4800 + * @tc.name : Set Audio Encoder with valid data AAC_HE_V2 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_005, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncoder(audioSourceId, AAC_HE_V2); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_4900 + * @tc.name : Set Audio Encoder with valid data AAC_LD + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_006, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncoder(audioSourceId, AAC_LD); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5000 + * @tc.name : Set Audio Encoder with valid data AAC_ELD + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncoder_test_007, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncoder(audioSourceId, AAC_ELD); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5100 + * @tc.name : Set Audio Sample Rate with valid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t sampleRate = 48000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5200 + * @tc.name : Set Audio Sample Rate with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 10000; + int32_t sampleRate = 48000; + int32_t ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5300 + * @tc.name : Set Audio Sample Rate with invalid sample rate + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t sampleRate = -48000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5400 + * @tc.name : Set Audio Sample Rate with 44.1Khz + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t sampleRate = 44100; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5500 + * @tc.name : Set Audio Sample Rate with 8Khz + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_005, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t sampleRate = 8000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5600 + * @tc.name : Set Audio Sample Rate with 16Khz + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_006, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t sampleRate = 16000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5700 + * @tc.name : Set Audio Sample Rate with 32Khz + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioSampleRate_test_007, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t sampleRate = 32000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5800 + * @tc.name : Set Audio Channels with valid one channel count + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t channelCount = 1; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_5900 + * @tc.name : Set Audio Channels with valid two channel count + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t channelCount = 2; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6000 + * @tc.name : Set Audio Channels with invalid channel count + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t channelCount = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6100 + * @tc.name : Set Audio Channels with valid one channel count and AUDIO_VOICE_CALL as source + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t channelCount = 2; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6200 + * @tc.name : Set Audio Channels with valid two channel count and AUDIO_VOICE_CALL as source + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_005, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t channelCount = 1; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6300 + * @tc.name : Set Audio Channels with invalid channel count and AUDIO_VOICE_CALL as source + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_006, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t channelCount = 0; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6400 + * @tc.name : Set Audio Channels with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioChannels_test_007, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 100000; + int32_t channelCount = 1; + int32_t ret = recorder->SetAudioChannels(audioSourceId, channelCount); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6500 + * @tc.name : Set Audio Encoding BitRate with valid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 48000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6600 + * @tc.name : Set Audio Encoding BitRate with 44000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 44000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6700 + * @tc.name : Set Audio Encoding BitRate with 8000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 8000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6800 + * @tc.name : Set Audio Encoding BitRate with 16000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 16000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_6900 + * @tc.name : Set Audio Encoding BitRate with 32000 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_005, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 32000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7000 + * @tc.name : Set Audio Encoding BitRate with invalid bitrate + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_006, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = -48000; + int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7100 + * @tc.name : Set Audio Encoding BitRate with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_007, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 10000; + int32_t audioEncodingBitRate = 48000; + int32_t ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7200 + * @tc.name : Set Audio Encoding BitRate with valid data and source AUDIO_VOICE_CALL + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_008, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 48000; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7300 + * @tc.name : Set Audio Encoding BitRate with 44000 and source AUDIO_VOICE_CALL + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_009, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 44000; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7400 + * @tc.name : Set Audio Encoding BitRate with 8000 and source AUDIO_VOICE_CALL + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_010, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 8000; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7500 + * @tc.name : Set Audio Encoding BitRate with 16000 and source AUDIO_VOICE_CALL + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_011, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 16000; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7600 + * @tc.name : Set Audio Encoding BitRate with 32000 and source AUDIO_VOICE_CALL + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetAudioEncodingBitRate_test_012, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t audioSourceId = 0; + int32_t audioEncodingBitRate = 32000; + int32_t ret = recorder->SetAudioSource(AUDIO_VOICE_CALL, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7700 + * @tc.name : Prepare recorder with valid info + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_Prepare_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t audioSourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); + EXPECT_EQ(RET_OK, ret); + ret = recorder->Prepare(); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7800 + * @tc.name : GetSurface with valid info + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_GetSurface_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 0; + int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); + EXPECT_EQ(RET_OK, ret); + Surface *surface = recorder->GetSurface(sourceId).get(); + ret = (int32_t)(surface == nullptr); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_7900 + * @tc.name : GetSurface with invalid source ID + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_GetSurface_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t sourceId = 10000; + Surface *surface = recorder->GetSurface(sourceId).get(); + EXPECT_EQ(nullptr, surface); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8000 + * @tc.name : Set Max Duration with valid value + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetMaxDuration_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetMaxDuration(1000); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8100 + * @tc.name : Set Max Duration with zero value + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetMaxDuration_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetMaxDuration(0); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8200 + * @tc.name : Set Max Duration with invalid value + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetMaxDuration_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetMaxDuration(-1); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8300 + * @tc.name : Set Max Duration with invalid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetMaxDuration_test_004, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetMaxDuration(4294967295); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8400 + * @tc.name : Set Max File Size with invalid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetMaxFileSize_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetMaxFileSize(0); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8500 + * @tc.name : Set Max File Size with valid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetMaxFileSize_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetMaxFileSize(2000); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8600 + * @tc.name : Set Output File with invalid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetOutputFile_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetOutputFile(-1); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8700 + * @tc.name : Set Next Output File with invalid data + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetNextOutputFile_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetNextOutputFile(-1); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8800 + * @tc.name : Set Output Path with empty path + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetOutputPath_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + const string path = ""; + int32_t ret = recorder->SetOutputPath(path); + EXPECT_EQ(ERR_INVALID_PARAM, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_8900 + * @tc.name : Set Output Path with FORMAT_DEFAULT + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetOutputFormat_test_001, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetOutputFormat(FORMAT_DEFAULT); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_9000 + * @tc.name : Set Output Path with FORMAT_MPEG_4 + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetOutputFormat_test_002, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetOutputFormat(FORMAT_MPEG_4); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} + +/* * + * @tc.number : SUB_MEDIA_REC_TEST_9100 + * @tc.name : Set Output Path with FORMAT_TS + * @tc.desc : [C- SOFTWARE -0200] + */ +HWTEST_F(RecoderLiteTest, medialite_recorder_SetOutputFormat_test_003, Level1) +{ + Recorder *recorder = new Recorder(); + int32_t ret = recorder->SetOutputFormat(FORMAT_TS); + EXPECT_EQ(RET_OK, ret); + delete recorder; + recorder = NULL; +} +} // namespace OHOS diff --git a/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.h b/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.h new file mode 100644 index 000000000..7ed0f2b09 --- /dev/null +++ b/multimedia_lite/media_lite_posix/recorder_native/src/ActsMediaRecorderTest.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef RECORDER_LITE_TEST_H +#define RECORDER_LITE_TEST_H + +#include "gtest/gtest.h" +#include "recorder.h" + +using OHOS::Media::RecorderCallback; +namespace OHOS { +class RecoderLiteTest : 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); + + void OnError(const int32_t errorType, const int32_t errorCode); + + void OnInfo(const int32_t type, const int32_t extra); +}; + +namespace Media { +class TestVideoRecorderCallback : public RecorderCallback { +public: + void OnError(int32_t errorType, int32_t errorCode); + + void OnInfo(int32_t type, int32_t extra); +}; +} +} +#endif // RECORDER_LITE_TEST_H diff --git a/multimedia_lite/media_lite_posix/recorder_native/src/include/ActsMediaRecorderTest.h b/multimedia_lite/media_lite_posix/recorder_native/src/include/ActsMediaRecorderTest.h deleted file mode 100755 index 5d96ae40a..000000000 --- a/multimedia_lite/media_lite_posix/recorder_native/src/include/ActsMediaRecorderTest.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ACTS_MEDIA_RECODER_TEST_H -#define ACTS_MEDIA_RECODER_TEST_H - -#include -#include "recorder.h" -#include "gtest/gtest.h" -#include "camera_kit.h" -#include "TestCaseParse.h" -#include "ActsTestMediaUtils.h" - -#define TESTCASECOUNT 38 - -const string g_testPath; -const string g_recordFilePath; -static int32_t g_fdNull = -1; // fd is null -static int32_t g_sleepTime = 1; - -using namespace std; -using namespace OHOS; -using namespace OHOS::Media; -using namespace testing::ext; - -/* * - * creat camera device callback - */ -class SampleCameraDeviceCallback : public CameraDeviceCallback { -public: - SampleCameraDeviceCallback() - { - cout << "camera device call back created" << endl; - } - - ~SampleCameraDeviceCallback() - { - cout << "camera device call back destroyed" << endl; - } - /* * - * camera statu changed - */ - void OnCameraStatus(std::string cameraId, int32_t status) override; -}; - -/* * - * create FrameStateCallback - */ -class SampleFrameStateCallback : public FrameStateCallback { - void OnFrameFinished(Camera &camera, FrameConfig &fc, FrameResult &result) override; - void OnFrameError(Camera &camera, FrameConfig &frameConfig, int32_t errorCode, FrameResult &frameResult) override; -}; - -/* * - * create CameraStateCallback - */ -class SampleCameraStateMng : public CameraStateCallback { -public: - SampleCameraStateMng() = delete; - - SampleCameraStateMng(EventHandler &eventHandler) : eventHandler(eventHandler) {} - - ~SampleCameraStateMng() - { - CloseRecorder(); - if (cam_ != nullptr) { - cam_->Release(); - } - } - - // close Recorder - void CloseRecorder(); - - // 相机创建成功 - void OnCreated(Camera &c) override; - - // 相机创建失败 - void OnCreateFailed(const std::string cameraId, int32_t errorCode) override - { - cout << "CameraStateCallback OnCreateFailed\n" << endl; - } - - void OnReleased(Camera &c) override - { - cout << "CameraStateCallback OnReleased\n" << endl; - } - - void OnConfigured(Camera &c) override - { - cout << "CameraStateCallback OnConfigured\n" << endl; - } - - void OnConfigureFailed(const std::string cameraId, int32_t errorCode) override - { - cout << "CameraStateCallback OnConfigureFailed\n" << endl; - } - - // 创建Reorder - int32_t SampleCreateRecorder(TestCase &ft); - - // 准备录像 - int32_t PrepareRecorder(); - - // 开始录像 - int32_t StartRecord(); - - /* * - * 开始预览 - */ - int32_t StartPreview(); - - /* * - * 拍照,并保存文件 - */ - int32_t Capture(); - - /* * - * 停止录像 - */ - int32_t Stop(); - -private: - enum State : int32_t { - STATE_IDLE, - STATE_RUNNING, - STATE_BUTT - }; - State previewState_ = STATE_IDLE; - State recordState_ = STATE_IDLE; - EventHandler &eventHandler; - Recorder *recorder_ = nullptr; - Camera *cam_ = nullptr; - int32_t recordFd_ = g_fdNull; - SampleFrameStateCallback fsCb_; -}; - -/* * - * Media Recorder test - */ -class ActsMediaRecorderTest : public testing::Test { -public: - /* * - * @tc.setup:This is before test class - */ - static void SetUpTestCase(void); - - /* * - * @tc.setup:This is after test class - */ - static void TearDownTestCase(void); - - /* * - * @tc.setup:This is before test case - */ - virtual void SetUp(void); - - /* * - * @tc.setup:This is after test case - */ - virtual void TearDown(void); - - /* * - * Create CameraKit - */ - virtual void CreateCameraKit(void); - - /* * - * release Camera - */ - virtual void ReleaseCameraKit(void); - - CameraKit *cameraKit_; - string camId; -}; - -#endif // ACTS_MEDIA_RECODER_TEST_H \ No newline at end of file diff --git a/multimedia_lite/media_lite_posix/recorder_native/src/testcase/ActsMediaRecorderNDKTest.cpp b/multimedia_lite/media_lite_posix/recorder_native/src/testcase/ActsMediaRecorderNDKTest.cpp deleted file mode 100755 index 711ba1ddf..000000000 --- a/multimedia_lite/media_lite_posix/recorder_native/src/testcase/ActsMediaRecorderNDKTest.cpp +++ /dev/null @@ -1,1084 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include "camera_kit.h" -#include "recorder.h" -#include "gtest/gtest.h" -#include "ActsTestMediaUtils.h" - -static int32_t g_recoderSourceMaxCount = 4; // max recorder source setting - -using namespace std; -using namespace OHOS; -using namespace OHOS::Media; -using namespace testing::ext; - -/* * - * Media Recorder test - */ -class ActsMediaRecorderNDKTest : public testing::Test { -protected: - /* * - * @tc.setup:This is before test class - */ - static void SetUpTestCase(void); - - /* * - * @tc.setup:This is after test class - */ - static void TearDownTestCase(void); - - /* * - * @tc.setup:This is before test case - */ - virtual void SetUp(void); - - /* * - * @tc.setup:This is after test case - */ - virtual void TearDown(void); -}; - -/* * - * @tc.setup:This is before test class - */ -void ActsMediaRecorderNDKTest::SetUpTestCase(void) -{ - cout << "SetUpTestCase" << endl; -} - -/* * - * @tc.setup:This is after test class - */ -void ActsMediaRecorderNDKTest::TearDownTestCase(void) -{ - cout << "TearDownTestCase" << endl; -} - -/* * - * @tc.setup:This is before test case - */ -void ActsMediaRecorderNDKTest::SetUp() -{ - cout << "SetUp" << endl; -} - -/* * - * @tc.setup:This is after test case - */ -void ActsMediaRecorderNDKTest::TearDown() -{ - sleep(1); - cout << "TearDown" << endl; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0100 - * @tc.name : Set Video Source 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSource01, Function | MediumTest | Level0) -{ - cout << "Test_SetVideoSource01 starting..." << endl; - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - cout << "Test_SetVideoSource01 ending..." << endl; - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0110 - * @tc.name : Set Video Source 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSource02, Function | MediumTest | Level0) -{ - cout << "Test_SetVideoSource01 starting..." << endl; - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_YUV, sourceId); - EXPECT_EQ(SUCCESS, ret); - cout << "Test_SetVideoSource01 ending..." << endl; - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0200 - * @tc.name : Set Video Source 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSource03, Function | MediumTest | Level0) -{ - cout << "Test_SetVideoSource03 starting..." << endl; - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_RGB, sourceId); - EXPECT_EQ(RET_OK, ret); - cout << "Test_SetVideoSource03 ending..." << endl; - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0300 - * @tc.name : Set Video Source 04 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSource04, Function | MediumTest | Level0) -{ - cout << "Test_SetVideoSource01 starting..." << endl; - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_BUTT, sourceId); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - cout << "Test_SetVideoSource01 ending..." << endl; - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0400 - * @tc.name : Set Video Source 05 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSource05, Function | MediumTest | Level0) -{ - cout << "Test_SetVideoSource01 starting..." << endl; - Recorder *recorder = new Recorder(); - for (int32_t i = 0; i < g_recoderSourceMaxCount; i++) { - int32_t temp = i; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, temp); - EXPECT_EQ(RET_OK, ret); - } - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, g_recoderSourceMaxCount); - EXPECT_EQ(ERR_NOFREE_CHANNEL, ret); - cout << "Test_SetVideoSource01 ending..." << endl; - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0500 - * @tc.name : Set Video Encoder 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncoder01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoEncoder(sourceId, HEVC); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0600 - * @tc.name : Set Video Encoder 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncoder02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 10000; - int32_t ret = recorder->SetVideoEncoder(sourceId, HEVC); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0700 - * @tc.name : Set Video Encoder 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncoder03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoEncoder(sourceId, VIDEO_DEFAULT); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0800 - * @tc.name : Set Video Encoder 04 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncoder04, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoEncoder(sourceId, H264); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_0900 - * @tc.name : Set Video Encoder 05 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncoder05, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_BUTT, sourceId); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - ret = recorder->SetVideoEncoder(sourceId, HEVC); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1000 - * @tc.name : Set Video Size 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSize01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t width = 1920; - int32_t height = 1080; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoSize(sourceId, width, height); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1100 - * @tc.name : Set Video Size 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSize02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t width = -1920; - int32_t height = -1080; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoSize(sourceId, width, height); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1200 - * @tc.name : Set Video Size 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSize03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 10000; - int32_t width = 1920; - int32_t height = 1080; - int32_t ret = recorder->SetVideoSize(sourceId, width, height); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1300 - * @tc.name : Set Video Size 04 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSize04, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t width = 1280; - int32_t height = 720; - int32_t ret = recorder->SetVideoSize(sourceId, width, height); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1400 - * @tc.name : Set Video Size 05 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoSize05, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t width = 0; - int32_t height = 0; - int32_t ret = recorder->SetVideoSize(sourceId, width, height); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1500 - * @tc.name : Set Video Frame Rate 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoFrameRate01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t frameRate = 30; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoFrameRate(sourceId, frameRate); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1600 - * @tc.name : Set Video Frame Rate 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoFrameRate02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t frameRate = -1; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoFrameRate(sourceId, frameRate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1700 - * @tc.name : Set Video Frame Rate 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoFrameRate03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 10000; - int32_t frameRate = 30; - int32_t ret = recorder->SetVideoFrameRate(sourceId, frameRate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1800 - * @tc.name : Set Video Encoding BitRate 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncodingBitRate01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t rate = 4096; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoEncodingBitRate(sourceId, rate); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_1900 - * @tc.name : Set Video Encoding BitRate 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncodingBitRate02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t rate = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetVideoEncodingBitRate(sourceId, rate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2000 - * @tc.name : Set Video Encoding BitRate 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetVideoEncodingBitRate03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 10000; - int32_t rate = 4096; - int32_t ret = recorder->SetVideoEncodingBitRate(sourceId, rate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2100 - * @tc.name : Set Capture Rate 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetCaptureRate01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - double fps = 30.0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetCaptureRate(sourceId, fps); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2200 - * @tc.name : Set Capture Rate 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetCaptureRate02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 10000; - double fps = 30.0; - int32_t ret = recorder->SetCaptureRate(sourceId, fps); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2300 - * @tc.name : Set Capture Rate 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetCaptureRate03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - double fps = -30.0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetCaptureRate(sourceId, fps); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2400 - * @tc.name : Set Audio Source 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioSource01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2500 - * @tc.name : Set Audio Source 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioSource02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_SOURCE_INVALID, audioSourceId); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2600 - * @tc.name : Set Audio Source 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioSource03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - for (int32_t i = 0; i < g_recoderSourceMaxCount; i++) { - int32_t tempSourceId = i; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, tempSourceId); - cout << i << endl; - EXPECT_EQ(RET_OK, ret); - } - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, g_recoderSourceMaxCount) ; - EXPECT_EQ(ERR_NOFREE_CHANNEL, ret) ; - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2700 - * @tc.name : Set Audio Encoder 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncoder(audioSourceId, AAC_LC); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2800 - * @tc.name : Set Audio Encoder 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncoder(audioSourceId, AUDIO_DEFAULT); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_2900 - * @tc.name : Set Audio Encoder 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 10000; - int32_t ret = recorder->SetAudioEncoder(audioSourceId, AAC_LC); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3000 - * @tc.name : Set Audio Encoder 04 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder04, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncoder(audioSourceId, AAC_HE_V1); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3100 - * @tc.name : Set Audio Encoder 05 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder05, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncoder(audioSourceId, AAC_HE_V2); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3200 - * @tc.name : Set Audio Encoder 06 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder06, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncoder(audioSourceId, AAC_LD); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3300 - * @tc.name : Set Audio Encoder 07 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncoder07, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncoder(audioSourceId, AAC_ELD); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3400 - * @tc.name : Set Audio Sample Rate 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioSampleRate01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t sampleRate = 48000; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3500 - * @tc.name : Set Audio Sample Rate 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioSamplingRate02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 10000; - int32_t sampleRate = 48000; - int32_t ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3600 - * @tc.name : Set Audio Sample Rate 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioSampleRate03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t sampleRate = -48000; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioSampleRate(audioSourceId, sampleRate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3700 - * @tc.name : Set Audio Channels 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioChannels01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t channelCount = 1; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioChannels(audioSourceId, channelCount); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3800 - * @tc.name : Set Audio Channels 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioChannels02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t channelCount = 2; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioChannels(audioSourceId, channelCount); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_3900 - * @tc.name : Set Audio Channels 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioChannels03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t channelCount = 0; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioChannels(audioSourceId, channelCount); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4000 - * @tc.name : Set Audio Channels 04 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioChannels04, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t channelCount = 1000; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioChannels(audioSourceId, channelCount); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4100 - * @tc.name : Set Audio Channels 05 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioChannels05, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 100000; - int32_t channelCount = 1; - int32_t ret = recorder->SetAudioChannels(audioSourceId, channelCount); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4200 - * @tc.name : Set Audio Encoding BitRate 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncodingBitRate01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t audioEncodingBitRate = 48000; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4300 - * @tc.name : Set Audio Encoding BitRate 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncodingBitRate02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 0; - int32_t audioEncodingBitRate = -48000; - int32_t ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4400 - * @tc.name : Set Audio Encoding BitRate 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetAudioEncodingBitRate03, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t audioSourceId = 10000; - int32_t audioEncodingBitRate = 48000; - int32_t ret = recorder->SetAudioEncodingBitRate(audioSourceId, audioEncodingBitRate); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4500 - * @tc.name : Test Recorder Prepare 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_Prepare01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t audioSourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->SetAudioSource(AUDIO_MIC, audioSourceId); - EXPECT_EQ(RET_OK, ret); - ret = recorder->Prepare(); - EXPECT_NE(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4600 - * @tc.name : Test Recorder GetSurface 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_GetSurface01, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 0; - int32_t ret = recorder->SetVideoSource(VIDEO_SOURCE_SURFACE_ES, sourceId); - EXPECT_EQ(RET_OK, ret); - Surface *surface = recorder->GetSurface(sourceId).get(); - ret = (int32_t)(surface == nullptr); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4700 - * @tc.name : Test Recorder GetSurface 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_GetSurface02, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t sourceId = 10000; - Surface *surface = recorder->GetSurface(sourceId).get(); - EXPECT_EQ(nullptr, surface); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4800 - * @tc.name : Test Recorder SetMaxDuration 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetMaxDuration, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetMaxDuration(1000); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_4900 - * @tc.name : Test Recorder SetMaxDuration 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetMaxDuration2, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetMaxDuration(0); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5000 - * @tc.name : Test Recorder SetMaxDuration 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetMaxDuration3, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetMaxDuration(-1); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5100 - * @tc.name : Test Recorder SetMaxDuration 04 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetMaxDuration4, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetMaxDuration(4294967295); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5200 - * @tc.name : Test Recorder SetMaxFileSize 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetMaxFileSize1, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetMaxFileSize(0); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5300 - * @tc.name : Test Recorder SetMaxFileSize 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetMaxFileSize2, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetMaxFileSize(2000); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5400 - * @tc.name : Test Recorder SetOutputFile 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetOutputFile1, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetOutputFile(-1); - EXPECT_EQ(-5, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5500 - * @tc.name : Test Recorder SetNextOutputFile 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetNextOutputFile1, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetNextOutputFile(-1); - EXPECT_EQ(-5, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5600 - * @tc.name : Test Recorder SetOutputPath 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetOutputPath1, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - const string path = ""; - int32_t ret = recorder->SetOutputPath(path); - EXPECT_EQ(ERR_INVALID_PARAM, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5700 - * @tc.name : Test Recorder SetOutputFormat 01 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetOutputFormat1, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetOutputFormat(FORMAT_DEFAULT); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5800 - * @tc.name : Test Recorder SetOutputFormat 02 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetOutputFormat2, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetOutputFormat(FORMAT_MPEG_4); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} - -/* * - * @tc.number : SUB_MEDIA_REC_PARAM_5900 - * @tc.name : Test Recorder SetOutputFormat 03 - * @tc.desc : [C- SOFTWARE -0200] - */ -HWTEST_F(ActsMediaRecorderNDKTest, Test_SetOutputFormat3, Function | MediumTest | Level0) -{ - Recorder *recorder = new Recorder(); - int32_t ret = recorder->SetOutputFormat(FORMAT_TS); - EXPECT_EQ(RET_OK, ret); - delete recorder; - recorder = NULL; -} \ No newline at end of file -- GitLab