Improves code coverage 94/299194/1
authorInkyun Kil <inkyun.kil@samsung.com>
Thu, 21 Sep 2023 09:26:08 +0000 (18:26 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Thu, 21 Sep 2023 09:26:31 +0000 (18:26 +0900)
Change-Id: Ic87e3290061b818e91c7273576f8cb1eb54270fe
Signed-off-by: Inkyun Kil <inkyun.kil@samsung.com>
widget_viewer_evas/src/widget_viewer_evas.c
widget_viewer_evas/src/widget_viewer_image.c

index 696ca73e8b8fc30b1b28cec3e4cffab30e4c4f36..d59a9b6b952cacdc4282361783108fdc53c31f3c 100644 (file)
@@ -539,6 +539,7 @@ static void __create_preview_image(Evas_Object *layout, char *widget_id)
        free(preview_path);
 }
 
+/* LCOV_EXCL_START */
 static void __screen_connector_toolkit_evas_removed_cb(const char *appid, const char *instance_id, int pid,
        Evas_Object *image, void *data)
 {
@@ -575,7 +576,6 @@ static void __screen_connector_toolkit_evas_removed_cb(const char *appid, const
        __smart_callback_call(info->layout, WIDGET_SMART_SIGNAL_WIDGET_DELETED, &event_info);
 }
 
-/* LCOV_EXCL_START */
 static void __screen_connector_toolkit_evas_updated_cb(const char *appid, const char *instance_id, int pid,
        Evas_Object *image, void *data)
 {
@@ -1086,6 +1086,7 @@ static void __flush_event_queue(struct widget_info *info)
        info->event_queue = NULL;
 }
 
+/* LCOV_EXCL_START */
 static void __aul_widget_event_cb(const char *event_name,
                bundle *event_data,
                void *user_data)
@@ -1134,6 +1135,7 @@ static void __aul_widget_event_cb(const char *event_name,
        free(id);
        pthread_mutex_unlock(&__mutex);
 }
+/* LCOV_EXCL_STOP */
 
 API int widget_viewer_evas_init(Evas_Object *win)
 {
@@ -1312,7 +1314,7 @@ API int widget_viewer_evas_notify_paused_status_of_viewer(void)
                LOGE("widget viewer evas is not initialized");
                return WIDGET_ERROR_FAULT;
        }
-
+/* LCOV_EXCL_START */
        if (__check_privilege(WIDGET_PRIVILEGE) < 0)
                return WIDGET_ERROR_PERMISSION_DENIED;
 
@@ -1336,6 +1338,7 @@ API int widget_viewer_evas_notify_paused_status_of_viewer(void)
        pthread_mutex_unlock(&__mutex);
 
        return WIDGET_ERROR_NONE;
+/* LCOV_EXCL_STOP */
 }
 
 API int widget_viewer_evas_notify_orientation_of_viewer(int orientation)
@@ -1624,13 +1627,13 @@ API Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char *
        if (!__is_widget_feature_enabled()) {
                LOGE("widget is not supported");/* LCOV_EXCL_LINE */
                set_last_result(WIDGET_ERROR_NOT_SUPPORTED);/* LCOV_EXCL_LINE */
-               return NULL;
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        if (__check_privilege(WIDGET_PRIVILEGE) < 0) {
                LOGE("Permission deny");/* LCOV_EXCL_LINE */
                set_last_result(WIDGET_ERROR_PERMISSION_DENIED);/* LCOV_EXCL_LINE */
-               return NULL;
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        if (!widget_id) {
@@ -1640,22 +1643,22 @@ API Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char *
        }
 
        if (!parent) {
-               set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
-               LOGE("parent(window) object is invalid");
-               return NULL;
+               set_last_result(WIDGET_ERROR_INVALID_PARAMETER);/* LCOV_EXCL_LINE */
+               LOGE("parent(window) object is invalid");/* LCOV_EXCL_LINE */
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        pthread_mutex_lock(&__mutex);
        if (s_info.widget_table == NULL || s_info.instance_cnt_table == NULL) {
-               LOGE("table is NULL");
-               pthread_mutex_unlock(&__mutex);
-               return NULL;
+               LOGE("table is NULL");/* LCOV_EXCL_LINE */
+               pthread_mutex_unlock(&__mutex);/* LCOV_EXCL_LINE */
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        max_instance_cnt = widget_service_get_widget_max_count(widget_id);
        if (max_instance_cnt < 0) {
-               set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
-               LOGE("get widget max instance count fail");/* LCOV_EXCL_LINE */
+               set_last_result(WIDGET_ERROR_FAULT);
+               LOGE("get widget max instance count fail");
                pthread_mutex_unlock(&__mutex);
                return NULL;
        }
@@ -1664,10 +1667,10 @@ API Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char *
        if (cur_instance_cnt == NULL) {
                cur_instance_cnt = (int *)calloc(1, sizeof(int));
                if (cur_instance_cnt == NULL) {
-                       LOGE("Fail to calloc instance cnt");
-                       set_last_result(WIDGET_ERROR_FAULT);
-                       pthread_mutex_unlock(&__mutex);
-                       return NULL;
+                       LOGE("Fail to calloc instance cnt");/* LCOV_EXCL_LINE */
+                       set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+                       pthread_mutex_unlock(&__mutex);/* LCOV_EXCL_LINE */
+                       return NULL;/* LCOV_EXCL_LINE */
                }
                *cur_instance_cnt = 0;
                g_hash_table_insert(s_info.instance_cnt_table, strdup(widget_id), cur_instance_cnt);
@@ -1681,23 +1684,23 @@ API Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char *
        }
 
        if (!s_info.initialized) {
-               set_last_result(WIDGET_ERROR_FAULT);
-               LOGE("Widget viewer evas is not initialized");
-               pthread_mutex_unlock(&__mutex);
-               return NULL;
+               set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+               LOGE("Widget viewer evas is not initialized");/* LCOV_EXCL_LINE */
+               pthread_mutex_unlock(&__mutex);/* LCOV_EXCL_LINE */
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        if (widget_instance_create(widget_id, &instance_id) < 0) {
                set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
-               pthread_mutex_unlock(&__mutex);
-               return NULL;
+               pthread_mutex_unlock(&__mutex);/* LCOV_EXCL_LINE */
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        if (!instance_id) {
-               set_last_result(WIDGET_ERROR_FAULT);
-               LOGE("Failed to get instance_id: %s", widget_id);
-               pthread_mutex_unlock(&__mutex);
-               return NULL;
+               set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
+               LOGE("Failed to get instance_id: %s", widget_id);/* LCOV_EXCL_LINE */
+               pthread_mutex_unlock(&__mutex);/* LCOV_EXCL_LINE */
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        widget_instance_info = create_info(parent, widget_id, instance_id, content_info);
@@ -1705,8 +1708,8 @@ API Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char *
                set_last_result(WIDGET_ERROR_FAULT);/* LCOV_EXCL_LINE */
                LOGE("Unable to create an information object");/* LCOV_EXCL_LINE */
                widget_instance_destroy(instance_id);/* LCOV_EXCL_LINE */
-               pthread_mutex_unlock(&__mutex);
-               return NULL;
+               pthread_mutex_unlock(&__mutex);/* LCOV_EXCL_LINE */
+               return NULL;/* LCOV_EXCL_LINE */
        }
 
        if (content_info)
@@ -1789,15 +1792,15 @@ API int widget_viewer_evas_pause_widget(Evas_Object *widget)
        }
 
        if (info->visibility_freeze) {
-               LOGE("widget(%p) is freezing visibility(%d)", widget, info->visibility_freeze);
-               return WIDGET_ERROR_DISABLED;
+               LOGE("widget(%p) is freezing visibility(%d)", widget, info->visibility_freeze);/* LCOV_EXCL_LINE */
+               return WIDGET_ERROR_DISABLED;/* LCOV_EXCL_LINE */
        }
 
        if (info->is_created) {
-               ret = __instance_pause(info);
-               if (ret < 0) {
-                       LOGE("Fail to pause the widget(%p):(%d)", widget, ret);
-                       return ret;
+               ret = __instance_pause(info);/* LCOV_EXCL_LINE */
+               if (ret < 0) {/* LCOV_EXCL_LINE */
+                       LOGE("Fail to pause the widget(%p):(%d)", widget, ret);/* LCOV_EXCL_LINE */
+                       return ret;/* LCOV_EXCL_LINE */
                }
        } else {
                item = __create_pending_item("pause", 0, 0);
@@ -1828,11 +1831,11 @@ API int widget_viewer_evas_resume_widget(Evas_Object *widget)
                LOGE("widget object is invalid");
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
-
+/* LCOV_EXCL_START */
        info = evas_object_data_get(widget, WIDGET_INFO_TAG);
        if (!info) {
-               LOGE("widget(%p) don't have the info", widget);/* LCOV_EXCL_LINE */
-               return WIDGET_ERROR_INVALID_PARAMETER;/* LCOV_EXCL_LINE */
+               LOGE("widget(%p) don't have the info", widget);
+               return WIDGET_ERROR_INVALID_PARAMETER;
        }
 
        if (info->visibility_freeze) {
@@ -1852,6 +1855,7 @@ API int widget_viewer_evas_resume_widget(Evas_Object *widget)
        }
 
        return WIDGET_ERROR_NONE;
+/* LCOV_EXCL_STOP */
 }
 
 API const char *widget_viewer_evas_get_content_info(Evas_Object *widget)
@@ -2344,7 +2348,7 @@ API int widget_viewer_evas_freeze_visibility(Evas_Object *widget, widget_visibil
                LOGE("widget(%p) don't have the info", widget);
                return WIDGET_ERROR_INVALID_PARAMETER;
        }
-
+/* LCOV_EXCL_START */
        tbm_obj = elm_object_part_content_get(widget, "tbm,widget");
        if (!tbm_obj) {
                LOGE("widget object is invalid\n");/* LCOV_EXCL_LINE */
@@ -2372,6 +2376,7 @@ API int widget_viewer_evas_freeze_visibility(Evas_Object *widget, widget_visibil
        }
 
        return WIDGET_ERROR_NONE;
+/* LCOV_EXCL_STOP */
 }
 
 API int widget_viewer_evas_thaw_visibility(Evas_Object *widget)
@@ -2567,6 +2572,7 @@ API const char *widget_viewer_evas_get_widget_instance_id(Evas_Object *widget)
        return (const char *)info->instance_id;
 }
 
+/* LCOV_EXCL_START */
 API int widget_viewer_evas_set_delayed_resuming_time(int time)
 {
        if (time < 0 || time > 10000)
@@ -2616,5 +2622,5 @@ API int widget_viewer_evas_launch_setup_app(Evas_Object *widget)
 
        return WIDGET_ERROR_NONE;
 }
-
+/* LCOV_EXCL_STOP */
 /* End of a file */
index 334b442b8d16bd42edffd769bb7093c49a8916cd..3c8620b9043f8c803966df062c536adc4f876ff8 100644 (file)
@@ -28,7 +28,7 @@
 #include "widget_viewer_image.h"
 
 #define PATH_RUN_AUL_DUMP "/run/aul/dump"
-
+/* LCOV_EXCL_START */
 static const char *__get_path(void)
 {
        static char path[1024] = { 0, };
@@ -141,3 +141,4 @@ int _widget_viewer_image_save(Evas_Object *image,
 
        return 0;
 }
+/* LCOV_EXCL_STOP */
\ No newline at end of file