[at-spi2-atk/gnome-3-24] Fix Position getter for table cells



commit e63f778182a74656d2a1305e6e97abe9552d72a9
Author: Mike Gorse <mgorse suse com>
Date:   Fri Mar 24 15:04:21 2017 -0500

    Fix Position getter for table cells

 atk-adaptor/adaptors/table-cell-adaptor.c |    4 ++--
 tests/atk_test_table_cell.c               |   24 ++++++++++++++++++++++++
 tests/dummyatk/my-atk-table-cell.c        |    2 +-
 3 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/atk-adaptor/adaptors/table-cell-adaptor.c b/atk-adaptor/adaptors/table-cell-adaptor.c
index 3418f4c..330c633 100644
--- a/atk-adaptor/adaptors/table-cell-adaptor.c
+++ b/atk-adaptor/adaptors/table-cell-adaptor.c
@@ -114,8 +114,8 @@ impl_get_Position (DBusMessageIter * iter, void *user_data)
 
   d_row = row;
   d_column = column;
-  dbus_message_iter_open_container (iter, DBUS_TYPE_STRUCT, "(ii)", &iter_variant);
-  dbus_message_iter_open_container (&iter_struct, DBUS_TYPE_STRUCT, NULL, &iter_struct);
+  dbus_message_iter_open_container (iter, DBUS_TYPE_VARIANT, "(ii)", &iter_variant);
+  dbus_message_iter_open_container (&iter_variant, DBUS_TYPE_STRUCT, NULL, &iter_struct);
   dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &row);
   dbus_message_iter_append_basic (&iter_struct, DBUS_TYPE_INT32, &column);
   dbus_message_iter_close_container (&iter_variant, &iter_struct);
diff --git a/tests/atk_test_table_cell.c b/tests/atk_test_table_cell.c
index 082ce1d..6b629b8 100644
--- a/tests/atk_test_table_cell.c
+++ b/tests/atk_test_table_cell.c
@@ -140,6 +140,28 @@ atk_test_table_cell_get_row_column_span (gpointer fixture, gconstpointer user_da
 }
 
 static void
+atk_test_table_cell_get_position (gpointer fixture, gconstpointer user_data)
+{
+  AtspiAccessible *_obj = get_root_obj (DATA_FILE);
+  g_assert (_obj);
+  AtspiAccessible *child = atspi_accessible_get_child_at_index (_obj, 0, NULL);
+  g_assert (child);
+
+  AtspiAccessible *cell = atspi_accessible_get_child_at_index (child, 9, NULL);
+  AtspiTableCell *obj = atspi_accessible_get_table_cell (cell);
+  g_assert (cell);
+
+  gint row = 10;
+  gint column = 10;
+
+  atspi_table_cell_get_position (obj, &row, &column, NULL);
+
+  /* TODO: not a very good test for the app to return (-1, -1) */
+  g_assert_cmpint (row, ==, -1);
+  g_assert_cmpint (column, ==, -1);
+}
+
+static void
 atk_test_table_cell_get_table (gpointer fixture, gconstpointer user_data)
 {
   AtspiAccessible *_obj = get_root_obj (DATA_FILE);
@@ -181,6 +203,8 @@ atk_test_table_cell (void)
   */
   g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_row_column_span",
                      0, NULL, NULL, atk_test_table_cell_get_row_column_span, teardown_table_cell_test);
+  g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_position",
+                     0, NULL, NULL, atk_test_table_cell_get_position, teardown_table_cell_test);
   g_test_add_vtable (ATK_TEST_PATH_TABLE_CELL "/atk_test_table_cell_get_table",
                      0, NULL, NULL, atk_test_table_cell_get_table, teardown_table_cell_test);
 
diff --git a/tests/dummyatk/my-atk-table-cell.c b/tests/dummyatk/my-atk-table-cell.c
index 2d1c568..b22eaf5 100644
--- a/tests/dummyatk/my-atk-table-cell.c
+++ b/tests/dummyatk/my-atk-table-cell.c
@@ -134,7 +134,7 @@ my_atk_tablecell_get_position (AtkTableCell *obj, gint *row , gint *column)
   *row = self->xy[0];
   *column = self->xy[1];
 
-  return FALSE;
+  return TRUE;
 }
 
 static GPtrArray *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]