[1.0.3] Add input file path as the player_test argument 50/319450/5 accepted/tizen/unified/20250220.093342 accepted/tizen/unified/x/20250221.100947
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 11 Feb 2025 07:58:16 +0000 (16:58 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Wed, 19 Feb 2025 06:41:45 +0000 (15:41 +0900)
- ut: remove unnecessary logs

Change-Id: I4e17ebaec42f4eb9835c4bae5119fd25f7a25026

test/player_test.c
unittest/src/playerTCWindow.cpp
unittest/src/ut_contents.cpp
unittest/src/ut_features.cpp
unittest/src/ut_main.cpp

index 83b32c77f401b2bef54e809d33cc002ea13a3a6a..dc3e4ac9650b0e4cc4d89f444f2211cfbecbb7f5 100644 (file)
@@ -28,6 +28,7 @@
 #include <Ecore_Evas.h>
 #include <stdio.h>
 #include <string.h>
+#include <getopt.h>
 #ifdef _ACTIVATE_EOM_
 #include <eom.h>
 #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);
index ddadef437c829a2d52fcc8a5c953aa61c6b9cca7..418fb4c2e2535909a51d40f7cdaf76acb849271d 100644 (file)
@@ -77,7 +77,6 @@ void PlayerTCWindow::createWindow_() {
        evas_object_show(_evasObjectWin);
 
        ecore_thread_main_loop_end();
-
        std::cout << "Window [" << _evasObjectWin << "]" << std::endl;
 }
 
index a696fec47144c6578f0bc54e96d1e7c849da5298..1eb67cf791017213ff491ed42dc89dc7c02c5f02 100644 (file)
@@ -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);
 
index 9cadabe418106807fa650506bd63f75630ccc478..a314b8c4dc3c8e527c0aa10e4e37070d6034e17c 100644 (file)
@@ -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;
        }
 
index 8695359b651996fc17f5939e5197d2d31cab11ef..66fb9ac59084f5bb4f109f3e9c2ffb6ed967209c 100644 (file)
@@ -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();