Update coverage for voice touch 95/120295/2
authorWonnam Jang <wn.jang@samsung.com>
Wed, 22 Mar 2017 08:33:24 +0000 (17:33 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Thu, 23 Mar 2017 01:43:41 +0000 (10:43 +0900)
Change-Id: Ia42851acdc60b20717816995da3edf0c2bd2a3a3
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
src/vc_elm_efl_dump.c

index 03d4e4b79032ba1d5885663841b65d84bb6dfc7b..c4f6b364170c49bf0961e9a47e1b08745f50076b 100644 (file)
 #include "vc_elm_tools.h"
 #include "vc_elm_efl_dump.h"
 
+#define EVAS_OBJECT_DUMP_DEBUG
+#ifdef EVAS_OBJECT_DUMP_DEBUG
+#define VC_ELM_LOG_DUMP(fmt, ...) SLOGD("\033[0;32m" fmt "\033[m", ## __VA_ARGS__)
+#else
+#define VC_ELM_LOG_DUMP(fmt, ...) 
+#endif
+
 typedef struct _Ea_Util_Mgr {
        Evas *evas;
        FILE *fp;
@@ -40,7 +47,7 @@ typedef struct _Edje_Info {
 } Edje_Info;
 
 #define SPANS_COMMON(x1, w1, x2, w2) \
-       (!(((int)((x2) + (int)(w2)) <= (int)(x1)) || (int)((x2) >= (int)((x1) + (int)(w1)))))
+       (!(((int)((x2) + (int)(w2)) < (int)(x1)) || (int)((x2) > (int)((x1) + (int)(w1)))))
 
 #define RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
        ((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
@@ -53,6 +60,17 @@ static int g_geo_x = 0, g_geo_y = 0, g_geo_w = 0, g_geo_h = 0;
 static int find_popup = 0;
 static int skip_text = 0;
 
+bool vc_elm_efl_dump_is_vt_auto_enabled()
+{
+       bool is_vt_automode = false;
+       int ret = vc_elm_is_supported_vt_auto(&is_vt_automode);
+       if (0 != ret) {
+               VC_ELM_LOG_DUMP("Fail to check vt auto mode");
+       }
+
+       return is_vt_automode;
+}
+
 static Eina_Bool
 evas_object_is_visible_get(Evas_Object *obj)
 {
@@ -308,8 +326,49 @@ next:
        }
 }
 
+static Eina_Bool _is_clickable_object(Evas_Object *obj)
+{
+       if (!strcmp(evas_object_type_get(obj), "elm_win") || !strcmp(evas_object_type_get(obj), "elm_naviframe") || !strcmp(evas_object_type_get(obj), "elm_label")
+               || !strcmp(evas_object_type_get(obj), "elm_ctxpopup") || !strcmp(evas_object_type_get(obj), "elm_popup")) {
+               VC_ELM_LOG_DUMP("Not clickable object(%s)", evas_object_type_get(obj));
+               return EINA_FALSE;
+       }
+
+       return EINA_TRUE;
+}
+
+static Eina_Bool _is_descendant_of_list(Object_Info *object_info)
+{
+       Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
+       while (NULL != parent_info) {
+               const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+               if (NULL != widget_type) {
+                       VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type);
+                       if (!strcmp(widget_type, "Elm_Genlist") || !strcmp(widget_type, "Elm_Gengrid") || !strcmp(widget_type, "Elm_List") || !strcmp(widget_type, "Elm_Ctxpopup") || !strcmp(widget_type, "Elm_Index"))
+                               return EINA_TRUE;
+               }
+               parent_info = ea_object_dump_parent_widget_data_get(parent_info);
+       }
+       return EINA_FALSE;
+}
+
+static Eina_Bool _is_descendant_of_toolbar(Object_Info *object_info)
+{
+       Object_Info* parent_info = ea_object_dump_parent_widget_data_get(object_info);
+       while (NULL != parent_info) {
+               const char* widget_type = elm_widget_type_get((Evas_Object*)(parent_info->address));
+               if (NULL != widget_type) {
+                       VC_ELM_LOG_DUMP("[DEBUG] object_type(%s), widget_type(%s)", evas_object_type_get((Evas_Object*)(parent_info->address)), widget_type);
+                       if (!strcmp(widget_type, "Elm_Toolbar"))
+                               return EINA_TRUE;
+               }
+               parent_info = ea_object_dump_parent_widget_data_get(parent_info);
+       }
+       return EINA_FALSE;
+}
+
 static void
-_obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable, Eina_Bool list_type)
+_obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj, Object_Info *parent, Eina_Bool parent_widget_focusable, Eina_Bool list_type, int cnt)
 {
        Eina_List *children = NULL, *l = NULL;
        Evas_Object *child, *smart_parent_obj = NULL;
@@ -323,30 +382,51 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
        Object_Info *object_info = NULL;
        char* temp = NULL;
 
+       VC_ELM_LOG_DUMP("[%d] Object(%s), text(%s)(%s)", cnt, evas_object_type_get(obj), (!evas_object_text_text_get(obj)) ? " " : evas_object_text_text_get(obj), !elm_atspi_accessible_name_get(obj) ? " " : elm_atspi_accessible_name_get(obj));
+
        // visible check
-       if (!evas_object_is_visible_get(obj)) return;
+       if (!evas_object_is_visible_get(obj)) {
+               VC_ELM_LOG_DUMP("   [%d] Object(%s) : Invisible)", cnt, evas_object_type_get(obj));
+               return;
+       }
 
-       if (evas_object_type_match(obj, "elm_popup")) {
+       if (evas_object_type_match(obj, "elm_popup") || evas_object_type_match(obj, "elm_ctxpopup")) {
                if (elm_object_part_text_get(obj, "title,text")) skip_text = 1;
                eina_list_free(ret_list);
+               ret_list = NULL;
                find_popup = 0;
        }
 
-       if (find_popup) return;
+       if (find_popup) {
+               VC_ELM_LOG_DUMP("   [%d] Object(%s) : Find_popup", cnt, evas_object_type_get(obj));
+               return;
+       }
 
        // viewport check
        evas_object_geometry_get(obj, &x, &y, &w, &h);
 
-       if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) return;
+       if (!RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h)) {
+               VC_ELM_LOG_DUMP("## x(%d), y(%d), w(%d), h(%d), util_mgr->x(%d), util_mgr->y(%d), util_mgr->w(%d), util_mgr->h(%d)", x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h);
+               VC_ELM_LOG_DUMP("## RECTS_INTERSECT(%d), SPANS_COMMON_X(%d), SPANS_COMMON_Y(%d)", RECTS_INTERSECT(x, y, w, h, util_mgr->x, util_mgr->y, util_mgr->w, util_mgr->h),
+                       SPANS_COMMON(x, w, util_mgr->x, util_mgr->w), SPANS_COMMON(y, h, util_mgr->y, util_mgr->h));
+               return;
+       }
 
        // clipper check
        if (evas_object_clipees_get(obj)) is_clip = EINA_TRUE;
-       if (is_clip) goto next;
+       if (is_clip) {
+               VC_ELM_LOG_DUMP("is_clip(%d)", is_clip);
+               goto next;
+       }
 
        if (!strcmp(evas_object_type_get(obj), "text") || !strcmp(evas_object_type_get(obj), "textblock")) {
-               if (!parent_widget_focusable && !list_type) goto next;
+               if (!parent_widget_focusable && !list_type) {
+                       VC_ELM_LOG_DUMP("## parent_widget_focusable(%d), list_type(%d)", parent_widget_focusable, list_type);
+                       goto next;
+               }
                if (skip_text) {
                        skip_text = 0;
+                       VC_ELM_LOG_DUMP("   [%d] Object(%s) : Skip_text", cnt, evas_object_type_get(obj));
                        return;
                }
        }
@@ -377,7 +457,7 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
                }
        }
        if (!list_type) {
-           if (evas_object_type_match(obj, "elm_genlist") || evas_object_type_match(obj, "elm_gengrid") || evas_object_type_match(obj, "elm_list"))
+           if (evas_object_type_match(obj, "elm_genlist") || evas_object_type_match(obj, "elm_gengrid") || evas_object_type_match(obj, "elm_list") || evas_object_type_match(obj, "elm_ctxpopup") || evas_object_type_match(obj, "elm_index"))
              list_type = EINA_TRUE;
         }
 
@@ -455,31 +535,56 @@ _obj_tree_items_exclude_unfocusable_text(Ea_Util_Mgr *util_mgr, Evas_Object *obj
        }
 
        text = NULL;
-       if (!strcmp(evas_object_type_get(obj), "text"))
-               text = eina_stringshare_add(evas_object_text_text_get(obj));
-       else if (!strcmp(evas_object_type_get(obj), "textblock")) {
-               ret = evas_object_textblock_text_markup_get(obj);
-               temp = evas_textblock_text_markup_to_utf8(obj, ret);
-               text = eina_stringshare_add(temp);
-
-               if (NULL != temp) {
-                       free(temp);
-                       temp = NULL;
+       if (false == vc_elm_efl_dump_is_vt_auto_enabled()) {
+               if (!strcmp(evas_object_type_get(obj), "text"))
+                       text = eina_stringshare_add(evas_object_text_text_get(obj));
+               else if (!strcmp(evas_object_type_get(obj), "textblock")) {
+                       ret = evas_object_textblock_text_markup_get(obj);
+                       temp = evas_textblock_text_markup_to_utf8(obj, ret);
+                       text = eina_stringshare_add(temp);
+
+                       if (NULL != temp) {
+                               free(temp);
+                               temp = NULL;
+                       }
+               }
+       } else {
+               if (!strcmp(evas_object_type_get(obj), "text") && EINA_TRUE == _is_descendant_of_list(object_info)) {
+                       text = eina_stringshare_add(evas_object_text_text_get(obj));
+                       VC_ELM_LOG_DUMP("####### [DEBUG] text(%s), atspi_text(%s)", text, elm_atspi_accessible_name_get(obj));
+               } else if (!strcmp(evas_object_type_get(obj), "textblock") && EINA_TRUE == _is_descendant_of_list(object_info)) {
+                       ret = evas_object_textblock_text_markup_get(obj);
+                       temp = evas_textblock_text_markup_to_utf8(obj, ret);
+                       text = eina_stringshare_add(temp);
+
+                       if (NULL != temp) {
+                               free(temp);
+                               temp = NULL;
+                       }
+                       VC_ELM_LOG_DUMP("####### [DEBUG] textblock(%s), atspi_text(%s)", text, elm_atspi_accessible_name_get(obj));
+               } else if (elm_atspi_accessible_name_get(obj) && EINA_TRUE == object_info->focusable && EINA_TRUE == _is_clickable_object(obj)) {
+                       text = elm_atspi_accessible_name_get(obj);
+                       VC_ELM_LOG_DUMP("####### [DEBUG] atspi_text(%s)", text);
+               } else if (elm_atspi_accessible_name_get(obj) && !strcmp(evas_object_type_get(obj), "elm_layout") && EINA_TRUE == _is_descendant_of_toolbar(object_info)) {
+                       text = elm_atspi_accessible_name_get(obj);
+                       VC_ELM_LOG_DUMP("####### [DEBUG] toolbar(%s)", text);
                }
        }
        if (text && strlen(text) > 0) {
                object_info->text = calloc(1, strlen(text) + 1);
                strncpy(object_info->text, text, strlen(text) + 1);
+
+               ret_list = eina_list_append(ret_list, object_info);
        }
 
-       ret_list = eina_list_append(ret_list, object_info);
 next:
        if (!evas_object_type_match(obj, "rectangle") && !evas_object_type_match(obj, "text") && !evas_object_type_match(obj, "image")) {
                children = evas_object_smart_members_get(obj);
                EINA_LIST_FREE(children, child)
-                       _obj_tree_items_exclude_unfocusable_text(util_mgr, child, object_info, parent_widget_focusable, list_type);
-               if (evas_object_type_match(obj, "elm_popup")) find_popup = 1;
+                       _obj_tree_items_exclude_unfocusable_text(util_mgr, child, object_info, parent_widget_focusable, list_type, cnt + 1);
+               if (evas_object_type_match(obj, "elm_popup") || evas_object_type_match(obj, "elm_ctxpopup")) find_popup = 1;
        }
+       VC_ELM_LOG_DUMP("   [%d] %s : return", cnt, evas_object_type_get(obj));
 }
 
 static void
@@ -613,8 +718,10 @@ _object_tree(Ea_Util_Mgr *util_mgr, int val, Eina_Bool exclude_unfocusable_text)
 
        if (val == 1) {
                if (exclude_unfocusable_text) {
-                       EINA_LIST_FREE(objs, obj)
-                               _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE, EINA_FALSE);
+                       EINA_LIST_FREE(objs, obj) {
+                               VC_ELM_LOG_DUMP("###################### start ########################");
+                               _obj_tree_items_exclude_unfocusable_text(util_mgr, obj, NULL, EINA_FALSE, EINA_FALSE, 0);
+                       }
                } else {
                        EINA_LIST_FREE(objs, obj)
                                _obj_tree_items(util_mgr, obj, NULL);