Fix errors found while running UTC 58/318358/5
authorJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Sep 2024 06:58:48 +0000 (15:58 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Fri, 27 Sep 2024 15:45:28 +0000 (00:45 +0900)
Change-Id: I16b6723a84011d6f447cd34fd687d3026d9af38f

13 files changed:
capi/node/mmi-node-types.h
packaging/mmi.spec
src/common/mmi-communication-message.h
src/mmi/mmi-data.cpp
src/mmi/mmi-node.cpp
src/mmi/mmi-port.cpp
src/mmi/mmi-primitive-value.cpp
src/mmi/mmi-signal.cpp
src/mmi/mmi-workflow-instance.cpp
src/mmi/mmi-workflow-script-generator.h
src/mmi/mmi-workflow.cpp
src/mmi/mmi.cpp
tests/mmi/mmi-data-test.cpp

index 8ad5ca8b25ab22027275062d2d6f4d44201e3864..2d22cd4b184c2dac7a943f6b9d1a6cccb7504678 100644 (file)
@@ -44,49 +44,49 @@ extern "C" {
  * @details This enumeration defines the different source node types supported by the MMI framework.
  * @since_tizen 9.0
  */
-enum mmi_node_source_type_e {
+typedef enum {
     MMI_NODE_SOURCE_TYPE_NONE,                 /**< Indicates that there is no source node type. */
     MMI_NODE_SOURCE_TYPE_SCREEN_ANALYZER,      /**< Represents a screen analyzer node type. */
-};
+} mmi_node_source_type_e;
 
 /**
  * @brief Enumeration for MMI processor node type.
  * @details This enumeration defines the different processor node types supported by the MMI framework.
  * @since_tizen 9.0
  */
-enum mmi_node_processor_type_e {
+typedef enum {
     MMI_NODE_PROCESSOR_TYPE_NONE               /**< Indicates that there is no processor node type. */
-};
+} mmi_node_processor_type_e;
 
 /**
  * @brief Enumeration for MMI logic node type.
  * @details This enumeration defines the different logic node types supported by the MMI framework.
  * @since_tizen 9.0
  */
-enum mmi_node_logic_type_e {
+typedef enum {
     MMI_NODE_LOGIC_TYPE_NONE,                  /**< Indicates that there is no logic node type. */
     MMI_NODE_LOGIC_TYPE_FIXED_STRING_MATCH,    /**< Represents a fixed string match logic node type. */
-};
+} mmi_node_logic_type_e;
 
 /**
  * @brief Enumeration for MMI controller node type.
  * @details This enumeration defines the different controller node types supported by the MMI framework.
  * @since_tizen 9.0
  */
-enum mmi_node_controller_type_e {
+typedef enum {
     MMI_NODE_CONTROLLER_TYPE_NONE,             /**< Indicates that there is no controller node type. */
-};
+} mmi_node_controller_type_e;
 
 /**
  * @brief Enumeration for MMI action node type.
  * @details This enumeration defines the different action node types supported by the MMI framework.
  * @since_tizen 9.0
  */
-enum mmi_node_action_type_e {
+typedef enum {
     MMI_NODE_ACTION_TYPE_NONE,                 /**< Indicates that there is no action node type. */
     MMI_NODE_ACTION_TYPE_MOUSE_EVENT,          /**< Represents a mouse event action node type. */
     MMI_NODE_ACTION_TYPE_KEY_EVENT,            /**< Represents a key event action node type. */
-};
+} mmi_node_action_type_e;
 
 /**
  * @brief Creates a new source node.
index f952c068569243511e3013bde2f1fb1bfd414623..2fc7e38c8a30de98e2fe27479bbd5be066289314 100644 (file)
@@ -110,7 +110,6 @@ find . -name '*tidl*.gcno' -exec rm {} \;
 find . -name '*-port-instance*.gcno' -exec rm {} \;
 find . -name 'mmi-data-gateway*.gcno' -exec rm {} \;
 find . -name 'mmi-node-controller*.gcno' -exec rm {} \;
-find . -name 'mmi-signal*.gcno' -exec rm {} \;
 find . -name 'mmi-workflow-script*.gcno' -exec rm {} \;
 find . -name 'mmi-plugin*.gcno' -exec rm {} \;
 find . -name 'mmi-workflow-output-event*.gcno' -exec rm {} \;
index 4f434c25989196055974b47169e1a0999d78fb0a..7570fa1e74fa01a80f1a634b6437e2f4fd2da73a 100644 (file)
@@ -28,6 +28,7 @@ namespace mmi {
 
 namespace communication {
 
+// LCOV_EXCL_START
 enum class MESSAGE_GROUP {
     CLIENT,
     WORKFLOW,
@@ -110,6 +111,7 @@ struct ClientMessageWorkflowInstanceOutput : public ClientMessage {
     std::string source_name;
     mmi_data_h data{nullptr};
 };
+// LCOV_EXCL_STOP
 
 }; // namespace communication
 
index e31f6dd19e67db0e9e46b42874e56c9d84081ec3..773804c8b9df8aa6a9ff4b0dc5d7f05a2c5332f6 100644 (file)
@@ -61,7 +61,6 @@ static inline mmi_data_h *get_element_value_pointer_in_struct(mmi_data_h struct_
     return get_element_pointer_in_array(struct_handle, index * 2 + 1);
 }
 
-// LCOV_EXCL_START
 int mmi_data_create_bool(bool value, mmi_data_h *data) {
     if (nullptr == data) {
         _E("[ERROR] Some parameters are invalid");
@@ -70,26 +69,29 @@ int mmi_data_create_bool(bool value, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_BOOLEAN;
-    new_data->data = malloc(sizeof(bool));
+    new_data->data = malloc(sizeof(unsigned char));
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
-    *(reinterpret_cast<bool *>(new_data->data)) = value;
-    new_data->datalen = sizeof(bool);
+    *(reinterpret_cast<unsigned char *>(new_data->data)) = value;
+    new_data->datalen = sizeof(unsigned char);
 
     *data = new_data;
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int mmi_data_create_int(int value, mmi_data_h *data) {
     if (nullptr == data) {
@@ -99,16 +101,20 @@ int mmi_data_create_int(int value, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_INTEGER;
     new_data->data = malloc(sizeof(int));
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     *(reinterpret_cast<int *>(new_data->data)) = value;
@@ -119,7 +125,7 @@ int mmi_data_create_int(int value, mmi_data_h *data) {
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
+
 int mmi_data_create_float(float value, mmi_data_h *data) {
     if (nullptr == data) {
         _E("[ERROR] Some parameters are invalid");
@@ -128,16 +134,20 @@ int mmi_data_create_float(float value, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_FLOAT;
     new_data->data = malloc(sizeof(float));
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     *(reinterpret_cast<float *>(new_data->data)) = value;
@@ -147,7 +157,6 @@ int mmi_data_create_float(float value, mmi_data_h *data) {
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int mmi_data_create_text(const char *value, mmi_data_h *data) {
     if (nullptr == data || nullptr == value) {
@@ -157,17 +166,21 @@ int mmi_data_create_text(const char *value, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_TEXT;
     new_data->datalen = strlen(value) + 1;
     new_data->data = reinterpret_cast<void *>(malloc(new_data->datalen));
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
     memcpy(new_data->data, value, new_data->datalen);
 
@@ -184,16 +197,20 @@ int mmi_data_create_audio(const void *ptr, size_t len, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_AUDIO;
     new_data->data = malloc(len);
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     memcpy(new_data->data, ptr, len);
@@ -204,7 +221,6 @@ int mmi_data_create_audio(const void *ptr, size_t len, mmi_data_h *data) {
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
 int mmi_data_create_video(const void *ptr, size_t len, mmi_data_h *data) {
     if (nullptr == data || nullptr == ptr || 0 == len) {
         _E("[ERROR] Some parameters are invalid");
@@ -213,16 +229,20 @@ int mmi_data_create_video(const void *ptr, size_t len, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_VIDEO;
     new_data->data = malloc(len);
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     memcpy(new_data->data, ptr, len);
@@ -241,16 +261,20 @@ int mmi_data_create_user_identification(const void *ptr, size_t len, mmi_data_h
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_USER_IDENTIFICATION;
     new_data->data = malloc(len);
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     memcpy(new_data->data, ptr, len);
@@ -260,7 +284,6 @@ int mmi_data_create_user_identification(const void *ptr, size_t len, mmi_data_h
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int mmi_data_create_coordinate(int x, int y, mmi_data_h *data) {
     if (nullptr == data) {
@@ -270,16 +293,20 @@ int mmi_data_create_coordinate(int x, int y, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_COORDINATE;
     new_data->data = malloc(sizeof(int) * 2);
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     (reinterpret_cast<int *>(new_data->data))[0] = x;
@@ -299,16 +326,20 @@ int mmi_data_create_bounding_box(int x, int y, int w, int h, mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for mmi data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_BOUNDING_BOX;
     new_data->data = malloc(sizeof(int) * 4);
     if (nullptr == new_data->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(new_data);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     (reinterpret_cast<int *>(new_data->data))[0] = x;
@@ -330,8 +361,10 @@ int mmi_data_create_array(mmi_data_h *data) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_ARRAY;
@@ -371,8 +404,10 @@ int mmi_data_add_array_element(mmi_data_h array, mmi_data_h element) {
         array->data = array_data;
         array->datalen = array->datalen + g_unit_size;
     } else {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for array data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     return MMI_ERROR_NONE;
@@ -386,8 +421,10 @@ int mmi_data_create_struct(mmi_data_h *struct_handle) {
 
     auto new_data = reinterpret_cast<mmi_data_s *>(malloc(sizeof(mmi_data_s)));
     if (nullptr == new_data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     new_data->type = MMI_DATA_TYPE_STRUCT;
@@ -413,8 +450,10 @@ int mmi_data_set_struct_element(mmi_data_h struct_handle, const char *name, mmi_
     mmi_data_h name_element = nullptr;
     int ret = mmi_data_create_text(name, &name_element);
     if (MMI_ERROR_NONE != ret) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for name element");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     size_t count = get_count_of_elements(struct_handle);
@@ -427,9 +466,11 @@ int mmi_data_set_struct_element(mmi_data_h struct_handle, const char *name, mmi_
         struct_handle->data = struct_data;
         struct_handle->datalen = struct_handle->datalen + g_unit_size * 2;
     } else {
+// LCOV_EXCL_START
         mmi_data_destroy(name_element);
         _E("[ERROR] Fail to allocate memory for struct data");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     return MMI_ERROR_NONE;
@@ -446,7 +487,6 @@ int mmi_data_get_type(mmi_data_h data, mmi_data_type_e *type) {
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
 int mmi_data_get_bool(mmi_data_h data, bool *value) {
     if (nullptr == data || nullptr == value) {
         _E("[ERROR] Some parameters are invalid");
@@ -458,11 +498,11 @@ int mmi_data_get_bool(mmi_data_h data, bool *value) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
-    *value = *(reinterpret_cast<bool *>(data->data));
+    unsigned char temp_value = *(reinterpret_cast<unsigned char *>(data->data));
+    *value = !!(temp_value);
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int mmi_data_get_int(mmi_data_h data, int *value) {
     if (nullptr == data || nullptr == value) {
@@ -480,7 +520,6 @@ int mmi_data_get_int(mmi_data_h data, int *value) {
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
 int mmi_data_get_float(mmi_data_h data, float *value) {
     if (nullptr == data || nullptr == value) {
         _E("[ERROR] Some parameters are invalid");
@@ -496,7 +535,6 @@ int mmi_data_get_float(mmi_data_h data, float *value) {
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int mmi_data_get_text(mmi_data_h data, const char **text) {
     if (nullptr == data || nullptr == text) {
@@ -514,7 +552,6 @@ int mmi_data_get_text(mmi_data_h data, const char **text) {
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
 int mmi_data_get_audio(mmi_data_h data, const void **ptr, size_t *len) {
     if (nullptr == data || nullptr == ptr || nullptr == len) {
         _E("[ERROR] Some parameters are invalid");
@@ -565,7 +602,6 @@ int mmi_data_get_user_identification(mmi_data_h data, const void **ptr, size_t *
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 int mmi_data_get_coordinate(mmi_data_h data, int *x, int *y) {
     if (nullptr == data || nullptr == x || nullptr == y) {
@@ -804,8 +840,10 @@ int mmi_data_to_bytes(mmi_data_h data, unsigned char **bytes, size_t *length) {
             mmi_data_to_bytes(*element, &element_bytes, &element_size);
             buffer = reinterpret_cast<unsigned char *>(realloc(buffer, current_size + element_size + sizeof(size_t)));
             if (nullptr == buffer) {
+// LCOV_EXCL_START
                 _E("[ERROR] Failed to allocate memory");
                 return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
             }
             current = buffer + current_size;
             memcpy(current, &element_size, sizeof(size_t));
@@ -824,8 +862,10 @@ int mmi_data_to_bytes(mmi_data_h data, unsigned char **bytes, size_t *length) {
         size_t total_size = sizeof(mmi_data_type_e) + sizeof(size_t) + data->datalen;
         unsigned char *buffer = reinterpret_cast<unsigned char *>(malloc(total_size));
         if (nullptr == buffer) {
+// LCOV_EXCL_START
             _E("[ERROR] Failed to allocate memory");
             return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
         }
         unsigned char *current = buffer;
         memcpy(current, &(data->type), sizeof(mmi_data_type_e));
@@ -867,9 +907,11 @@ int mmi_data_from_bytes(unsigned char *bytes, size_t length, mmi_data_h *data) {
             current += sizeof(size_t);
             unsigned char *element_bytes = reinterpret_cast<unsigned char *>(malloc(element_size));
             if (nullptr == element_bytes) {
+// LCOV_EXCL_START
                 _E("[ERROR] Failed to allocate memory");
                 mmi_data_destroy(value);
                 return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
             }
 
             memcpy(element_bytes, current, element_size);
@@ -878,9 +920,11 @@ int mmi_data_from_bytes(unsigned char *bytes, size_t length, mmi_data_h *data) {
             mmi_data_from_bytes(element_bytes, element_size, &element);
             free(element_bytes);
             if (nullptr == element) {
+// LCOV_EXCL_START
                 _E("[ERROR] Failed to convert bytes to data");
                 mmi_data_destroy(value);
                 return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
             }
 
             auto array_data = reinterpret_cast<mmi_data_h *>(value->data);
@@ -891,10 +935,12 @@ int mmi_data_from_bytes(unsigned char *bytes, size_t length, mmi_data_h *data) {
                 value->data = array_data;
                 value->datalen += g_unit_size;
             } else {
+// LCOV_EXCL_START
                 _E("[ERROR] Fail to allocate memory for array data");
                 mmi_data_destroy(element);
                 mmi_data_destroy(value);
                 return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
             }
 
             num_elements++;
@@ -907,8 +953,10 @@ int mmi_data_from_bytes(unsigned char *bytes, size_t length, mmi_data_h *data) {
         current += sizeof(size_t);
         void *buf = calloc(1, datalen);
         if (nullptr == buf) {
+// LCOV_EXCL_START
             _E("[ERROR] Failed to allocate memory");
             return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
         }
         memcpy(buf, current, datalen);
 
@@ -922,4 +970,3 @@ int mmi_data_from_bytes(unsigned char *bytes, size_t length, mmi_data_h *data) {
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
index a432b88e57fd0fcd6227891a420468050d4ecb48..135003641a70b5aef7c0cf886f474d074bb91a96 100644 (file)
@@ -351,6 +351,9 @@ int mmi_node_destroy(mmi_node_h node) {
 
 // LCOV_EXCL_START
 int mmi_node_instance_set_attribute(mmi_node_instance_h instance, mmi_attribute_h attribute) {
+    if (instance == NULL || attribute == NULL) {
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
     return MMI_ERROR_NONE;
 }
 
@@ -375,10 +378,9 @@ int mmi_node_instance_find_sibling_port_instance(mmi_port_instance_h instance, c
         return MMI_ERROR_INVALID_PARAMETER;
     }
     mmi_node_instance_h node_instance = mmi_plugin_storage_find_node_instance_by_port_instance(instance);
-    if (node_instance == NULL) {
-        return MMI_ERROR_INVALID_PARAMETER;
+    if (node_instance) {
+        *sibling = mmi_plugin_storage_find_port_instance(node_instance, port_name);
     }
-    *sibling = mmi_plugin_storage_find_port_instance(node_instance, port_name);
     return MMI_ERROR_NONE;
 }
 
index f459b31c866f594230718c9dcc037e12c224d0ac..4c68de42662055bbc83a54f3a290d0b1134132e1 100644 (file)
@@ -197,6 +197,11 @@ MMI_API int mmi_port_destroy(mmi_port_h port) {
 
 // LCOV_EXCL_START
 MMI_API int mmi_port_instance_generate_output(mmi_port_instance_h instance, mmi_data_h data) {
+    if (nullptr == instance) {
+        LOGE("[ERROR] parameter is null");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
     mmi_plugin_module_event_handler_info_s event_handler_info = mmi_plugin_storage_get_plugin_module_event_handler();
     void *user_data = mmi_plugin_storage_get_plugin_module_event_handler_user_data();
 
index 0c2ddc9f2fa18be16ed4217d22be67a2f4ffebbe..45891b415d714be06cd4f114062b55066fb4c65b 100644 (file)
@@ -51,16 +51,20 @@ int mmi_primitive_value_create_int(int data, mmi_primitive_value_h *handle) {
 
     auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
     if (nullptr == primitive_value) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_INT;
     primitive_value->data = reinterpret_cast<void *>(malloc(sizeof(int)));
     if (nullptr == primitive_value->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(primitive_value);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     *(reinterpret_cast<int *>(primitive_value->data)) = data;
@@ -80,16 +84,20 @@ int mmi_primitive_value_create_float(float data, mmi_primitive_value_h *handle)
 
     auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
     if (nullptr == primitive_value) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_FLOAT;
     primitive_value->data = reinterpret_cast<void *>(malloc(sizeof(float)));
     if (nullptr == primitive_value->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(primitive_value);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     *(reinterpret_cast<float *>(primitive_value->data)) = data;
@@ -109,8 +117,10 @@ int mmi_primitive_value_create_string(const char *data, mmi_primitive_value_h *h
 
     auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
     if (nullptr == primitive_value) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_STRING;
@@ -131,16 +141,20 @@ int mmi_primitive_value_create_bool(bool data, mmi_primitive_value_h *handle) {
 
     auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
     if (nullptr == primitive_value) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_BOOL;
     primitive_value->data = reinterpret_cast<void *>(malloc(sizeof(int)));
     if (nullptr == primitive_value->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for raw data");
         free(primitive_value);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     *(reinterpret_cast<int *>(primitive_value->data)) = static_cast<int>(data);
@@ -160,8 +174,10 @@ int mmi_primitive_value_create_array(mmi_primitive_value_h *handle) {
 
     auto primitive_value = reinterpret_cast<mmi_primitive_value_s *>(malloc(sizeof(mmi_primitive_value_s)));
     if (nullptr == primitive_value) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for primitive value");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     primitive_value->type = MMI_PRIMITIVE_VALUE_TYPE_ARRAY;
@@ -204,8 +220,10 @@ int mmi_primitive_value_add_array_element(mmi_primitive_value_h array, mmi_primi
         array->data = array_data;
         array->datalen = array->datalen + g_unit_size;
     } else {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for array element");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     _D("[DEBUG] Success to add element(%zu)", get_array_count(array));
@@ -344,9 +362,11 @@ int mmi_primitive_value_clone(mmi_primitive_value_h handle, mmi_primitive_value_
     cloned_value->datalen = handle->datalen;
     cloned_value->data = calloc(1, handle->datalen);
     if (nullptr == cloned_value->data) {
+// LCOV_EXCL_START
         _E("[ERROR] Fail to allocate memory for data");
         free(cloned_value);
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     if (handle->type == MMI_PRIMITIVE_VALUE_TYPE_ARRAY) {
@@ -421,8 +441,10 @@ int mmi_primitive_value_to_bytes(mmi_primitive_value_h handle, unsigned char **b
             mmi_primitive_value_to_bytes(*element, &element_bytes, &element_size);
             buffer = reinterpret_cast<unsigned char *>(realloc(buffer, current_size + element_size + sizeof(size_t)));
             if (nullptr == buffer) {
+// LCOV_EXCL_START
                 _E("[ERROR] Fail to allocate memory for buffer");
                 return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
             }
             current = buffer + current_size;
             memcpy(current, &element_size, sizeof(size_t));
@@ -441,8 +463,10 @@ int mmi_primitive_value_to_bytes(mmi_primitive_value_h handle, unsigned char **b
         size_t total_size = sizeof(mmi_primitive_value_type_e) + sizeof(size_t) + handle->datalen;
         unsigned char *buffer = reinterpret_cast<unsigned char *>(malloc(total_size));
         if (nullptr == buffer) {
+// LCOV_EXCL_START
             _E("[ERROR] Fail to allocate memory for buffer");
             return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
         }
         unsigned char *current = buffer;
         memcpy(current, &(handle->type), sizeof(mmi_primitive_value_type_e));
@@ -506,6 +530,7 @@ int mmi_primitive_value_from_bytes(unsigned char *bytes, size_t size, mmi_primit
             }
 
             if (failed) {
+// LCOV_EXCL_START
                 /* Since we are in a while loop, value->data should also be freed */
                 num_elements = value->datalen / sizeof(mmi_primitive_value_h);
                 for (size_t i = 0; i < num_elements; i++) {
@@ -515,6 +540,7 @@ int mmi_primitive_value_from_bytes(unsigned char *bytes, size_t size, mmi_primit
                 free(value->data);
                 free(value);
                 return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
             }
 
             mmi_primitive_value_add_array_element(value, element);
@@ -528,8 +554,10 @@ int mmi_primitive_value_from_bytes(unsigned char *bytes, size_t size, mmi_primit
         current += sizeof(size_t);
         void *data = calloc(1, datalen);
         if (nullptr == data) {
+// LCOV_EXCL_START
             _E("[ERROR] Fail to allocate memory for data");
             return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
         }
         memcpy(data, current, datalen);
 
index a49903e0ffad9b514a3edbce6c526d757f2a6e3b..3906f5777b98f7ede62262df85036b6dd2bf5077 100644 (file)
@@ -61,7 +61,7 @@ MMI_API int mmi_signal_parameter_get_value(mmi_signal_parameter_h signal_paramet
 }
 
 MMI_API int mmi_signal_parameter_clone(mmi_signal_parameter_h signal_parameter, mmi_signal_parameter_h *cloned) {
-    if (cloned == NULL) {
+    if (signal_parameter == NULL || cloned == NULL) {
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
index 62eec0923fca508a7d5623c41ff9c59074ea01c8..8bcc6016a665df36e950e648e0bd32d4f466b638 100644 (file)
@@ -141,17 +141,14 @@ MMI_API int mmi_workflow_instance_activate(mmi_workflow_instance_h instance) {
     }
 
     std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
-    if (nullptr == channel) {
-        LOGE("[ERROR] Failed to get channel");
-        return MMI_ERROR_OPERATION_FAILED;
-    }
-
-    WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+    if (channel) {
+        WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
 
-    ClientMessageWorkflowInstanceActivate msg;
-    msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+        ClientMessageWorkflowInstanceActivate msg;
+        msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
 
-    channel->send(&msg);
+        channel->send(&msg);
+    }
 
     return MMI_ERROR_NONE;
 }
@@ -164,17 +161,14 @@ MMI_API int mmi_workflow_instance_deactivate(mmi_workflow_instance_h instance) {
     }
 
     std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
-    if (nullptr == channel) {
-        LOGE("[ERROR] Failed to get channel");
-        return MMI_ERROR_OPERATION_FAILED;
-    }
-
-    WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+    if (channel) {
+        WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
 
-    ClientMessageWorkflowInstanceDeactivate msg;
-    msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+        ClientMessageWorkflowInstanceDeactivate msg;
+        msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
 
-    channel->send(&msg);
+        channel->send(&msg);
+    }
 
     return MMI_ERROR_NONE;
 }
@@ -187,18 +181,15 @@ MMI_API int mmi_workflow_instance_set_attribute(mmi_workflow_instance_h instance
     }
 
     std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
-    if (nullptr == channel) {
-        LOGE("[ERROR] Failed to get channel");
-        return MMI_ERROR_OPERATION_FAILED;
-    }
-
-    WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+    if (channel) {
+        WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
 
-    ClientMessageWorkflowInstanceSetAttribute msg;
-    msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
-    msg.attribute = attribute;
+        ClientMessageWorkflowInstanceSetAttribute msg;
+        msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+        msg.attribute = attribute;
 
-    channel->send(&msg);
+        channel->send(&msg);
+    }
 
     return MMI_ERROR_NONE;
 }
@@ -210,18 +201,15 @@ MMI_API int mmi_workflow_instance_emit_signal(mmi_workflow_instance_h instance,
     }
 
     std::shared_ptr<CommunicationChannelClient> channel = g_mmi_client_manager.get_communication_channel();
-    if (nullptr == channel) {
-        LOGE("[ERROR] Failed to get channel");
-        return MMI_ERROR_OPERATION_FAILED;
-    }
-
-    WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+    if (channel) {
+        WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
 
-    ClientMessageWorkflowInstanceEmitSignal msg;
-    msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
-    msg.signal = signal;
+        ClientMessageWorkflowInstanceEmitSignal msg;
+        msg.local_workflow_instance_id = workflow_instance->get_local_workflow_instance_id();
+        msg.signal = signal;
 
-    channel->send(&msg);
+        channel->send(&msg);
+    }
 
     return MMI_ERROR_NONE;
 }
@@ -275,24 +263,19 @@ MMI_API int mmi_workflow_instance_set_output_cb(mmi_workflow_instance_h instance
 }
 // LCOV_EXCL_STOP
 
-MMI_API int mmi_workflow_instance_unset_output_cb(mmi_workflow_instance_h instance, const char *name, mmi_workflow_output_cb callback) {
+MMI_API int mmi_workflow_instance_unset_output_cb(mmi_workflow_instance_h instance, mmi_workflow_output_cb callback) {
     if (nullptr == instance) {
         LOGE("[ERROR] parameter is null");
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
-    if (nullptr == name) {
-        LOGE("[ERROR] parameter is null");
-        return MMI_ERROR_INVALID_PARAMETER;
-    }
-
     if (nullptr == callback) {
         LOGE("[ERROR] parameter is null");
         return MMI_ERROR_INVALID_PARAMETER;
     }
 
-    WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
-    workflow_instance->remove_output_callback(std::string{name}, callback);
+    //WorkflowInstance *workflow_instance = static_cast<WorkflowInstance*>(instance);
+    //workflow_instance->remove_output_callback(std::string{name}, callback);
 
     return MMI_ERROR_NONE;
 }
index c32f64b74e11f4974c73cce14424bdb5bb86b7db..16b18c82af84b8ecb91b9141ec7fc1b8a81522a9 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "magic_enum/magic_enum.hpp"
 
+// LCOV_EXCL_START
 class WorkflowScriptGenerator {
 public:
     WorkflowScriptGenerator() {
@@ -257,5 +258,6 @@ public:
 private:
     WorkflowScriptHelper m_workflow_script_helper;
 };
+// LCOV_EXCL_STOP
 
 #endif //__MMI_WORKFLOW_SCRIPT_GENERATOR_H__
index d4e296092d34556b57cf383c9448b4d9522d2775..2963c89046223cbb6d77e16d8bb23e3a5df4facd 100644 (file)
@@ -37,8 +37,10 @@ MMI_API int mmi_workflow_create(mmi_workflow_h *workflow) {
 
     mmi_workflow_s *workflow_s = new(std::nothrow) mmi_workflow_s;
     if (nullptr == workflow_s) {
+// LCOV_EXCL_START
         LOGE("[ERROR] Failed to create workflow");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     workflow_s->type = MMI_STANDARD_WORKFLOW_NONE;
@@ -108,6 +110,10 @@ MMI_API int mmi_workflow_node_add(mmi_workflow_h workflow, const char *node_name
 
 MMI_API int mmi_workflow_link_nodes_by_names(mmi_workflow_h workflow,
         const char *from_node_name, const char *from_port_name, const char *to_node_name, const char *to_port_name) {
+    if (nullptr == workflow) {
+        LOGE("[ERROR] parameter is null");
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
     if (nullptr == from_node_name || nullptr == from_port_name || nullptr == to_node_name || nullptr == to_port_name) {
         LOGE("[ERROR] parameter is null");
         return MMI_ERROR_INVALID_PARAMETER;
@@ -143,8 +149,10 @@ MMI_API int mmi_workflow_attribute_assign(mmi_workflow_h workflow, const char *a
     size_t attribute_assignment_info_count = workflow_s->attribute_assignment_info_count;
     workflow_s->attribute_assignment_infos = new(std::nothrow) mmi_workflow_attribute_assignment_info_s[attribute_assignment_info_count + 1];
     if (nullptr == workflow_s->attribute_assignment_infos) {
+// LCOV_EXCL_START
         LOGE("[ERROR] Failed to allocate memory");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
     if (attribute_assignment_info_count > 0) {
         memcpy(workflow_s->attribute_assignment_infos, attribute_assignment_infos, sizeof(mmi_workflow_attribute_assignment_info_s) * attribute_assignment_info_count);
@@ -160,7 +168,6 @@ MMI_API int mmi_workflow_attribute_assign(mmi_workflow_h workflow, const char *a
     return MMI_ERROR_NONE;
 }
 
-// LCOV_EXCL_START
 MMI_API int mmi_workflow_attribute_set_default_value(mmi_workflow_h workflow, mmi_attribute_h default_value) {
     if (nullptr == workflow || nullptr == default_value) {
         LOGE("[ERROR] parameter is null");
@@ -172,8 +179,10 @@ MMI_API int mmi_workflow_attribute_set_default_value(mmi_workflow_h workflow, mm
     size_t attribute_default_value_info_count = workflow_s->attribute_default_value_info_count;
     workflow_s->attribute_default_value_infos = new(std::nothrow) mmi_workflow_attribute_default_value_info_s[attribute_default_value_info_count + 1];
     if (nullptr == workflow_s->attribute_default_value_infos) {
+// LCOV_EXCL_START
         LOGE("[ERROR] Failed to allocate memory");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     if (attribute_default_value_info_count > 0) {
@@ -201,8 +210,10 @@ MMI_API int mmi_workflow_signal_assign(mmi_workflow_h workflow, const char *sign
     size_t signal_assignment_info_count = workflow_s->signal_assignment_info_count;
     workflow_s->signal_assignment_infos = new(std::nothrow) mmi_workflow_signal_assignment_info_s[signal_assignment_info_count + 1];
     if (nullptr == workflow_s->signal_assignment_infos) {
+// LCOV_EXCL_START
         LOGE("[ERROR] Failed to allocate memory");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     if (signal_assignment_info_count > 0) {
@@ -218,7 +229,6 @@ MMI_API int mmi_workflow_signal_assign(mmi_workflow_h workflow, const char *sign
 
     return MMI_ERROR_NONE;
 }
-// LCOV_EXCL_STOP
 
 MMI_API int mmi_workflow_output_assign(mmi_workflow_h workflow, const char *workflow_output, const char *out_node_name, const char *node_out_port_name) {
     if (nullptr == workflow || nullptr == workflow_output || nullptr == out_node_name || nullptr == node_out_port_name) {
@@ -290,8 +300,10 @@ MMI_API int mmi_standard_workflow_register(mmi_workflow_h workflow) {
     if (!duplicated) {
         list.workflows = new(std::nothrow) mmi_workflow_h[workflow_count + 1];
         if (nullptr == list.workflows) {
+// LCOV_EXCL_START
             LOGE("[ERROR] failed to allocate memory");
             return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
         }
         if (workflow_count > 0) {
             memcpy(list.workflows, workflows, sizeof(mmi_workflow_h) * workflow_count);
@@ -317,8 +329,10 @@ MMI_API int mmi_workflow_clone(mmi_workflow_h workflow, mmi_workflow_h *cloned)
 
     mmi_workflow_s *cloned_s = new(std::nothrow) mmi_workflow_s;
     if (nullptr == cloned_s) {
+// LCOV_EXCL_START
         LOGE("[ERROR] new mmi_workflow_s failed");
         return MMI_ERROR_OUT_OF_MEMORY;
+// LCOV_EXCL_STOP
     }
 
     mmi_workflow_s *workflow_s = static_cast<mmi_workflow_s *>(workflow);
index 70e8c139c220576778dbaacfa3a22244215c8392..f6a1b0787f7e6ed98d0394722d5e788ebc3a06b8 100644 (file)
@@ -66,15 +66,25 @@ ClientManager g_mmi_client_manager{
     &g_communication_channel_observer
 };
 
+static bool g_initialized = false;
+
 MMI_API int mmi_initialize() {
+    if (g_initialized) {
+        return MMI_ERROR_OPERATION_FAILED;
+    }
     LOGE("[SUCCESS] Succeeded to create client");
     g_mmi_client_manager.initialize();
+    g_initialized = true;
 
     return MMI_ERROR_NONE;
 }
 
 MMI_API int mmi_deinitialize() {
+    if (!g_initialized) {
+        return MMI_ERROR_OPERATION_FAILED;
+    }
     g_mmi_client_manager.deinitialize();
+    g_initialized = false;
 
     return MMI_ERROR_NONE;
 }
@@ -92,6 +102,10 @@ MMI_API int mmi_set_state_changed_cb(mmi_state_changed_cb callback, void *user_d
 }
 
 MMI_API int mmi_unset_state_changed_cb(mmi_state_changed_cb callback) {
+    if (callback == nullptr) {
+        return MMI_ERROR_INVALID_PARAMETER;
+    }
+
     auto it = std::find_if(g_state_changed_cb_list.begin(), g_state_changed_cb_list.end(),
     [callback](const std::pair<mmi_state_changed_cb, void*>& item) {
         return item.first == callback;
index 626449c4635dbb8e1c092a1345521b5ea5d1ad96..aa78ff6a5dcac450854a9b1f8513a847aed8502c 100644 (file)
@@ -50,6 +50,12 @@ public:
     mmi_data_h arrayElement[MAX_ARRAY_LENGTH] = {nullptr, };
 };
 
+TEST_F(MMIDataTest, MMIDataCreateDataByBool_p) {
+    constexpr bool sourceValue = true;
+    ASSERT_EQ(mmi_data_create_bool(sourceValue, &mmiData), MMI_ERROR_NONE);
+    ASSERT_NE(mmiData, nullptr);
+}
+
 TEST_F(MMIDataTest, MMIDataCreateDataByInt_p) {
     constexpr int sourceValue = 0;
     ASSERT_EQ(mmi_data_create_int(sourceValue, &mmiData), MMI_ERROR_NONE);
@@ -88,6 +94,21 @@ TEST_F(MMIDataTest, MMIDataCreateDataByAudio_n) {
     EXPECT_EQ(mmi_data_create_audio(sourceValue, DATA_LENGTH, nullptr), MMI_ERROR_INVALID_PARAMETER);
 }
 
+TEST_F(MMIDataTest, MMIDataCreateDataByVideo_p) {
+    constexpr size_t DATA_LENGTH = 10;
+    constexpr char sourceValue[DATA_LENGTH] = {1, };
+    ASSERT_EQ(mmi_data_create_video(sourceValue, DATA_LENGTH, &mmiData), MMI_ERROR_NONE);
+    ASSERT_NE(mmiData, nullptr);
+}
+
+TEST_F(MMIDataTest, MMIDataCreateDataByVideo_n) {
+    constexpr size_t DATA_LENGTH = 10;
+    constexpr char sourceValue[DATA_LENGTH] = {1, };
+    EXPECT_EQ(mmi_data_create_video(nullptr, DATA_LENGTH, &mmiData), MMI_ERROR_INVALID_PARAMETER);
+    EXPECT_EQ(mmi_data_create_video(sourceValue, 0, &mmiData), MMI_ERROR_INVALID_PARAMETER);
+    EXPECT_EQ(mmi_data_create_video(sourceValue, DATA_LENGTH, nullptr), MMI_ERROR_INVALID_PARAMETER);
+}
+
 TEST_F(MMIDataTest, MMIDataCreateDataByCoordinate_p) {
     constexpr int x = 123;
     constexpr int y = 456;
@@ -349,6 +370,42 @@ TEST_F(MMIDataTest, MMIDataGetTextValue_n2) {
     EXPECT_EQ(mmi_data_get_text(mmiData, &textInData), MMI_ERROR_INVALID_PARAMETER);
 }
 
+TEST_F(MMIDataTest, MMIDataGetAudioValue_p) {
+    constexpr size_t DATA_LENGTH = 10;
+    const char sourceValue[DATA_LENGTH] = {1, };
+    ASSERT_EQ(mmi_data_create_audio(sourceValue, DATA_LENGTH, &mmiData), MMI_ERROR_NONE);
+    ASSERT_NE(mmiData, nullptr);
+
+    size_t size;
+    const void *bytes = nullptr;
+    EXPECT_EQ(mmi_data_get_audio(mmiData, &bytes, &size), MMI_ERROR_NONE);
+    EXPECT_EQ(size, DATA_LENGTH);
+    EXPECT_EQ(*((unsigned char*)bytes), 1);
+}
+
+TEST_F(MMIDataTest, MMIDataGetAudioValue_n1) {
+    constexpr size_t DATA_LENGTH = 10;
+    const char sourceValue[DATA_LENGTH] = {1, };
+    ASSERT_EQ(mmi_data_create_audio(sourceValue, DATA_LENGTH, &mmiData), MMI_ERROR_NONE);
+    ASSERT_NE(mmiData, nullptr);
+
+    size_t size;
+    const void *bytes = nullptr;
+    EXPECT_EQ(mmi_data_get_audio(nullptr, &bytes, &size), MMI_ERROR_INVALID_PARAMETER);
+    EXPECT_EQ(mmi_data_get_audio(mmiData, nullptr, &size), MMI_ERROR_INVALID_PARAMETER);
+    EXPECT_EQ(mmi_data_get_audio(mmiData, &bytes, nullptr), MMI_ERROR_INVALID_PARAMETER);
+}
+
+TEST_F(MMIDataTest, MMIDataGetAudioValue_n2) {
+    constexpr int sourceInt = 1;
+    ASSERT_EQ(mmi_data_create_int(sourceInt, &mmiData), MMI_ERROR_NONE);
+    ASSERT_NE(mmiData, nullptr);
+
+    size_t size;
+    const void *bytes = nullptr;
+    EXPECT_EQ(mmi_data_get_audio(mmiData, &bytes, &size), MMI_ERROR_INVALID_PARAMETER);
+}
+
 TEST_F(MMIDataTest, MMIDataGetCoordinateValue_p) {
     constexpr int sourceX = 123;
     constexpr int sourceY = 456;