From af426bfb1f5b97015fea20a82d1978419b15b812 Mon Sep 17 00:00:00 2001 From: Gilbok Lee Date: Tue, 11 Feb 2025 16:58:16 +0900 Subject: [PATCH] [1.0.3] Add input file path as the player_test argument - ut: remove unnecessary logs Change-Id: I4e17ebaec42f4eb9835c4bae5119fd25f7a25026 --- test/player_test.c | 46 ++++++++++++++++++++++++++------- unittest/src/playerTCWindow.cpp | 1 - unittest/src/ut_contents.cpp | 12 +++------ unittest/src/ut_features.cpp | 2 -- unittest/src/ut_main.cpp | 3 +++ 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/test/player_test.c b/test/player_test.c index 83b32c7..dc3e4ac 100644 --- a/test/player_test.c +++ b/test/player_test.c @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef _ACTIVATE_EOM_ #include #endif @@ -669,7 +670,7 @@ static void audio_frame_decoded_cb(unsigned char *data, unsigned int size, void static void subtitle_updated_cb(unsigned long duration, char *text, void *user_data) { - g_print("[Player_Test] subtitle_updated_cb!!!! [%ld] %s\n", duration, text); + printf("[Player_Test] subtitle_updated_cb!!!! [%ld] %s\n", duration, text); } static void video_captured_cb(unsigned char *data, int width, int height, unsigned int size, void *user_data) @@ -2371,12 +2372,6 @@ void quit_program() media_format_unref(g_video_fmt); } -void play_with_ini(char *file_path) -{ - input_filename(file_path); - _player_play(); -} - void _interpret_main_menu(char *cmd) { int len = strlen(cmd); @@ -2523,6 +2518,16 @@ void _interpret_main_menu(char *cmd) g_menu_state = CURRENT_STATUS_PITCH_CONTROL; } else if (strncmp(cmd, "pv", 2) == 0) { g_menu_state = CURRENT_STATUS_PITCH_VALUE; + } else if (strncmp(cmd, "qc", 2) == 0) { + int len = strlen(g_uri); + if (len < 0 || len > MAX_STRING_LEN - 1) { + g_print("qc use -u option\n"); + return; + } + input_filename(g_uri); + len = strlen(g_subtitle_uri); + if (len > 0) + input_subtitle_filename(g_subtitle_uri); } else { g_print("unknown menu \n"); } @@ -3148,13 +3153,36 @@ gboolean input(GIOChannel *channel) int main(int argc, char *argv[]) { - GIOChannel *stdin_channel; - stdin_channel = g_io_channel_unix_new(0); + GIOChannel *stdin_channel = g_io_channel_unix_new(0); g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL); g_io_add_watch(stdin_channel, G_IO_IN, (GIOFunc)input, NULL); displaymenu(); memset(&ad, 0x0, sizeof(appdata)); + while (1) { + int opt; + int opt_idx = 0; + + static struct option long_options[] = { + { "uri", no_argument, 0, 'u' }, + { "sub_uri", no_argument, 0, 's'}, + { 0, 0, 0, 0 } + }; + + if ((opt = getopt_long(argc, argv, "u:s:h", long_options, &opt_idx)) == -1) + break; + + switch (opt) { + case 'u': + g_strlcpy(g_uri, optarg, MAX_STRING_LEN); + break; + case 's': + g_strlcpy(g_subtitle_uri, optarg, MAX_STRING_LEN); + break; + default: + return 0; + } + } ops.data = &ad; return appcore_efl_main(PACKAGE, &argc, &argv, &ops); diff --git a/unittest/src/playerTCWindow.cpp b/unittest/src/playerTCWindow.cpp index ddadef4..418fb4c 100644 --- a/unittest/src/playerTCWindow.cpp +++ b/unittest/src/playerTCWindow.cpp @@ -77,7 +77,6 @@ void PlayerTCWindow::createWindow_() { evas_object_show(_evasObjectWin); ecore_thread_main_loop_end(); - std::cout << "Window [" << _evasObjectWin << "]" << std::endl; } diff --git a/unittest/src/ut_contents.cpp b/unittest/src/ut_contents.cpp index a696fec..1eb67cf 100644 --- a/unittest/src/ut_contents.cpp +++ b/unittest/src/ut_contents.cpp @@ -35,13 +35,11 @@ public: virtual void SetUp() override { ASSERT_EQ(player_create(&_player), PLAYER_ERROR_NONE); - std::cout << "SetUp()" << std::endl; } virtual void TearDown() override { ASSERT_EQ(player_destroy(_player), PLAYER_ERROR_NONE); - std::cout << "TearDown()" << std::endl; } @@ -90,12 +88,12 @@ TEST_P(PlayerContentsTest, player_contents_test_p) { EXPECT_EQ(player_get_codec_info(_player, &audio_codec, &video_codec), PLAYER_ERROR_NONE); std::string audioCodecName = audio_codec; - EXPECT_NE(audioCodecName.find(_tcInfos.audio.codecName), std::string::npos); + EXPECT_STREQ(audio_codec, _tcInfos.audio.codecName.c_str()); if (audio_codec) free(audio_codec); std::string videoCodecName = video_codec; - EXPECT_NE(videoCodecName.find(_tcInfos.video.codecName), std::string::npos); + EXPECT_STREQ(video_codec, _tcInfos.video.codecName.c_str()); if (video_codec) free(video_codec); @@ -145,13 +143,11 @@ TEST_P(PlayerContentsTest, DISABLED_human_verify_player_contents_test_p) { EXPECT_EQ(h, _tcInfos.video.height); EXPECT_EQ(player_get_codec_info(_player, &audio_codec, &video_codec), PLAYER_ERROR_NONE); - std::string audioCodecName = audio_codec; - EXPECT_NE(audioCodecName.find(_tcInfos.audio.codecName), std::string::npos); + EXPECT_STREQ(audio_codec, _tcInfos.audio.codecName.c_str()); if (audio_codec) free(audio_codec); - std::string videoCodecName = video_codec; - EXPECT_NE(videoCodecName.find(_tcInfos.video.codecName), std::string::npos); + EXPECT_STREQ(video_codec, _tcInfos.video.codecName.c_str()); if (video_codec) free(video_codec); diff --git a/unittest/src/ut_features.cpp b/unittest/src/ut_features.cpp index 9cadabe..a314b8c 100644 --- a/unittest/src/ut_features.cpp +++ b/unittest/src/ut_features.cpp @@ -35,13 +35,11 @@ public: virtual void SetUp() override { ASSERT_EQ(player_create(&_player), PLAYER_ERROR_NONE); - std::cout << "SetUp()" << std::endl; } virtual void TearDown() override { ASSERT_EQ(player_destroy(_player), PLAYER_ERROR_NONE); - std::cout << "TearDown()" << std::endl; } diff --git a/unittest/src/ut_main.cpp b/unittest/src/ut_main.cpp index 8695359..66fb9ac 100644 --- a/unittest/src/ut_main.cpp +++ b/unittest/src/ut_main.cpp @@ -18,6 +18,9 @@ int main(int argc, char *argv[]) { +#ifndef __DEBUG__ + std::cout.rdbuf(nullptr); +#endif try { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); -- 2.34.1