improve testsuite 85/228785/4
authorsangho park <sangho.g.park@samsung.com>
Wed, 25 Mar 2020 11:26:08 +0000 (20:26 +0900)
committersangho park <sangho.g.park@samsung.com>
Thu, 26 Mar 2020 08:36:20 +0000 (17:36 +0900)
- apply ncurses
- add auto-test mode

Change-Id: I52988612e1a9bc4326df372f4a17cb25fc63911f
Signed-off-by: sangho park <sangho.g.park@samsung.com>
packaging/capi-media-vision.spec
test/testsuites/barcode/CMakeLists.txt
test/testsuites/barcode/barcode_test_suite.c
test/testsuites/barcode/mv_barcode_test_suite_auto [new file with mode: 0755]

index aafbc29c5379b1c83e1a511d5a014ca72e55da66..7d24991abb50cee488238d5af13e7b8ac72a0212 100644 (file)
@@ -1,7 +1,7 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
 Version:     0.5.1
-Release:     2
+Release:     3
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause
 Source0:     %{name}-%{version}.tar.gz
@@ -28,6 +28,7 @@ BuildRequires: pkgconfig(gstreamer-app-1.0)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(inference-engine-interface-vision)
 BuildRequires: pkgconfig(iniparser)
+BuildRequires: pkgconfig(ncurses)
 
 %description
 Media Vision library for Tizen Native API. Includes barcode detecting, barcode generating, face and image modules.
index 5845c579869a46fdbf056f5ef0a3a04952b9e6d0..12abcb2f478c641979bcb2fac3a9df6f294105b5 100644 (file)
@@ -1,7 +1,9 @@
-project(mv_barcode_test_suite)
 cmake_minimum_required(VERSION 2.6)
+SET(fw_name "mv_barcode_test_suite")
 
-set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG    _DEBUG)
+PROJECT(${fw_name})
+
+set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG _DEBUG)
 
 if(NOT SKIP_WARNINGS)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
@@ -11,18 +13,28 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LIB_INSTALL_DIR})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
 
-include_directories(${PROJECT_SOURCE_DIR})
-include_directories(${MV_CAPI_MEDIA_VISION_INC_DIR})
-include_directories(${INC_IMAGE_HELPER})
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
+INCLUDE_DIRECTORIES(${MV_CAPI_MEDIA_VISION_INC_DIR})
+INCLUDE_DIRECTORIES(${INC_IMAGE_HELPER})
+
+SET(DEPENDENTS "ncurses")
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(${fw_name} REQUIRED ${DEPENDENTS})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+    SET(EXTRA_CXXFLAGS "${EXTRA_CXXFLAGS} ${flag}")
+ENDFOREACH(flag)
+
 
-file(GLOB MV_TEST_SUITE_INC_LIST "${PROJECT_SOURCE_DIR}/*.h")
-file(GLOB MV_TEST_SUITE_SRC_LIST "${PROJECT_SOURCE_DIR}/*.c")
+FILE(GLOB MV_TEST_SUITE_INC_LIST "${PROJECT_SOURCE_DIR}/*.h")
+FILE(GLOB MV_TEST_SUITE_SRC_LIST "${PROJECT_SOURCE_DIR}/*.c")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
 
-add_executable(${PROJECT_NAME} ${MV_TEST_SUITE_SRC_LIST} ${MV_TEST_SUITE_INC_LIST} ${MV_CAPI_MEDIA_VISION_INC_LIST})
+ADD_EXECUTABLE(${PROJECT_NAME} ${MV_TEST_SUITE_SRC_LIST} ${MV_TEST_SUITE_INC_LIST} ${MV_CAPI_MEDIA_VISION_INC_LIST})
 
-target_link_libraries(${PROJECT_NAME} ${MV_BARCODE_DETECTOR_LIB_NAME}
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${MV_BARCODE_DETECTOR_LIB_NAME}
+                                      ${${fw_name}_LDFLAGS}
                                       ${MV_BARCODE_GENERATOR_LIB_NAME}
                                       capi-system-info
                                       dlog
@@ -32,4 +44,5 @@ target_link_libraries(${PROJECT_NAME} ${MV_BARCODE_DETECTOR_LIB_NAME}
                                       swscale
                                       mv_image_helper)
 
-install(TARGETS ${PROJECT_NAME} DESTINATION ${testbin_dir})
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${testbin_dir})
+INSTALL(FILES mv_barcode_test_suite_auto PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${testbin_dir})
index 0bfb93cc9f36374f426a17bd47da57e7cf6de272..3999427e7b256593fe6dedfa640937041990de7f 100644 (file)
 #include <libavcodec/avcodec.h>
 #include <libavutil/pixfmt.h>
 
+#include <curses.h>
+
+#define MINX 0
+#define MINY 0
+#define MANUAL 0
+#define AUTO 1
+#define SLEEP_INTERVAL 1
+
 typedef struct {
        mv_barcode_type_e type;
        mv_barcode_qr_ecc_e ecc;
@@ -51,6 +59,9 @@ typedef enum {
        MV_TS_GENERATE_TO_SOURCE_FCN
 } generation_fcn_e;
 
+static int current_y = MINY;
+static int mode = MANUAL;
+
 int convert_rgb_to(unsigned char *src_buffer, unsigned char **dst_buffer,
                image_data_s image_data, mv_colorspace_e dst_colorspace,
                unsigned long *cvt_buffer_size)
@@ -219,7 +230,7 @@ int find_max_y(const mv_quadrangle_s *quadrangle, int *maxY)
 bool _mv_engine_config_supported_attribute(mv_config_attribute_type_e attribute_type,
                const char *attribute_name, void *user_data)
 {
-       printf("Callback call for engine configuration attribute\n");
+       mvprintw(current_y++, MINX, "Callback call for engine configuration attribute");
 
        if (user_data == NULL)
                return false;
@@ -235,44 +246,44 @@ bool _mv_engine_config_supported_attribute(mv_config_attribute_type_e attribute_
                if (MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE ==
                        mv_engine_config_get_double_attribute(
                                                mv_engine_config, attribute_name, &double_value)) {
-                       printf("Default double attribute %s wasn't set in engine\n",
+                       mvprintw(current_y++, MINX, "Default double attribute %s wasn't set in engine",
                                        attribute_name);
                        return false;
                }
-               printf("Default double attribute %s was set to %f in engine\n",
+               mvprintw(current_y++, MINX, "Default double attribute %s was set to %f in engine",
                                        attribute_name, double_value);
                break;
        case MV_ENGINE_CONFIG_ATTR_TYPE_INTEGER:
                if (MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE ==
                        mv_engine_config_get_int_attribute(
                                                mv_engine_config, attribute_name, &int_value)) {
-                       printf("Default integer attribute %s wasn't set in engine\n",
+                       mvprintw(current_y++, MINX, "Default integer attribute %s wasn't set in engine",
                                        attribute_name);
                        return false;
                }
-               printf("Default interget attribute %s was set to %d in engine\n",
+               mvprintw(current_y++, MINX, "Default interget attribute %s was set to %d in engine",
                                attribute_name, int_value);
                break;
        case MV_ENGINE_CONFIG_ATTR_TYPE_BOOLEAN:
                if (MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE ==
                        mv_engine_config_get_bool_attribute(
                                                mv_engine_config, attribute_name, &bool_value)) {
-                       printf("Default bool attribute %s wasn't set in engine\n",
+                       mvprintw(current_y++, MINX, "Default bool attribute %s wasn't set in engine",
                                        attribute_name);
                        return false;
                }
-               printf("Default bool attribute %s was set to %s in engine\n",
+               mvprintw(current_y++, MINX, "Default bool attribute %s was set to %s in engine",
                                        attribute_name,  bool_value ? "TRUE" : "FALSE");
                break;
        case MV_ENGINE_CONFIG_ATTR_TYPE_STRING:
                if (MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE ==
                        mv_engine_config_get_string_attribute(
                                                mv_engine_config, attribute_name, &str_value)) {
-                       printf("Default string ttribute %s wasn't set in engine\n",
+                       mvprintw(current_y++, MINX, "Default string ttribute %s wasn't set in engine",
                                        attribute_name);
                        return false;
                }
-               printf("Default string attribute %s was set to %s in engine\n",
+               mvprintw(current_y++, MINX, "Default string attribute %s was set to %s in engine",
                                attribute_name, str_value);
                if (str_value != NULL) {
                        free(str_value);
@@ -280,7 +291,7 @@ bool _mv_engine_config_supported_attribute(mv_config_attribute_type_e attribute_
                }
                break;
        default:
-               printf("Not supported attribute type\n");
+               mvprintw(current_y++, MINX, "Not supported attribute type");
                return false;
        }
 
@@ -298,7 +309,7 @@ void barcode_detected_cb(
 {
        MEDIA_VISION_FUNCTION_ENTER();
 
-       printf("%i barcodes were detected on the image.\n", number_of_barcodes);
+       mvprintw(current_y++, MINX, "%i barcodes were detected on the image.", number_of_barcodes);
        if (number_of_barcodes > 0) {
                int is_source_data_loaded = 0;
 
@@ -313,7 +324,7 @@ void barcode_detected_cb(
                        MEDIA_VISION_ERROR_NONE != mv_source_get_height(source, &(image_data.image_height)) ||
                        MEDIA_VISION_ERROR_NONE != mv_source_get_colorspace(source, &(image_data.image_colorspace)) ||
                        user_data == NULL) {
-                       printf("ERROR: Creating out image is impossible.\n");
+                       mvprintw(current_y++, MINX, "ERROR : Creating out image is impossible.");
                } else {
                        file_name = ((barcode_model_s *)user_data)->out_file_name;
                        draw_buffer = ((barcode_model_s *)user_data)->out_buffer_ptr;
@@ -353,11 +364,11 @@ void barcode_detected_cb(
                                str_type = "Undetected";
                                break;
                        }
-                       printf("\tBarcode %i : type is %s\n", i, str_type);
+                       mvprintw(current_y++, MINX, "\tBarcode %i : type is %s", i, str_type);
                        if (cur_message != NULL)
-                               printf("\t            message is %s\n", cur_message);
+                               mvprintw(current_y++, MINX, "\t            message is %s", cur_message);
                        else
-                               printf("\t            message wasn't detected\n");
+                               mvprintw(current_y++, MINX, "\t            message wasn't detected");
 
                        if (is_source_data_loaded == 1) {
                                int minX = 0;
@@ -388,11 +399,11 @@ void barcode_detected_cb(
 
                if (file_name != NULL &&
                        MEDIA_VISION_ERROR_NONE == save_image_from_buffer(file_name, draw_buffer, &image_data, 100))
-                       printf("Image was generated as %s\n", file_name);
+                       mvprintw(current_y++, MINX, "Image was generated as %s", file_name);
                else
-                       printf("ERROR: Failed to generate output file. Check file name and permissions. \n");
+                       mvprintw(current_y++, MINX, "ERROR : Failed to generate output file. Check file name and permissions.");
 
-               printf("\n");
+               current_y++;
        }
 
        MEDIA_VISION_FUNCTION_LEAVE();
@@ -415,8 +426,8 @@ int generate_barcode_to_image(barcode_model_s model)
        int err = mv_create_engine_config(&mv_engine_config);
 
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occurred during creating the media engine "
-                               "config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during creating the media engine "
+                               "config : %i", err);
                MEDIA_VISION_FUNCTION_LEAVE();
 
                return err;
@@ -426,8 +437,8 @@ int generate_barcode_to_image(barcode_model_s model)
                                                                                        MV_BARCODE_GENERATE_ATTR_TEXT,
                                                                                        model.is_hrt);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occured during set integer attribute to "
-                               "media engine config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occured during set integer attribute to "
+                               "media engine config : %i", err);
                goto cleanup;
        }
 
@@ -435,8 +446,8 @@ int generate_barcode_to_image(barcode_model_s model)
                                                                                        MV_BARCODE_GENERATE_ATTR_COLOR_FRONT,
                                                                                        model.front_color);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occured during set string attribute to "
-                               "media engine config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occured during set string attribute to "
+                               "media engine config : %i", err);
                goto cleanup;
        }
 
@@ -444,8 +455,8 @@ int generate_barcode_to_image(barcode_model_s model)
                                                                                        MV_BARCODE_GENERATE_ATTR_COLOR_BACK,
                                                                                        model.back_color);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occured during set string attribute to "
-                               "media engine config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occured during set string attribute to "
+                               "media engine config : %i", err);
                goto cleanup;
        }
        err = mv_barcode_generate_image(mv_engine_config, model.message,
@@ -453,19 +464,19 @@ int generate_barcode_to_image(barcode_model_s model)
                                                                        model.mode, model.ecc, model.version,
                                                                        model.file_name, model.out_image_format);
        if (MEDIA_VISION_ERROR_NONE != err)
-               printf("ERROR: Errors were occurred during generate image error: %i\n",
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during generate image error : %i",
                           err);
 cleanup:
        if (MEDIA_VISION_ERROR_NONE != err) {
                int err2 = mv_destroy_engine_config(mv_engine_config);
                if (MEDIA_VISION_ERROR_NONE != err2)
-                       printf("ERROR: Errors were occurred during destroying the media engine config: %i\n",
+                       mvprintw(current_y++, MINX, "ERROR : Errors were occurred during destroying the media engine config : %i",
                                   err2);
 
        } else {
                err = mv_destroy_engine_config(mv_engine_config);
                if (MEDIA_VISION_ERROR_NONE != err)
-                       printf("ERROR: Errors were occurred during destroying the media engine config: %i\n",
+                       mvprintw(current_y++, MINX, "ERROR : Errors were occurred during destroying the media engine config : %i",
                                   err);
        }
        MEDIA_VISION_FUNCTION_LEAVE();
@@ -487,8 +498,8 @@ int generate_barcode_to_source(barcode_model_s model)
        mv_source_h source = NULL;
        int err = mv_create_source(&source);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred when trying to create Media Vision "
-                               "source. Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred when trying to create Media Vision "
+                               "source. Error code : %i", err);
 
                MEDIA_VISION_FUNCTION_LEAVE();
 
@@ -502,8 +513,8 @@ int generate_barcode_to_source(barcode_model_s model)
        mv_engine_config_h mv_engine_config;
        err = mv_create_engine_config(&mv_engine_config);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occurred during creating the media engine "
-                               "config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during creating the media engine "
+                               "config : %i", err);
                goto clean_source;
        }
 
@@ -511,8 +522,8 @@ int generate_barcode_to_source(barcode_model_s model)
                                                                                        MV_BARCODE_GENERATE_ATTR_COLOR_FRONT,
                                                                                        model.front_color);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occured during set string attribute to "
-                               "media engine config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occured during set string attribute to "
+                               "media engine config : %i", err);
                goto clean_all;
        }
 
@@ -520,8 +531,8 @@ int generate_barcode_to_source(barcode_model_s model)
                                                                                        MV_BARCODE_GENERATE_ATTR_COLOR_BACK,
                                                                                        model.back_color);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occured during set string attribute to "
-                               "media engine config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occured during set string attribute to "
+                               "media engine config : %i", err);
                goto clean_all;
        }
 
@@ -535,8 +546,8 @@ int generate_barcode_to_source(barcode_model_s model)
                        source);
 
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred during generation barcode to the "
-                               "Media Vision source. Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred during generation barcode to the "
+                               "Media Vision source. Error code : %i", err);
                goto clean_all;
        }
 
@@ -548,29 +559,29 @@ int generate_barcode_to_source(barcode_model_s model)
 
        err = mv_source_get_buffer(source, &data_buffer, &buffer_size);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred when trying to get buffer from "
-                               "Media Vision source. Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred when trying to get buffer from "
+                               "Media Vision source. Error code : %i", err);
                goto clean_all;
        }
 
        err = mv_source_get_width(source, &image_width);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred when trying to get width of "
-                               "Media Vision source. Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred when trying to get width of "
+                               "Media Vision source. Error code : %i", err);
                goto clean_all;
        }
 
        err = mv_source_get_height(source, &image_height);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred when trying to get height of "
-                               "Media Vision source. Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred when trying to get height of "
+                               "Media Vision source. Error code : %i", err);
                goto clean_all;
        }
 
        err = mv_source_get_colorspace(source, &image_colorspace);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred when trying to get colorspace of "
-                               "Media Vision source. Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred when trying to get colorspace of "
+                               "Media Vision source. Error code : %i", err);
                goto clean_all;
        }
 
@@ -600,32 +611,32 @@ int generate_barcode_to_source(barcode_model_s model)
        }
        err = save_image_from_buffer(jpeg_file_name, data_buffer, &image_data, 100);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Error occurred when try to save image from buffer."
-                               "Error code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error occurred when try to save image from buffer."
+                               "Error code : %i", err);
        }
        free(jpeg_file_name);
 clean_all:
        if (MEDIA_VISION_ERROR_NONE != err) {
                int err2 = mv_destroy_engine_config(mv_engine_config);
                if (MEDIA_VISION_ERROR_NONE != err2)
-                       printf("ERROR: Errors were occurred during destroying the media engine config: %i\n",
+                       mvprintw(current_y++, MINX, "ERROR : Errors were occurred during destroying the media engine config : %i",
                                   err2);
        } else {
                err = mv_destroy_engine_config(mv_engine_config);
                if (MEDIA_VISION_ERROR_NONE != err)
-                       printf("ERROR: Errors were occurred during destroying the media engine config: %i\n",
+                       mvprintw(current_y++, MINX, "ERROR : Errors were occurred during destroying the media engine config : %i",
                                   err);
        }
 clean_source:
        if (MEDIA_VISION_ERROR_NONE != err) {
                int err2 = mv_destroy_source(source);
                if (MEDIA_VISION_ERROR_NONE != err2)
-                       printf("ERROR: Error occurred when try to destroy Media Vision source. Error code: %i\n",
+                       mvprintw(current_y++, MINX, "ERROR : Error occurred when try to destroy Media Vision source. Error code : %i",
                                   err2);
        } else {
                err = mv_destroy_source(source);
                if (MEDIA_VISION_ERROR_NONE != err)
-                       printf("ERROR: Error occurred when try to destroy Media Vision source. Error code: %i\n",
+                       mvprintw(current_y++, MINX, "ERROR : Error occurred when try to destroy Media Vision source. Error code : %i",
                                   err);
        }
        MEDIA_VISION_FUNCTION_LEAVE();
@@ -643,7 +654,7 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        int err = load_image_to_buffer(
                        model.file_name, &data_buffer, &buffer_size, &image_data);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occurred during opening the file!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during opening the file!!! code : %i", err);
 
                if (data_buffer != NULL)
                        destroy_loaded_buffer(data_buffer);
@@ -657,7 +668,7 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        unsigned long converted_buffer_size = 0;
        err = convert_rgb_to(data_buffer, &converted_buffer, image_data, model.colorspace, &converted_buffer_size);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Can't convert to the selected colorspace!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Can't convert to the selected colorspace!!! code : %i", err);
 
                if (data_buffer != NULL)
                        destroy_loaded_buffer(data_buffer);
@@ -675,7 +686,7 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        mv_engine_config_h mv_engine_config = NULL;
        err = mv_create_engine_config(&mv_engine_config);
        if (MEDIA_VISION_ERROR_NONE != err)
-               printf("ERROR: Errors were occurred during creating the media engine config: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during creating the media engine config : %i", err);
 
        mv_engine_config_foreach_supported_attribute(_mv_engine_config_supported_attribute, mv_engine_config);
 
@@ -684,14 +695,14 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
                        MV_BARCODE_DETECT_ATTR_TARGET,
                        MV_BARCODE_DETECT_ATTR_TARGET_2D_BARCODE);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occurred during target attribute"
-                               "configuration: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during target attribute"
+                               "configuration : %i", err);
        }
 
        mv_source_h source;
        err = mv_create_source(&source);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occurred during creating the source!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during creating the source!!! code : %i", err);
 
                if (data_buffer != NULL)
                        destroy_loaded_buffer(data_buffer);
@@ -710,7 +721,7 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        err = mv_source_fill_by_buffer(source, converted_buffer, converted_buffer_size,
                        image_data.image_width, image_data.image_height, model.colorspace);
        if (MEDIA_VISION_ERROR_NONE != err) {
-               printf("ERROR: Errors were occurred during filling the source!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during filling the source!!! code : %i", err);
 
                if (data_buffer != NULL)
                        destroy_loaded_buffer(data_buffer);
@@ -736,15 +747,15 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
                destroy_loaded_buffer(data_buffer);
 
        if (MEDIA_VISION_ERROR_NONE != err)
-               printf("ERROR: Errors were occurred during barcode detection!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during barcode detection!!! code : %i", err);
 
        err = mv_destroy_source(source);
        if (MEDIA_VISION_ERROR_NONE != err)
-               printf("ERROR: Errors were occurred during destroying the source!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during destroying the source!!! code : %i", err);
 
        err = mv_destroy_engine_config(mv_engine_config);
        if (MEDIA_VISION_ERROR_NONE != err)
-               printf("ERROR: Error were occurred during destroying the source!!! code: %i\n", err);
+               mvprintw(current_y++, MINX, "ERROR : Error were occurred during destroying the source!!! code : %i", err);
 
        MEDIA_VISION_FUNCTION_LEAVE();
 
@@ -755,24 +766,19 @@ int input_string(const char *prompt, size_t max_len, char **string)
 {
        MEDIA_VISION_FUNCTION_ENTER();
 
-       printf("\n");
-       printf("%s ", prompt);
-
-       if (scanf("\n") != 0) {
-               MEDIA_VISION_FUNCTION_LEAVE();
-               return -1;
-       }
+       mvaddstr(current_y++, MINX, prompt);
 
        char buffer[max_len];
-       int last_char = 0;
-       buffer[last_char] = '\0';
-       buffer[sizeof(buffer) - 1] = ~'\0';
-       if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
+       int err = getnstr(buffer, max_len);
+       if (err != OK) {
+               LOGE("getnstr failed with error code (0x%08x)", err);
                MEDIA_VISION_FUNCTION_LEAVE();
                return -1;
        }
-       size_t real_string_len = strlen(buffer);
-       buffer[real_string_len - 1] = '\0';
+
+       size_t string_len = strlen(buffer);
+       buffer[string_len] = '\0';
+       size_t real_string_len = string_len + 1;
        *string = (char*)malloc(real_string_len * sizeof(char));
        if (*string == NULL) {
                MEDIA_VISION_FUNCTION_LEAVE();
@@ -780,9 +786,11 @@ int input_string(const char *prompt, size_t max_len, char **string)
        }
 
        strncpy(*string, buffer, real_string_len);
-
        size_t str_len = strlen(*string);
 
+       if (mode == AUTO)
+                sleep(SLEEP_INTERVAL);
+
        MEDIA_VISION_FUNCTION_LEAVE();
 
        return str_len;
@@ -792,22 +800,21 @@ int input_size(const char *prompt, size_t max_size, size_t *size)
 {
        MEDIA_VISION_FUNCTION_ENTER();
 
-       printf("\n");
-       printf("%s ", prompt);
+       char buffer[20];
+       mvaddstr(current_y++, MINX, prompt);
 
-       if (scanf("%20zu", size) == 0) {
-               if (scanf("%*[^\n]%*c") != 0) {
-                       printf("ERROR: Reading the input line error.\n");
-                       MEDIA_VISION_FUNCTION_LEAVE();
-                       return -1;
-               }
-               printf("ERROR: Incorrect input.\n");
+       int err = getnstr(buffer, 20);
+       if (err != OK) {
+               LOGE("getnstr failed with error code (0x%08x)", err);
                MEDIA_VISION_FUNCTION_LEAVE();
                return -1;
        }
-
+       *size = atoi(buffer);
        int ret = (*size > max_size ? -1 : 0);
 
+       if (mode == AUTO)
+                sleep(SLEEP_INTERVAL);
+
        MEDIA_VISION_FUNCTION_LEAVE();
 
        return ret;
@@ -817,22 +824,21 @@ int input_int(const char *prompt, int min_value, int max_value, int *value)
 {
        MEDIA_VISION_FUNCTION_ENTER();
 
-       printf("\n");
-       printf("%s ", prompt);
+       char buffer[20];
+       mvaddstr(current_y++, MINX, prompt);
 
-       if (scanf("%20i", value) == 0) {
-               if (scanf("%*[^\n]%*c") != 0) {
-                       printf("ERROR: Reading the input line error.\n");
-                       MEDIA_VISION_FUNCTION_LEAVE();
-                       return -1;
-               }
-               printf("ERROR: Incorrect input.\n");
+       int err = getnstr(buffer, 20);
+       if (err != OK) {
+               LOGE("getnstr failed with error code (0x%08x)", err);
                MEDIA_VISION_FUNCTION_LEAVE();
                return -1;
        }
-
+       *value = atoi(buffer);
        int ret = (*value < min_value || *value > max_value ? -1 : 0);
 
+       if (mode == AUTO)
+                sleep(SLEEP_INTERVAL);
+
        MEDIA_VISION_FUNCTION_LEAVE();
 
        return ret;
@@ -842,24 +848,36 @@ int show_menu(const char *title, const int *options, const char **names, int cnt
 {
        MEDIA_VISION_FUNCTION_ENTER();
 
-       printf("***************************\n");
-       printf("* %23s *\n", title);
-       printf("*-------------------------*\n");
+       erase();
+       refresh();
+
+       current_y = MINY;
+       mvaddstr(current_y++, MINX, "***************************");
+       mvprintw(current_y++, MINX, "* %23s *", title);
+       mvaddstr(current_y++, MINX, "*-------------------------*");
        int i = 0;
-       for (i = 0; i < cnt; ++i)
-               printf("* %2i. %19s *\n", options[i], names[i]);
+       for (i = 0; i < cnt; ++i) {
+               mvprintw(current_y++, MINX, "* %2i. %19s *", options[i], names[i]);
+       }
+       mvaddstr(current_y++, MINX, "***************************");
 
-       printf("***************************\n\n");
+       char buf[256];
        int selection = 0;
-       printf("Your choise: ");
-       if (scanf("%20i", &selection) == 0) {
-               if (scanf("%*[^\n]%*c") != 0) {
-                       printf("ERROR: Reading the input line error.\n");
-                       MEDIA_VISION_FUNCTION_LEAVE();
-                       return -1;
-               }
-               printf("ERROR: Incorrect input.\n");
-       }
+       bool condition = false;
+       refresh();
+       do {
+               mvaddstr(current_y++, MINX, "Your Choice : ");
+               getstr(&buf);
+               selection = atoi(buf);
+               condition = selection > options[cnt-1];
+               if (condition)
+                       mvprintw(current_y++, MINX, "You pressed invalid menu, try again");
+
+               refresh();
+       } while (condition);
+
+       if (mode == AUTO)
+                sleep(SLEEP_INTERVAL);
 
        MEDIA_VISION_FUNCTION_LEAVE();
 
@@ -876,7 +894,7 @@ mv_barcode_type_e select_type(void)
        MEDIA_VISION_FUNCTION_ENTER();
 
        while (sel_opt == 0) {
-               sel_opt = show_menu("Select barcode type:", options, names, 8);
+               sel_opt = show_menu("Select barcode type : ", options, names, 8);
 
                switch (sel_opt) {
                case 1:
@@ -924,7 +942,7 @@ mv_barcode_qr_mode_e select_mode(void)
        MEDIA_VISION_FUNCTION_ENTER();
 
        while (sel_opt == 0) {
-               sel_opt = show_menu("Select encoding mode:", options, names, 4);
+               sel_opt = show_menu("Select encoding mode : ", options, names, 4);
                switch (sel_opt) {
                case 1:
                        selected_mode = MV_BARCODE_QR_MODE_NUMERIC;
@@ -959,7 +977,7 @@ mv_barcode_qr_ecc_e select_ecc(void)
        MEDIA_VISION_FUNCTION_ENTER();
 
        while (sel_opt == 0) {
-               sel_opt = show_menu("Select ECC level:", options, names, 4);
+               sel_opt = show_menu("Select ECC level : ", options, names, 4);
                switch (sel_opt) {
                case 1:
                        selected_ecc = MV_BARCODE_QR_ECC_LOW;
@@ -1021,7 +1039,7 @@ int select_version(void)
        while (sel_opt == 0) {
                const int options[2] = {1, 40};
                const char *names[2] = { "1..", "..40" };
-               sel_opt = show_menu("Select QR version:", options, names, 2);
+               sel_opt = show_menu("Select QR version : ", options, names, 2);
                if (sel_opt < 1 || sel_opt > 40)
                        sel_opt = 0;
        }
@@ -1041,7 +1059,7 @@ generation_fcn_e select_gen_function(void)
        MEDIA_VISION_FUNCTION_ENTER();
 
        while (sel_opt == 0) {
-               sel_opt = show_menu("Select API function:", options, names, 2);
+               sel_opt = show_menu("Select API function : ", options, names, 2);
                switch (sel_opt) {
                case 1:
                        ret_fcn_type = MV_TS_GENERATE_TO_IMAGE_FCN;
@@ -1070,7 +1088,7 @@ mv_barcode_image_format_e select_file_format(void)
        MEDIA_VISION_FUNCTION_ENTER();
 
        while (sel_opt == 0) {
-               sel_opt = show_menu("Select file format:", options, names, 3);
+               sel_opt = show_menu("Select file format : ", options, names, 3);
                switch (sel_opt) {
                case 1:
                        image_format = MV_BARCODE_IMAGE_FORMAT_BMP;
@@ -1106,29 +1124,29 @@ int perform_detect()
                MEDIA_VISION_COLORSPACE_INVALID,
                NULL, NULL, NULL, NULL, NULL, NULL };
 
-       while (input_string("Input file name to be analyzed:", 1024, &(detect_model.file_name)) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_string("Input file name to be analyzed : ", 1024, &(detect_model.file_name)) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Barcode input image has been specified");
 
        mv_rectangle_s roi = { {0, 0}, 0, 0 };
 
-       while (input_int("Input x coordinate for ROI top left vertex:", 0, 10000, &(roi.point.x)) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_int("Input x coordinate for ROI top left vertex : ", 0, 10000, &(roi.point.x)) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
-       while (input_int("Input y coordinate for ROI top left vertex:", 0, 10000, &(roi.point.y)) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_int("Input y coordinate for ROI top left vertex : ", 0, 10000, &(roi.point.y)) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
-       while (input_int("Input ROI width:", 0, 10000, &(roi.width)) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_int("Input ROI width : ", 0, 10000, &(roi.width)) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
-       while (input_int("Input ROI height:", 0, 10000, &(roi.height)) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_int("Input ROI height : ", 0, 10000, &(roi.height)) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Region of interest (ROI) to detect barcode into has been specified");
 
-       while (input_string("Input file name to be generated:", 1024, &(detect_model.out_file_name)) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_string("Input file name to be generated : ", 1024, &(detect_model.out_file_name)) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Barcode output image has been specified");
 
@@ -1148,7 +1166,7 @@ int perform_detect()
                                                                "RGB888", "RGBA" };
 
        while (true) {
-               int sel_opt = show_menu("Select colorspace to test detector on:", options, names, 11);
+               int sel_opt = show_menu("Select colorspace to test detector on : ", options, names, 11);
                if (sel_opt < MEDIA_VISION_COLORSPACE_Y800 ||
                        sel_opt > MEDIA_VISION_COLORSPACE_RGBA)
                        continue;
@@ -1211,34 +1229,34 @@ int perform_generate(void)
                LOGI("Barcode output image format has been selected");
        }
 
-       while (input_string("Input message:", 7089, &generate_model.message) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_string("Input message : ", 7089, &generate_model.message) == -1)
+               mvaddstr(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Barcode message has been specified");
 
-       while (input_string("Input file name:", 1024, &generate_model.file_name) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_string("Input file name : ", 255, &generate_model.file_name) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Barcode output file name has been specified");
 
-       while (input_string("Input foreground color (ex:black is 000000):", 1024, &generate_model.front_color) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_string("Input foreground color (ex:black is 000000) : ", 6, &generate_model.front_color) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Foreground color is %s", generate_model.front_color);
 
-       while (input_string("Input background color (ex:white is ffffff):", 1024, &generate_model.back_color) == -1)
-               printf("Incorrect input! Try again.\n");
+       while (input_string("Input background color (ex:white is ffffff) : ", 6, &generate_model.back_color) == -1)
+               mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
        LOGI("Background color is %s", generate_model.back_color);
 
        if (gen_fcn == MV_TS_GENERATE_TO_IMAGE_FCN) {
-               while (input_size("Input image width:", 10000, &generate_model.width) == -1)
-                       printf("Incorrect input! Try again.\n");
+               while (input_size("Input image width : ", 10000, &generate_model.width) == -1)
+                       mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
                LOGI("Barcode output file width has been specified");
 
-               while (input_size("Input image height:", 10000, &generate_model.height) == -1)
-                       printf("Incorrect input! Try again.\n");
+               while (input_size("Input image height : ", 10000, &generate_model.height) == -1)
+                       mvprintw(current_y++, MINX, "Incorrect input! Try again.");
 
                LOGI("Barcode output file height has been specified");
        }
@@ -1262,20 +1280,37 @@ int perform_generate(void)
 
        if (err != MEDIA_VISION_ERROR_NONE) {
                LOGE("Barcode generation failed with error code (0x%08x)", err);
-               printf("ERROR: Errors were occurred during barcode generation!!!\n");
+               mvprintw(current_y++, MINX, "ERROR : Errors were occurred during barcode generation!!!");
                MEDIA_VISION_FUNCTION_LEAVE();
                return err;
        }
 
        LOGI("Barcode output file has been generated");
-       printf("\nBarcode image was successfully generated.\n");
+       current_y++;
+       mvprintw(current_y++, MINX, "Barcode image was successfully generated.");
+       current_y++;
+       mvprintw(current_y++, MINX, "Press any key to continue...");
+       getch();
 
        MEDIA_VISION_FUNCTION_LEAVE();
 
        return 0;
 }
 
-int main(void)
+void print_usage(char *exe_name)
+{
+       if (!exe_name){
+               fprintf(stderr, current_y++, MINX, "critical error!!\n");
+               exit(EXIT_FAILURE);
+       }
+
+       printf("usage >>\n");
+       printf("\t$ ./%s [--auto] (default mode is manual)\n", exe_name);
+       endwin();
+       exit(EXIT_FAILURE);
+}
+
+int main(int argc, char *argv[])
 {
        LOGI("Media Vision Testsuite is launched.");
 
@@ -1285,8 +1320,27 @@ int main(void)
        const int options[2] = { 1, 2 };
        const char *names[2] = { "Generate", "Detect" };
 
+       initscr();
+
+       if (argc > 1 && argv[1] != 0){
+               if (strncmp(argv[1], "--auto", 6) == 0){
+                       system("mv_barcode_test_suite_auto");
+                       endwin();
+                       return 0;
+               } else if (strncmp(argv[1], "--interval", 10) == 0){
+                       mode = 1;
+               } else
+                       print_usage(argv[0]);
+       } else if (argc == 1){
+                       mode = 0;
+                       mvaddstr(MINY, MINX, "launched by MANUAL test mode\n");
+                       mvaddstr(MINY + 1, MINX, "press any key to continue...");
+                       refresh();
+                       getch();
+       }
+
        while (sel_opt == 0) {
-               sel_opt = show_menu("Select action:", options, names, 2);
+               sel_opt = show_menu("Select action : ", options, names, 2);
                switch (sel_opt) {
                case 1:
                        LOGI("Start the barcode generation flow");
@@ -1304,7 +1358,7 @@ int main(void)
                int do_another = 0;
 
                if (err != MEDIA_VISION_ERROR_NONE)
-                       printf("ERROR: Action is finished with error code: %i\n", err);
+                       mvprintw(current_y++, MINX, "ERROR : Action is finished with error code : %i", err);
 
                sel_opt = 0;
                const int options_last[2] = { 1, 2 };
@@ -1330,6 +1384,7 @@ int main(void)
        }
 
        LOGI("Media Vision Testsuite is closed.");
+       endwin();
 
        return err;
 }
diff --git a/test/testsuites/barcode/mv_barcode_test_suite_auto b/test/testsuites/barcode/mv_barcode_test_suite_auto
new file mode 100755 (executable)
index 0000000..22fd06b
--- /dev/null
@@ -0,0 +1,16 @@
+while read x ; do sleep 1; echo $x ; done << EOF |  mv_barcode_test_suite --interval
+1
+1
+1
+1
+1
+20
+3
+12341113
+/tmp/bar_gen_out
+000000
+ffffff
+200
+200
+22
+EOF