Merge "test : enhance accessible state information" into tizen_4.0 tizen_4.0_tv accepted/tizen/4.0/unified/20171023.120324 submit/tizen/20171025.103743 submit/tizen_4.0/20171020.125844 tizen_4.0.IoT.p2_release tizen_4.0.m2_release
authorJunsuChoi <jsuya.choi@samsung.com>
Wed, 18 Oct 2017 09:13:21 +0000 (09:13 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Wed, 18 Oct 2017 09:13:21 +0000 (09:13 +0000)
1  2 
test/at_spi2_tool.c

diff --combined test/at_spi2_tool.c
@@@ -6,7 -6,6 +6,7 @@@
  #include <stdbool.h>
  #include <gio/gio.h>
  #include <assert.h>
 +#include <stdint.h>
  
  #define ERROR_STATE -1
  #define SAFE_BUFFER_SIZE 2048
@@@ -250,8 -249,11 +250,11 @@@ static char *_get_states(AtspiAccessibl
        for (int i = 0; i < states->len; i++) {
                state_type = g_array_index(states, AtspiStateType, i);
  
-               char node_state_str[8];
-               snprintf(node_state_str, 8, "(%d)", state_type);
+               char node_state_str[27] = "";
+               strncat(node_state_str, "(", sizeof(node_state_str) - strlen(node_state_str) - 1);
+               strncat(node_state_str, atspi_state_names[state_type], sizeof(node_state_str) - strlen(node_state_str) - 1);
+               strncat(node_state_str, ")", sizeof(node_state_str) - strlen(node_state_str) - 1);
                _combine_strings(&state_string, node_state_str);
        }
  
@@@ -301,9 -303,6 +304,9 @@@ static char *_get_info(AtspiAccessible 
        char *node_name = atspi_accessible_get_name(node, NULL);
        char *node_role_name = atspi_accessible_get_role_name(node, NULL);
        char *unique_id = atspi_accessible_get_unique_id(node, NULL);
 +      char *path = atspi_accessible_get_path(node, NULL);
 +      unsigned long long eo_ptr = 0;
 +      sscanf(path, "%llu", &eo_ptr);
  
        char *attributes = _get_attributes(node, length_limit, attributes_are_too_long);
        Box_Size *box_size = _get_box_size(node);
        bool current_node_has_relations = (relations && relations->len);
  
        char result[SAFE_BUFFER_SIZE];
 -      int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%s],[%s,%s,%s,%s],[%s],[%s],[%s]]",
 -                                              unique_id,
 +      int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s(%p)],[%s],[%s],[%s,%s,%s,%s],[%s],[%s],[%s]]",
 +                                              unique_id, (uintptr_t)eo_ptr,
                                                node_role_name,
                                                attributes,
                                                box_size->x,
        free(node_name);
        free(node_role_name);
        free(unique_id);
 +      free(path);
        free(attributes);
        if (box_size) {
                free(box_size->width);