Tool for checking AT-SPI tree integrity v1.1 16/92316/3 accepted/tizen/3.0/common/20161114.110419 accepted/tizen/3.0/ivi/20161028.151220 accepted/tizen/3.0/mobile/20161028.143050 accepted/tizen/3.0/tv/20161028.143417 accepted/tizen/3.0/wearable/20161028.150754 accepted/tizen/common/20161019.145815 accepted/tizen/ivi/20161019.141810 accepted/tizen/mobile/20161019.141619 accepted/tizen/tv/20161019.141652 accepted/tizen/wearable/20161019.141734 submit/tizen/20161019.092255 submit/tizen_3.0/20161028.062323 submit/tizen_3.0/20161028.092423 submit/tizen_3.0_common/20161104.104000
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Fri, 14 Oct 2016 11:35:57 +0000 (13:35 +0200)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Fri, 14 Oct 2016 12:51:02 +0000 (14:51 +0200)
Change-Id: Id46b609f80f36b93bb7af938937e4893d51ac1d7

test/at_spi2_tool.c

index 1a951da..b47d432 100644 (file)
@@ -17,7 +17,7 @@
 #define DUMP 0
 #define CHECK 1
 #define FIRST_MATCH 2
-#define VERSION "1.02"
+#define VERSION "1.1"
 
 static unsigned indent_width = 2;
 static int module_name_limit = -1;
@@ -73,8 +73,8 @@ static const char* atspi_state_names[] = {
 };
 
 typedef struct _Box_Size {
-       int height;
-       int width;
+       char *height;
+       char *width;
 } Box_Size;
 
 char *_strdup(const char *c)
@@ -194,8 +194,14 @@ static Box_Size *_get_box_size(AtspiAccessible *node)
        if (box_size == NULL)
                return NULL;
 
-       box_size->width = -1;
-       box_size->height = -1;
+       char *width = NULL;
+       char *height = NULL;
+
+       _combine_strings(&width, "_");
+       _combine_strings(&height, "_");
+
+       box_size->width = width;
+       box_size->height = height;
 
        AtspiComponent *component = atspi_accessible_get_component_iface(node);
 
@@ -206,12 +212,23 @@ static Box_Size *_get_box_size(AtspiAccessible *node)
        if (extent == NULL)
                return box_size;
 
-       box_size->width = extent->width;
-       box_size->height = extent->height;
+       *width = '\0';
+       *height = '\0';
+
+       char temp_buff[NUMBER_WIDTH];
+
+       snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->width);
+       _combine_strings(&width, temp_buff);
+
+       snprintf(temp_buff, NUMBER_WIDTH, "%d", extent->height);
+       _combine_strings(&height, temp_buff);
 
        g_object_unref(component);
        g_free(extent);
 
+       box_size->width = width;
+       box_size->height = height;
+
        return box_size;
 }
 
@@ -280,7 +297,7 @@ static char *_get_info(AtspiAccessible *node, int length_limit)
        _truncate_string(states, length_limit);
 
        char result[SAFE_BUFFER_SIZE];
-       int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%d,%d],[%s],[%s]]",
+       int ret = snprintf(result, SAFE_BUFFER_SIZE, "[[%s],[%s],[%s,%s],[%s],[%s]]",
                                                                                node_role_name,
                                                                                attributes,
                                                                                box_size->width,
@@ -296,7 +313,11 @@ static char *_get_info(AtspiAccessible *node, int length_limit)
        free(node_name);
        free(node_role_name);
        free(attributes);
-       free(box_size);
+       if (box_size) {
+               free(box_size->width);
+               free(box_size->height);
+               free(box_size);
+       }
        free(states);
 
        return _strdup(result);