From: Jihun Park Date: Mon, 14 Oct 2019 06:43:28 +0000 (+0000) Subject: Revert "[UTC][capi-media-vision][NonACR][Fix wrong API call and add missed TCs in... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cfe31cfef255b1d51d371902dc29dc4243c960e7;p=test%2Ftct%2Fnative%2Fapi.git Revert "[UTC][capi-media-vision][NonACR][Fix wrong API call and add missed TCs in UTC]" This reverts commit 4f979987807ed9a5ac93786e5e9b69daf49fa63a. Change-Id: I26035e6e6bef402f32233b1fcfcfd1949b4ac75e --- diff --git a/src/utc/capi-media-vision/utc-mv_common.c b/src/utc/capi-media-vision/utc-mv_common.c index 67257a259..6c190de90 100755 --- a/src/utc/capi-media-vision/utc-mv_common.c +++ b/src/utc/capi-media-vision/utc-mv_common.c @@ -26,7 +26,6 @@ #define DICT_KEY_SIZE 255 #define DICT_STR_VALUE_SIZE 1024 -#define DICT_ARRAY_STR_SIZE 10 static bool isVisionSupported = false; static int gStartupError; @@ -58,13 +57,6 @@ struct attr_str_entry char value[DICT_STR_VALUE_SIZE]; }; -struct attr_array_str_entry -{ - char key[DICT_KEY_SIZE]; - char value[DICT_ARRAY_STR_SIZE][DICT_STR_VALUE_SIZE]; - int size; -}; - static mv_engine_config_h engine_config = NULL; static bool _is_broken_config = false; @@ -76,8 +68,6 @@ static struct attr_bool_entry *dict_bool = NULL; static int dict_bool_n = 0; static struct attr_str_entry *dict_str = NULL; static int dict_str_n = 0; -static struct attr_array_str_entry *dict_array_str = NULL; -static int dict_array_str_n = 0; bool _parse_attr_dictionaries(const char *conf_file) { @@ -183,20 +173,6 @@ bool _parse_attr_dictionaries(const char *conf_file) assert_geq(DICT_STR_VALUE_SIZE, strlen(str_value)); snprintf(dict_str[dict_str_n-1].value, DICT_STR_VALUE_SIZE, "%s", str_value); } - else if (0 == strcmp("array", str_type)) - { - dict_array_str = (struct attr_array_str_entry*)reallocate(dict_array_str, ++dict_array_str_n * sizeof(struct attr_array_str_entry)); - snprintf(dict_array_str[dict_array_str_n-1].key, DICT_KEY_SIZE, "%s", str_name); - JsonArray *attr_array = json_object_get_array_memeber(attr_obj, "value"); - assert_geq(DICT_ARRAY_STR_SIZE, json_array_get_length(attr_array)); - for (unsigned int item = 0; item < json_array_get_length(attr_array); ++item) - { - const char *str_value = (const char*)json_array_get_string_element(attr_array, item); - assert_geq(DICT_STR_VALUE_SIZE, strlen(str_value)); - snprintf(dict_array_str[dict_array_str_n].value[item], DICT_STR_VALUE_SIZE, "%s", str_value); - } - dict_array_str[dict_array_str_n].size = json_array_get_length(attr_array); - } else { printf("Attribute %s wasn't parsed from json file. Type isn't supported.", str_name); @@ -281,24 +257,6 @@ bool _is_supported_str_attr(const char *key, char *value) return false; } -bool _is_supported_array_str_attr(const char *key, char **value) -{ - int ind = 0; - for(; ind < dict_array_str_n; ++ind) - { - if (0 == strcmp(dict_array_str[ind].key, key)) - { - if (value != NULL) - { - snprintf(value, 1024, "%s", dict_str[ind].value); - } - return true; - } - } - - return false; -} - /** * @function utc_capi_media_vision_common_startup * @description Called before each test @@ -313,19 +271,14 @@ void utc_capi_media_vision_common_startup(void) bool isImageRecognitionSupported = false; bool isBarcodeDetectionSupported = false; bool isBarcodeGenerationSupported = false; - bool isVisionInferenceImageSupported = false; - bool isVisionInferenceFaceSupported = false; system_info_get_platform_bool("http://tizen.org/feature/vision.face_recognition", &isFaceRecognitionSupported); system_info_get_platform_bool("http://tizen.org/feature/vision.image_recognition", &isImageRecognitionSupported); system_info_get_platform_bool("http://tizen.org/feature/vision.barcode_detection", &isBarcodeDetectionSupported); system_info_get_platform_bool("http://tizen.org/feature/vision.barcode_generation", &isBarcodeGenerationSupported); - System_info_get_platform_bool("http://tizen.org/feature/vision.inference.image", &isVisionInferenceImageSupported); - System_info_get_platform_bool("http://tizen.org/feature/vision.inference.face", &isVisionInferenceFaceSupported); if (isFaceRecognitionSupported || isImageRecognitionSupported || - isBarcodeDetectionSupported || isBarcodeGenerationSupported || - isVisionInferenceImageSupported || isVisionInferenceFaceSupported) + isBarcodeDetectionSupported || isBarcodeGenerationSupported) isVisionSupported = true; else isVisionSupported = false; @@ -446,9 +399,6 @@ bool _attribute_supported_callback( bool real_bool_value = true; char str_value[DICT_STR_VALUE_SIZE] = "a"; char *real_str_value; - char array_str_value[DICT_ARRAY_STR_SIZE][DICT_STR_VALUE_SIZE] = {"a",}; - int real_array_size; - char **real_array_str_value; bool is_supported = false; bool are_exp_act_equal = false; @@ -518,31 +468,6 @@ bool _attribute_supported_callback( are_exp_act_equal = 0 == strcmp(str_value, real_str_value); free(real_str_value); break; - case MV_ENGINE_CONFIG_ATTR_TYPE_ARRAY_STRING: - is_supported = _is_supported_array_str_attr(attribute_name, array_str_value); - if (MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE == - mv_engine_config_get_string_attribute( - engine_config, attribute_name, &real_array_str_value, &real_array_size)) - { - printf("Default string attribute %s wasn't set in engine " - "configuration by default. Failed\n", attribute_name); - *isCorrect = false; - for (int i = 0; i < real_array_size; ++i) - free(real_array_str_value[i]); - free(real_array_str_value); - printf("FAILED\n"); - return true; - } - for (int i = 0; i < real_array_size; ++i) { - printf("Expected value: [%s] | Real value: [%s]\n", array_str_value[i], real_array_str_value[i]); - if(0 != strcmp(array_str_value[i], real_array_str_value[i])); - break; - } - for (int i = 0; i < real_array_size; ++i) { - free(real_array_str_value[i]); - } - free(real_str_value); - break; default: printf("Attribute type received in mv_supported_attribute_cb " "is not supported. Failed"); @@ -1600,66 +1525,6 @@ int utc_mediavision_mv_engine_config_set_string_attribute_n(void) return 0; } -/** - * @brief Positive test case of mv_engine_config_set_array_tring_attribute() - * @testcase utc_mediavision_mv_engine_config_set_array_string_attribute_p - * @since_tizen 5.5 - * @description Set array string type attribute - */ -int utc_mediavision_mv_engine_config_set_array_string_attribute_p(void) -{ - printf("Inside mv_engine_config_set_array_string_attribute_p\n"); - - if (!isVisionSupported) { - assert_eq(gStartupError, MEDIA_VISION_ERROR_NOT_SUPPORTED); - return 0; - } - - mv_engine_config_h engHandler = NULL; - - int ret = mv_create_engine_config(&engHandler); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - const char *attributeValue[2] = {"output/node1", "output/node2"}; - - ret = mv_engine_config_set_string_attribute(engHandler, "MV_INFERENCE_OUTPUT_NODE_NAMES", attributeValue); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - ret = mv_destroy_engine_config(engHandler); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - printf("Before return mv_engine_config_set_array_string_attribute_p\n"); - - return 0; -} - -/** - * @brief Negative test case of mv_engine_config_set_array_string_attribute() - * @testcase utc_mediavision_mv_engine_config_set_array_string_attribute_n - * @since_tizen 5.5 - * @description Set array string type attribute but fail - * because engine configuration handle is null - */ -int utc_mediavision_mv_engine_config_set_array_string_attribute_n(void) -{ - printf("Inside mv_engine_config_set_array_string_attribute_n\n"); - - if (!isVisionSupported) { - assert_eq(gStartupError, MEDIA_VISION_ERROR_NOT_SUPPORTED); - return 0; - } - - mv_engine_config_h engHandler = NULL; - const char *attributeValue[2] = {"output/node1", "output/node2"}; - - const int ret = mv_engine_config_set_array_string_attribute(engHandler, "MV_INFERENCE_OUTPUT_NODE_NAMES", attributeValue); - assert_eq(MEDIA_VISION_ERROR_INVALID_PARAMETER, ret); - - printf("Before return mv_engine_config_set_string_attribute_n\n"); - - return 0; -} - /** * @brief Positive test case of mv_engine_config_get_double_attribute() * @testcase utc_mediavision_mv_engine_config_get_double_attribute_p @@ -1960,93 +1825,6 @@ int utc_mediavision_mv_engine_config_get_string_attribute_n(void) return 0; } -/** - * @brief Positive test case of mv_engine_config_get_array_string_attribute() - * @testcase utc_mediavision_mv_engine_config_get_array_string_attribute_p - * @since_tizen 5.5 - * @description Get array string attribute - */ -int utc_mediavision_mv_engine_config_get_array_string_attribute_p(void) -{ - printf("Inside mv_engine_config_get_array_string_attribute_p\n"); - - if (!isVisionSupported) { - assert_eq(gStartupError, MEDIA_VISION_ERROR_NOT_SUPPORTED); - return 0; - } - - mv_engine_config_h engHandler = NULL; - - int ret = mv_create_engine_config(&engHandler); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - const int expectedSize = 2; - const char *expectedParameterValue[expectedSize] = {"output/node1", "output/node2"}; - - ret = mv_engine_config_set_array_string_attribute(engHandler, "MV_INFERENCE_OUTPUT_NODE_NAMES", expectedParameterValue); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - int actualSize = 0; - char **actualParameterValue = NULL; - - ret = mv_engine_config_get_array_string_attribute(engHandler, "MV_INFERENCE_OUTPUT_NODE_NAMES", &actualParameterValue, &size); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - assert_eq(expectedSize, actualSize); - for (int i = 0; i < expectedSize; ++i) { - assert_eq(strcmp(expectedParameterValue[i], actualParameterValue[i]), 0); - } - - ret = mv_destroy_engine_config(engHandler); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - for (int i = 0; i < actualSize; ++i) { - free(actualParameterValue[i]); - } - free(actualParameterValue); - - printf("Before return mv_engine_config_get_string_attribute_p\n"); - - return 0; -} - -/** - * @brief Negative test case of mv_engine_config_get_array_string_attribute() - * @testcase utc_mediavision_mv_engine_config_get_array_string_attribute_n - * @since_tizen 5.5 - * @description Get array string attribute but fail - * because key is not available - */ -int utc_mediavision_mv_engine_config_get_array_string_attribute_n(void) -{ - printf("Inside mv_engine_config_get_array_string_attribute_n\n"); - - if (!isVisionSupported) { - assert_eq(gStartupError, MEDIA_VISION_ERROR_NOT_SUPPORTED); - return 0; - } - - mv_engine_config_h engHandler = NULL; - - int ret = mv_create_engine_config(&engHandler); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - - int *size = 0; - char **attributeValue = NULL; - - ret = mv_engine_config_get_string_attribute(engHandler, "test", &attributeValue, &size); - assert_eq(MEDIA_VISION_ERROR_KEY_NOT_AVAILABLE, ret); - - ret = mv_destroy_engine_config(engHandler); - assert_eq(MEDIA_VISION_ERROR_NONE, ret); - assert_eq(0, size); - assert_eq(NULL, attributeValue); - - printf("Before return mv_engine_config_get_array_string_attribute_n\n"); - - return 0; -} - /** * @brief Positive test case of mv_engine_config_foreach_supported_attribute() * @testcase utc_mediavision_mv_engine_config_foreach_supported_attribute_p diff --git a/src/utc/capi-media-vision/utc-mv_inference.c b/src/utc/capi-media-vision/utc-mv_inference.c index 114c5decd..cf3f4241c 100755 --- a/src/utc/capi-media-vision/utc-mv_inference.c +++ b/src/utc/capi-media-vision/utc-mv_inference.c @@ -1039,7 +1039,7 @@ int utc_mediavision_mv_inference_object_detect_p(void) ret = load_image_to_media_source(imageFilename, gSourceHandle); assert_eq(MEDIA_VISION_ERROR_NONE, ret); - ret = mv_inference_object_detect(gSourceHandle, + ret = mv_inference_image_classify(gSourceHandle, gInferenceHandle, NULL, _od_detected_cb, @@ -1133,7 +1133,7 @@ int utc_mediavision_mv_inference_object_detect_n2(void) ret = load_image_to_media_source(imageFilename, gSourceHandle); assert_eq(MEDIA_VISION_ERROR_NONE, ret); - ret = mv_inference_object_detect(gSourceHandle, + ret = mv_inference_image_classify(gSourceHandle, gInferenceHandle, NULL, _od_detected_cb,