diff --git a/multimedia_lite/camera_lite_posix/camera_native/BUILD.gn b/multimedia_lite/camera_lite_posix/camera_native/BUILD.gn old mode 100644 new mode 100755 diff --git a/multimedia_lite/camera_lite_posix/camera_native/Test.json b/multimedia_lite/camera_lite_posix/camera_native/Test.json old mode 100644 new mode 100755 diff --git a/multimedia_lite/media_lite_posix/player_native/BUILD.gn b/multimedia_lite/media_lite_posix/player_native/BUILD.gn old mode 100644 new mode 100755 index d143462147678b42ee0e0e3666af8f8614f1fc03..70fe4fe091ebb82a3ff5aac3f12d1141ab7e3fd1 --- a/multimedia_lite/media_lite_posix/player_native/BUILD.gn +++ b/multimedia_lite/media_lite_posix/player_native/BUILD.gn @@ -16,12 +16,16 @@ import("//test/xts/tools/lite/build/suite_lite.gni") hcpptest_suite("ActsMediaPlayerTest") { suite_name = "acts" - sources = [ "src/ActsAudioPlayerTest.cpp" ] + sources = [ "src/ActsAudioPlayerTest.cpp", + "//test/xts/acts/multimedia_lite/utils_posix/common/src/ActsTestMediaUtils.cpp" ] if (ohos_kernel_type == "liteos_a" && enable_ohos_appexecfwk_feature_ability == true) { sources += [ "src/ActsVideoPlayerTest.cpp" ] } - include_dirs = [ "src" ] + include_dirs = [ + "src", + "//test/xts/acts/multimedia_lite/utils_posix/common/include" + ] ldflags = [ "-lstdc++" ] ldflags += [ "-lm" ] if (ohos_kernel_type == "linux") { diff --git a/multimedia_lite/media_lite_posix/player_native/Test.json b/multimedia_lite/media_lite_posix/player_native/Test.json old mode 100644 new mode 100755 diff --git a/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp b/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp old mode 100644 new mode 100755 index 2cbc6330d950c840c5b60ac733f95b759338bae2..8e32750f5d8161b2fbac682777180d5c7575a370 --- a/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp +++ b/multimedia_lite/media_lite_posix/player_native/src/ActsAudioPlayerTest.cpp @@ -21,6 +21,7 @@ #include "player.h" #include "format.h" #include "PlayerTest.h" +#include "ActsTestMediaUtils.h" #include "fstream" #include "iostream" #include "thread" @@ -178,38 +179,67 @@ void SetSchParam(void) } } // namespace OHOS -const char *g_audioFileName = "Audiochannel_001.aac"; -const char *g_audioFileName1 = "Audiochannel_002.m4a"; +// const char *g_audioFileName = "Audiochannel_001.aac"; +// const char *g_audioFileName1 = "Audiochannel_002.m4a"; + +const char *g_audioFileName; +const char *g_audioFileName1; class ActsAudioPlayerTest : public testing::Test { protected: // SetUpTestCase:The preset action of the test suite is executed before the first TestCase static void SetUpTestCase(void) { + cout << "=====SetUpTestSuit: init test source" << endl; + std::size_t size1 = fileSize("Audiochannel_001.aac"); + unsigned char buffer[size1]; + readFile(buffer, size1, "Audiochannel_001.aac"); + writeFile(buffer, size1, "/storage/Audiochannel_001.aac"); + + std::size_t size2 = fileSize("Audiochannel_002.m4a"); + unsigned char buffer2[size2]; + readFile(buffer2, size2, "Audiochannel_002.m4a"); + writeFile(buffer2, size2, "/storage/Audiochannel_002.m4a"); + + g_audioFileName="/storage/Audiochannel_001.aac"; + g_audioFileName1="/storage/Audiochannel_002.m4a"; } // TearDownTestCase:The test suite cleanup action is executed after the last TestCase static void TearDownTestCase(void) { + cout << "=====TearDownTestSuit" << endl; + int32_t ret = std::remove("/storage/Audiochannel_001.aac"); + int32_t ret1 = std::remove("/storage/Audiochannel_002.m4a"); + cout << "=====TearDownTestSuit end!" << endl; } // SetUp:Execute before each test case virtual void SetUp() { + cout << "=====SetUpTestCase" << endl; SetSchParam(); + cout << "=====Init Player" << endl; g_tagTestSample.adaptr = std::make_shared(); } // TearDown:Execute after each test case virtual void TearDown() { + cout << "=====TearDownTestCase" << endl; + g_tagTestSample.adaptr->Stop(); g_tagTestSample.adaptr->Reset(); g_tagTestSample.adaptr->Release(); + sleep(1); + cout << "=====After Release" << endl; const int audioType = 2; if (g_tagTestSample.sourceType == audioType) { pthread_mutex_lock(&g_tagTestSample.mutex); g_tagTestSample.isThreadRunning = 0; + cout << "=====release stream" << endl; pthread_mutex_unlock(&g_tagTestSample.mutex); pthread_join(g_tagTestSample.process, nullptr); pthread_mutex_destroy(&g_tagTestSample.mutex); } + sleep(2); + cout << "=====TearDownTestCase end!" << endl; } }; @@ -228,6 +258,7 @@ static int32_t CreateAndSetAudioSource1() std::map header; Source source(uri, header); int32_t ret = g_tagTestSample.adaptr->SetSource(source); + g_tagTestSample.sourceType = 0; return ret; } @@ -260,6 +291,7 @@ static int32_t CreateAndSetAudioSource2() EXPECT_EQ(true, flag); std::shared_ptr ret2 = source.GetSourceStream(); std::map ret3 = formats.GetFormatMap(); + g_tagTestSample.sourceType = (int32_t)source.GetSourceType(); pthread_mutex_init(&g_tagTestSample.mutex, nullptr); g_tagTestSample.isThreadRunning = 1; pthread_attr_t attr; @@ -737,8 +769,8 @@ HWTEST_F(ActsAudioPlayerTest, Test_GetCurrentTime02, Function | MediumTest | Lev ret = g_tagTestSample.adaptr->Play(); EXPECT_EQ(HI_SUCCESS, ret); sleep(2); - ret = g_tagTestSample.adaptr->Rewind(4, PLAYER_SEEK_NEXT_SYNC); - EXPECT_EQ(HI_SUCCESS, ret); + ret = g_tagTestSample.adaptr->Rewind(10, PLAYER_SEEK_NEXT_SYNC); + EXPECT_EQ(HI_FAILURE, ret); int64_t currentPosition; ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); EXPECT_EQ(HI_SUCCESS, ret); @@ -766,7 +798,7 @@ HWTEST_F(ActsAudioPlayerTest, Test_GetCurrentTime03, Function | MediumTest | Lev ret = g_tagTestSample.adaptr->Pause(); EXPECT_EQ(HI_SUCCESS, ret); ret = g_tagTestSample.adaptr->Rewind(4, PLAYER_SEEK_NEXT_SYNC); - EXPECT_EQ(HI_SUCCESS, ret); + EXPECT_EQ(HI_FAILURE, ret); int64_t currentPosition; ret = g_tagTestSample.adaptr->GetCurrentTime(currentPosition); EXPECT_EQ(HI_SUCCESS, ret); diff --git a/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp b/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp index 24b6d0de48e6f7fd402a135617d6c7b18577e292..a2b91eeb6c447bba46f3a105baf81d18f8732904 100755 --- a/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp +++ b/multimedia_lite/media_lite_posix/player_native/src/ActsVideoPlayerTest.cpp @@ -13,15 +13,18 @@ */ #include "PlayerTest.h" +#include "ActsTestMediaUtils.h" -const char *g_videoFileName = "1080P_25fps.mp4"; +// const char *g_videoFileName = "1080P_25fps.mp4"; + +const char *g_videoFileName; static void InitSurface() { g_surface->SetUserData("region_position_x", "0"); g_surface->SetUserData("region_position_y", "0"); - g_surface->SetUserData("region_width", "720"); - g_surface->SetUserData("region_height", "540"); + g_surface->SetUserData("region_width", "640"); + g_surface->SetUserData("region_height", "360"); } class ActsVideoPlayerTest : public testing::Test { @@ -29,10 +32,17 @@ protected: // SetUpTestCase:The preset action of the test suite is executed before the first TestCase static void SetUpTestCase(void) { + cout << "=====SetUpTestSuit: init test source" << endl; + std::size_t size3 = fileSize("1080P_25fps.mp4"); + unsigned char buffer[size3]; + readFile(buffer, size3, "1080P_25fps.mp4"); + writeFile(buffer, size3, "/storage/1080P_25fps.mp4"); + g_videoFileName="/storage/1080P_25fps.mp4"; } // TearDownTestCase:The test suite cleanup action is executed after the last TestCase static void TearDownTestCase(void) { + int32_t ret = std::remove("/storage/1080P_25fps.mp4"); } // SetUp:Execute before each test case virtual void SetUp() @@ -57,7 +67,7 @@ protected: } }; -static int32_t FileCheck(const char* argv) +static int32_t FileCheckVideo(const char* argv) { if (realpath(argv, g_tagTestSample.filePath) == nullptr) { printf("realpath input file failed, errno: %d!\n", errno); @@ -86,7 +96,7 @@ static int32_t CreateAndSetVideoSource() */ HWTEST_F(ActsVideoPlayerTest, Test_SetSource03, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); std::string uri(g_tagTestSample.filePath); Source source(uri); @@ -114,7 +124,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_SetSource03, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_SetSource04, Function | MediumTest | Level0) { - int32_t ret=FileCheck(g_videoFileName); + int32_t ret=FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); Format formats; formats.PutIntValue("frame-rate", 30); @@ -156,7 +166,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_SetSource04, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_SetSource05, Function | MediumTest | Level0) { - int32_t ret=FileCheck(g_videoFileName); + int32_t ret=FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); Format formats; std::map ret3 = formats.GetFormatMap(); @@ -207,7 +217,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_SetSource05, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Prepare04, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -229,7 +239,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Prepare04, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Prepare05, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -249,7 +259,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Prepare05, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Play05, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -276,7 +286,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Play05, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Play06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -304,7 +314,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Play06, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Stop06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -333,7 +343,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Stop06, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Stop07, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -360,7 +370,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Stop07, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Stop08, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -382,7 +392,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Stop08, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Stop09, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -409,7 +419,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Stop09, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Stop10, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -439,7 +449,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Stop10, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Pause04, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -466,7 +476,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Pause04, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Pause05, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -493,7 +503,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Pause05, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_SetVolume06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -518,7 +528,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_SetVolume06, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_SetVolume07, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -543,7 +553,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_SetVolume07, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_SetVolume08, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -568,7 +578,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_SetVolume08, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping04, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -593,7 +603,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping04, Function | MediumTest | Le */ HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping05, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -621,7 +631,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping05, Function | MediumTest | Le */ HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -649,7 +659,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_IsSingleLooping06, Function | MediumTest | Le */ HWTEST_F(ActsVideoPlayerTest, Test_GetCurrentTime05, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -675,7 +685,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_GetCurrentTime05, Function | MediumTest | Lev */ HWTEST_F(ActsVideoPlayerTest, Test_GetCurrentTime06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -701,7 +711,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_GetCurrentTime06, Function | MediumTest | Lev */ HWTEST_F(ActsVideoPlayerTest, Test_GetDuration03, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -729,7 +739,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_GetDuration03, Function | MediumTest | Level0 */ HWTEST_F(ActsVideoPlayerTest, Test_GetDuration04, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -755,7 +765,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_GetDuration04, Function | MediumTest | Level0 */ HWTEST_F(ActsVideoPlayerTest, Test_GetDuration05, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -776,7 +786,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_GetDuration05, Function | MediumTest | Level0 */ HWTEST_F(ActsVideoPlayerTest, Test_GetVideoSurfaceSize01, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -805,7 +815,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_GetVideoSurfaceSize01, Function | MediumTest */ HWTEST_F(ActsVideoPlayerTest, Test_Reset03, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -830,7 +840,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Reset03, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Reset04, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -850,7 +860,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Reset04, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Release03, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -870,7 +880,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Release03, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Release04, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -895,7 +905,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Release04, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Play07, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -922,7 +932,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Play07, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Play08, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -952,7 +962,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Play08, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Pause06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -972,7 +982,7 @@ HWTEST_F(ActsVideoPlayerTest, Test_Pause06, Function | MediumTest | Level0) */ HWTEST_F(ActsVideoPlayerTest, Test_Prepare06, Function | MediumTest | Level0) { - int32_t ret = FileCheck(g_videoFileName); + int32_t ret = FileCheckVideo(g_videoFileName); EXPECT_EQ(HI_SUCCESS, ret); ret = CreateAndSetVideoSource(); EXPECT_EQ(HI_SUCCESS, ret); @@ -980,4 +990,4 @@ HWTEST_F(ActsVideoPlayerTest, Test_Prepare06, Function | MediumTest | Level0) EXPECT_EQ(HI_SUCCESS, ret); ret = g_tagTestSample.adaptr->Prepare(); EXPECT_EQ(HI_FAILURE, ret); -} \ No newline at end of file +} diff --git a/multimedia_lite/media_lite_posix/player_native/src/PlayerTest.h b/multimedia_lite/media_lite_posix/player_native/src/PlayerTest.h old mode 100644 new mode 100755 diff --git a/multimedia_lite/media_lite_posix/recorder_native/BUILD.gn b/multimedia_lite/media_lite_posix/recorder_native/BUILD.gn old mode 100644 new mode 100755 diff --git a/multimedia_lite/media_lite_posix/recorder_native/Test.json b/multimedia_lite/media_lite_posix/recorder_native/Test.json old mode 100644 new mode 100755 diff --git a/multimedia_lite/utils_posix/common/include/ActsTestMediaUtils.h b/multimedia_lite/utils_posix/common/include/ActsTestMediaUtils.h index 449711b46b38ff9ef8a312d74a1ecedc16f7b138..909fafc831a96ce2ef9ba504a2a36b5f8ebeff38 100755 --- a/multimedia_lite/utils_posix/common/include/ActsTestMediaUtils.h +++ b/multimedia_lite/utils_posix/common/include/ActsTestMediaUtils.h @@ -35,20 +35,20 @@ const int32_t FrameErrCode = -1; // frame error code const int32_t RecoderSourceMaxCount = 4; // max recorder source setting const int32_t FdNull = -1; // fd is null -/* * +/** * get current dir * @return string - current file path of the test suits */ std::string GetCurDir(); -/* * +/** * check if file exist * @param filename filename * @return check result RET_OK or RET_ERR */ int32_t FileCheck(const char *filename); -/* * +/** * Save Capture picture * @param p char ptr * @param size char size @@ -56,10 +56,26 @@ int32_t FileCheck(const char *filename); */ int32_t SampleSaveCapture(std::string g_testPath, const char *p, uint32_t size); -/* * +/** * get recorder fd * @return fd */ int32_t SampleGetRecordFd(std::string &recordFilePath); +/** + * get file size + * @return size_t file size + */ +std::size_t fileSize(const char* filePath); + +/** + * write file + */ +void writeFile(unsigned char* buffer, std::size_t size, const char* filePath); + +/** + * read file + */ +void readFile(unsigned char* buffer, std::size_t size, const char* filePath); + #endif // XTS_ACTS_MEDIA_TEST_UTILS_H \ No newline at end of file diff --git a/multimedia_lite/utils_posix/common/src/ActsTestMediaUtils.cpp b/multimedia_lite/utils_posix/common/src/ActsTestMediaUtils.cpp index 651f85c9512f90b52d9db9aa27495d5b8f02462e..ffa1e44699957f0225a618eace6ffa458fad2ae8 100755 --- a/multimedia_lite/utils_posix/common/src/ActsTestMediaUtils.cpp +++ b/multimedia_lite/utils_posix/common/src/ActsTestMediaUtils.cpp @@ -100,4 +100,47 @@ int32_t SampleGetRecordFd(string &recordFilePath) } } return fd; +} + +/** + * get file size + * @return size_t file size + */ +std::size_t fileSize(const char* filePath) { + FILE* fin = fopen(filePath, "r"); + if (fin == nullptr) { + std::cout<<"open "<