static Eo *_atspi_root;
static int _init;
+typedef struct _Elm_Atspi_App_Object_Data Elm_Atspi_App_Object_Data;
+
+struct _Elm_Atspi_App_Object_Data
+{
+ const char *descr;
+};
+
+EOLIAN static void
+_elm_atspi_app_object_eo_base_destructor(Eo *obj EINA_UNUSED, Elm_Atspi_App_Object_Data *_pd)
+{
+ if (_pd->descr) eina_stringshare_del(_pd->descr);
+}
+
EOLIAN static Eina_List*
-_elm_atspi_app_object_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
+_elm_atspi_app_object_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Atspi_App_Object_Data *_pd EINA_UNUSED)
{
Eina_List *l, *accs = NULL;
Evas_Object *win;
}
EOLIAN static const char*
-_elm_atspi_app_object_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
+_elm_atspi_app_object_elm_interface_atspi_accessible_name_get(Eo *obj EINA_UNUSED, Elm_Atspi_App_Object_Data *_pd EINA_UNUSED)
{
return elm_app_name_get();
}
EOLIAN static const char*
-_elm_atspi_app_object_elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
+_elm_atspi_app_object_elm_interface_atspi_accessible_description_get(Eo *obj EINA_UNUSED, Elm_Atspi_App_Object_Data *_pd)
+{
+ return _pd->descr;
+}
+
+EOLIAN static void
+_elm_atspi_app_object_elm_interface_atspi_accessible_description_set(Eo *obj EINA_UNUSED, Elm_Atspi_App_Object_Data *_pd EINA_UNUSED, const char *descr)
{
- return NULL;
+ eina_stringshare_replace(&_pd->descr, descr);
}
EOLIAN static Elm_Atspi_Role
-_elm_atspi_app_object_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED)
+_elm_atspi_app_object_elm_interface_atspi_accessible_role_get(Eo *obj EINA_UNUSED, Elm_Atspi_App_Object_Data *_pd EINA_UNUSED)
{
return ELM_ATSPI_ROLE_APPLICATION;
}
class Elm_Atspi_App_Object (Eo_Base, Elm_Interface_Atspi_Accessible)
{
- data: null;
+ data: Elm_Atspi_App_Object_Data;
implements {
+ Eo_Base::destructor;
Elm_Interface_Atspi_Accessible::name::get;
Elm_Interface_Atspi_Accessible::description::get;
+ Elm_Interface_Atspi_Accessible::description::set;
Elm_Interface_Atspi_Accessible::role::get;
Elm_Interface_Atspi_Accessible::children::get;
}
return ret;
}
+static Eldbus_Message *
+_accessible_attributes_get(const Eldbus_Service_Interface *iface, const Eldbus_Message *msg)
+{
+ Eina_List *attrs, *l;
+ Elm_Atspi_Attribute *attr;
+ Eldbus_Message_Iter *iter, *iter_array;
+
+ Eldbus_Message *ret = eldbus_message_method_return_new(msg);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
+
+ const char *obj_path = eldbus_service_object_path_get(iface);
+ Eo *obj = _access_object_from_path(obj_path);
+
+ eo_do(obj, attrs = elm_interface_atspi_accessible_attributes_get());
+
+ iter = eldbus_message_iter_get(ret);
+ iter_array = eldbus_message_iter_container_new(iter, 'a', "ss");
+
+ EINA_LIST_FOREACH(attrs, l, attr)
+ eldbus_message_iter_arguments_get(iter_array, "ss", attr->key, attr->value);
+
+ eldbus_message_iter_container_close(iter, iter_array);
+ elm_atspi_attributes_list_free(attrs);
+
+ return ret;
+}
+
static uint64_t
_elm_atspi_state_set_to_atspi_state_set(Elm_Atspi_State_Set states)
{
{ "GetLocalizedRoleName", NULL, ELDBUS_ARGS({"s", "LocalizedName"}), _accessible_get_localized_role_name, 0},
{ "GetState", NULL, ELDBUS_ARGS({"au", NULL}), _accessible_get_state, 0},
{ "GetApplication", NULL, ELDBUS_ARGS({"(so)", NULL}), _accessible_get_application, 0},
- //{ "GetAttributes", NULL, ELDBUS_ARGS({"a{ss}", NULL}), NULL, 0},
+ { "GetAttributes", NULL, ELDBUS_ARGS({"a{ss}", NULL}), _accessible_attributes_get, 0},
{ NULL, NULL, NULL, NULL, 0 }
};
eo_class_name_get(eo_class_get(obj)));
}
-EOLIAN void
+EOLIAN Eina_List*
_elm_interface_atspi_accessible_attributes_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
{
WRN("The %s object does not implement the \"accessible_attributes_set\" function.",
eo_class_name_get(eo_class_get(obj)));
+ return NULL;
}
EOLIAN static Elm_Atspi_Role
return ret;
}
+EOLIAN Eina_List*
+_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
+{
+ WRN("The %s object does not implement the \"accessible_relation_set\" function.",
+ eo_class_name_get(eo_class_get(obj)));
+ return NULL;
+}
+
+void elm_atspi_attributes_list_free(Eina_List *list)
+{
+ Elm_Atspi_Attribute *attr;
+ EINA_LIST_FREE(list, attr)
+ {
+ eina_stringshare_del(attr->key);
+ eina_stringshare_del(attr->value);
+ }
+}
+
#include "elm_interface_atspi_accessible.eo.c"
}
protected relation_set {
get {
- /*@ Gets an string describing ATSPI widget role name. */
+ /*@ Gets an string describing ATSPI widget role name. Lists and
+ * elements Should be free by a user. */
+ }
+ values {
+ Eina_List *relations;
}
}
protected role {
}
protected attributes {
get {
- /*@ Gets human-readable string indentifying widget accessibility
- * role. */
+ /*@ Gets key-value pairs indentifying widget extra
+ * attributes. Must be free by a user. */
+ }
+ values {
+ Eina_List *attributes;
}
}
protected index_in_parent {
}
}
}
- implements {
- virtual::relation_set::get;
- }
events {
property,changed (const char *);
children,changed (Elm_Atspi_Event_Children_Changed_Data);
ELM_ATSPI_STATE_LAST_DEFINED,
};
+typedef enum _Elm_Atspi_Relation_Type Elm_Atspi_Relation_Type;
+
+enum _Elm_Atspi_Relation_Type {
+ ELM_ATSPI_RELATION_NULL,
+ ELM_ATSPI_RELATION_LABEL_FOR,
+ ELM_ATSPI_RELATION_LABELLED_BY,
+ ELM_ATSPI_RELATION_CONTROLLER_FOR,
+ ELM_ATSPI_RELATION_CONTROLLED_BY,
+ ELM_ATSPI_RELATION_MEMBER_OF,
+ ELM_ATSPI_RELATION_TOOLTIP_FOR,
+ ELM_ATSPI_RELATION_NODE_CHILD_OF,
+ ELM_ATSPI_RELATION_NODE_PARENT_OF,
+ ELM_ATSPI_RELATION_EXTENDED,
+ ELM_ATSPI_RELATION_FLOWS_TO,
+ ELM_ATSPI_RELATION_FLOWS_FROM,
+ ELM_ATSPI_RELATION_SUBWINDOW_OF,
+ ELM_ATSPI_RELATION_EMBEDS,
+ ELM_ATSPI_RELATION_EMBEDDED_BY,
+ ELM_ATSPI_RELATION_POPUP_FOR,
+ ELM_ATSPI_RELATION_PARENT_WINDOW_OF,
+ ELM_ATSPI_RELATION_DESCRIPTION_FOR,
+ ELM_ATSPI_RELATION_DESCRIBED_BY,
+ ELM_ATSPI_RELATION_LAST_DEFINED,
+};
+
typedef struct _Elm_Atspi_Event_State_Changed_Data Elm_Atspi_Event_State_Changed_Data;
Eo *child;
};
+typedef struct _Elm_Atspi_Attribute Elm_Atspi_Attribute;
+
+struct _Elm_Atspi_Attribute
+{
+ const char *key;
+ const char *value;
+};
+
+typedef struct _Elm_Atspi_Relation Elm_Atspi_Relation;
+
+struct _Elm_Atspi_Relation
+{
+ Elm_Atspi_Relation_Type type;
+ const Eo *obj;
+};
+
+/**
+ * Free Elm_Atspi_Attributes_List
+ */
+void elm_atspi_attributes_list_free(Eina_List *list);
+
/**
* Emits ATSPI 'StateChanged' dbus signal.
*/
EOLIAN static Eina_Bool
_elm_interface_atspi_component_size_set(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, int w, int h)
{
- Eina_Bool ret = EINA_FALSE;
+ Eina_Bool ret;
int c_x = 0, c_y = 0;
eo_do(obj, elm_interface_atspi_component_extents_get(EINA_FALSE, &c_x, &c_y, NULL, NULL));
- eo_do(obj, elm_interface_atspi_component_extents_set(EINA_FALSE, c_x, c_y, w, h));
+ eo_do(obj, ret = elm_interface_atspi_component_extents_set(EINA_FALSE, c_x, c_y, w, h));
return ret;
}
return states;
}
+EOLIAN static Eina_List*
+_elm_interface_atspi_widget_elm_interface_atspi_accessible_attributes_get(Eo *obj, Elm_Interface_Atspi_Widget_Data *pd EINA_UNUSED)
+{
+ Eina_List *ret = NULL;
+ Elm_Atspi_Attribute *attr = calloc(1, sizeof(Elm_Atspi_Attribute));
+ if (!attr) return NULL;
+
+ attr->key = eina_stringshare_add("type");
+ attr->value = eina_stringshare_add(evas_object_type_get(obj));
+
+ ret = eina_list_append(ret, attr);
+ return ret;
+}
+
+static Elm_Atspi_Relation*
+_relation_new(Elm_Atspi_Relation_Type type, Eo *obj)
+{
+ Elm_Atspi_Relation *rel = calloc(1, sizeof(Elm_Atspi_Relation));
+ if (!rel) return NULL;
+
+ rel->type = type;
+ rel->obj = obj;
+
+ return rel;
+}
+
+EOLIAN static Eina_List*
+_elm_interface_atspi_widget_elm_interface_atspi_accessible_relation_set_get(Eo *obj, Elm_Interface_Atspi_Widget_Data *pd EINA_UNUSED)
+{
+ Eina_List *list = NULL;
+ Elm_Atspi_Relation *rel;
+ Evas_Object *rel_obj;
+
+ rel_obj = elm_object_focus_next_object_get(obj, ELM_FOCUS_NEXT);
+ if (eo_isa(rel_obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_CLASS))
+ {
+ rel = _relation_new(ELM_ATSPI_RELATION_FLOWS_TO, rel_obj);
+ list = eina_list_append(list, rel);
+ }
+
+ rel_obj = elm_object_focus_next_object_get(obj, ELM_FOCUS_PREVIOUS);
+ if (eo_isa(rel_obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_CLASS))
+ {
+ rel = _relation_new(ELM_ATSPI_RELATION_FLOWS_FROM, rel_obj);
+ list = eina_list_append(list, rel);
+ }
+
+ return list;
+}
+
#include "elm_interface_atspi_widget.eo.c"
Elm_Interface_Atspi_Accessible::role::set;
Elm_Interface_Atspi_Accessible::state_set::get;
Elm_Interface_Atspi_Accessible::children::get;
+ Elm_Interface_Atspi_Accessible::attributes::get;
+ Elm_Interface_Atspi_Accessible::relation_set::get;
Elm_Interface_Atspi_Component::focus_grab;
}
}
check_PROGRAMS = elm_suite
elm_suite_SOURCES = \
elm_suite.c \
+ elm_test_atspi.c \
elm_test_check.c \
elm_test_colorselector.c \
elm_test_entry.c \
{ "elm_check", elm_test_check },
{ "elm_colorselector", elm_test_colorselector },
{ "elm_entry", elm_test_entry},
+ { "elm_atspi", elm_test_atspi},
{ NULL, NULL }
};
void elm_test_check(TCase *tc);
void elm_test_colorselector(TCase *tc);
void elm_test_entry(TCase *tc);
+void elm_test_atspi(TCase *tc);
#endif /* _ELM_SUITE_H */
--- /dev/null
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#define ELM_INTERNAL_API_ARGESFSDFEFC
+
+#include <Elementary.h>
+#include "elm_priv.h"
+#include "elm_suite.h"
+
+#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
+#include "elm_interface_atspi_accessible.h"
+#include "elm_interface_atspi_accessible.eo.h"
+
+#define ELM_INTERFACE_ATSPI_COMPONENT_PROTECTED
+#include "elm_interface_atspi_component.eo.h"
+
+static Evas_Object *g_win, *g_btn, *g_bg;
+
+Eo* generate_app(void)
+{
+ g_win = elm_win_add(NULL, "Title", ELM_WIN_BASIC);
+ evas_object_geometry_set(g_win, 100, 100, 100, 100);
+
+ g_bg = elm_bg_add(g_win);
+
+ g_btn = elm_button_add(g_win);
+
+ evas_object_show(g_btn);
+ evas_object_show(g_bg);
+ evas_object_show(g_win);
+
+ Eo *obj = NULL;
+
+ _elm_atspi_init();
+
+ obj = _elm_atspi_root_get();
+
+ return obj;
+}
+
+START_TEST (elm_atspi_root_get)
+{
+ elm_init(0, NULL);
+
+ Eo* obj = generate_app();
+
+ ck_assert(obj != NULL);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_name_get)
+{
+ elm_init(0, NULL);
+
+ Eo* obj = generate_app();
+
+ const char *ret = NULL;
+
+ elm_app_name_set("Test name");
+
+ eo_do(obj, ret = elm_interface_atspi_accessible_name_get());
+
+ ck_assert_str_eq(ret, "Test name");
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_role_get)
+{
+ elm_init(0, NULL);
+
+ Eo *obj = generate_app();
+
+ Elm_Atspi_Role role;
+
+ eo_do(obj, role = elm_interface_atspi_accessible_role_get());
+
+ ck_assert(role == ELM_ATSPI_ROLE_APPLICATION);
+
+ elm_shutdown();
+}
+END_TEST
+
+
+START_TEST (elm_atspi_role_name_get)
+{
+ elm_init(0, NULL);
+
+ Eo *obj = generate_app();
+
+ const char *ret = NULL;
+
+ eo_do(obj, ret = elm_interface_atspi_accessible_role_name_get());
+
+ ck_assert(ret != NULL);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_localized_role_name_get)
+{
+ elm_init(0, NULL);
+
+ Eo *obj = generate_app();
+
+ const char *ret = NULL;
+
+ eo_do(obj, ret = elm_interface_atspi_accessible_localized_role_name_get());
+
+ ck_assert(ret != NULL);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_description_set)
+{
+ elm_init(0, NULL);
+
+ Eo *obj = generate_app();
+
+ const char *ret = NULL;
+
+ const char *desc = "Test description";
+
+ eo_do(obj, ret = elm_interface_atspi_accessible_description_get());
+
+ ck_assert(ret == NULL);
+
+ eo_do(obj, elm_interface_atspi_accessible_description_set(desc));
+
+ eo_do(obj, ret = elm_interface_atspi_accessible_description_get());
+
+ ck_assert(ret != NULL);
+ ck_assert_str_eq(ret, "Test description");
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_children_and_parent)
+{
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eina_List *child_list = NULL;
+
+ eo_do(root, child_list = elm_interface_atspi_accessible_children_get());
+
+ //eo_do(eina_list_nth(child_list, 0), bg_child_list = elm_interface_atspi_accessible_children_get());
+
+ ck_assert(eina_list_count(child_list) == 1);
+
+ Eo *win = NULL;
+
+ win = eina_list_nth(child_list, 0);
+
+ ck_assert(win != NULL);
+ ck_assert(win == g_win);
+
+ Eo *win_parent = NULL;
+
+ eo_do(win, win_parent = elm_interface_atspi_accessible_parent_get());
+
+ ck_assert(root == win_parent);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_component_position)
+{
+ Eina_List *child_list = NULL;
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ eo_do(root, child_list = elm_interface_atspi_accessible_children_get());
+
+ win = eina_list_nth(child_list, 0);
+
+ Eina_Bool ret = EINA_FALSE;
+
+ eo_do(win, ret = elm_interface_atspi_component_position_set(EINA_TRUE, 100, 100));
+
+ ck_assert(ret == EINA_TRUE);
+
+ int x, y;
+
+ eo_do(win, elm_interface_atspi_component_position_get(EINA_TRUE, &x, &y));
+
+ ck_assert((x == 100) && (y == 100));
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_component_size)
+{
+ Eina_List *child_list = NULL;
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ eo_do(root, child_list = elm_interface_atspi_accessible_children_get());
+
+ win = eina_list_nth(child_list, 0);
+
+ Eina_Bool ret = EINA_FALSE;
+
+ eo_do(win, ret = elm_interface_atspi_component_size_set(100, 100));
+
+ ck_assert(ret == EINA_TRUE);
+
+ int w, h;
+
+ eo_do(win, elm_interface_atspi_component_size_get(&w, &h));
+
+ ck_assert((w == 100) && (h == 100));
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_component_focus)
+{
+ Eina_List *child_list = NULL;
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ eo_do(root, child_list = elm_interface_atspi_accessible_children_get());
+
+ win = eina_list_nth(child_list, 0);
+
+ Eina_Bool ret = EINA_FALSE;
+
+ eo_do(win, ret = elm_interface_atspi_component_focus_grab());
+
+ ck_assert(ret == EINA_TRUE);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_test_atspi_object_children_get)
+{
+ elm_init(0, NULL);
+
+ Eo *root = _elm_atspi_root_get();
+
+ Eina_List *children = NULL;
+ eo_do(root, children = elm_interface_atspi_accessible_children_get());
+
+ ck_assert(children == NULL);
+
+ eina_list_free(children);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_test_atspi_obj_index_in_parent_get)
+{
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ int ret = 0;
+
+ Eina_List *children = NULL;
+ eo_do(root, children = elm_interface_atspi_accessible_children_get());
+
+ Evas_Object *win = eina_list_nth(children, 0);
+ ck_assert(win != NULL);
+
+ eo_do(win, ret = elm_interface_atspi_accessible_index_in_parent_get());
+
+ ck_assert(ret == 0);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_component_z_order)
+{
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ Eina_List *children;
+ eo_do(root, children = elm_interface_atspi_accessible_children_get());
+
+ win = eina_list_nth(children, 0);
+ int z_order = -1;
+
+ eo_do(win, z_order = elm_interface_atspi_component_z_order_get());
+
+ ck_assert(z_order != -1);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_component_layer)
+{
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ Eina_List *children;
+ eo_do(root, children = elm_interface_atspi_accessible_children_get());
+
+ win = eina_list_nth(children, 0);
+
+ int layer = -1;
+
+ eo_do(win, layer = elm_interface_atspi_component_layer_get());
+
+ ck_assert(layer != -1);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_component_alpha)
+{
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ Eina_List *children;
+ eo_do(root, children = elm_interface_atspi_accessible_children_get());
+ win = eina_list_nth(children, 0);
+
+ double alpha = -1.0;
+
+ eo_do(win, alpha = elm_interface_atspi_component_alpha_get());
+
+ ck_assert(alpha >= 0.0);
+ ck_assert(alpha <= 1.0);
+
+ elm_shutdown();
+}
+END_TEST
+
+START_TEST (elm_atspi_children_and_parent2)
+{
+ elm_init(0, NULL);
+
+ Eo *root = generate_app();
+
+ Eo *win = NULL;
+
+ Eina_List *root_children;
+ eo_do(root, root_children = elm_interface_atspi_accessible_children_get());
+ win = eina_list_nth(root_children, 0);
+
+ Eina_List *win_children;
+ eo_do(win, win_children = elm_interface_atspi_accessible_children_get());
+
+ ck_assert(eina_list_count(win_children) == 2);
+
+ Eo *btn = NULL;
+
+ btn = eina_list_nth(win_children, 1);
+ ck_assert(btn != NULL);
+ ck_assert(btn == g_btn);
+
+ elm_shutdown();
+}
+END_TEST
+
+void elm_test_atspi(TCase *tc)
+{
+ tcase_add_test(tc, elm_atspi_root_get);
+ tcase_add_test(tc, elm_atspi_name_get);
+ tcase_add_test(tc, elm_atspi_role_get);
+ tcase_add_test(tc, elm_atspi_role_name_get);
+ tcase_add_test(tc, elm_atspi_localized_role_name_get);
+ tcase_add_test(tc, elm_atspi_description_set);
+ tcase_add_test(tc, elm_atspi_children_and_parent);
+ tcase_add_test(tc, elm_atspi_component_position);
+ tcase_add_test(tc, elm_atspi_component_size);
+ tcase_add_test(tc, elm_atspi_component_focus);
+ tcase_add_test(tc, elm_test_atspi_object_children_get);
+ tcase_add_test(tc, elm_test_atspi_obj_index_in_parent_get);
+ tcase_add_test(tc, elm_atspi_component_z_order);
+ tcase_add_test(tc, elm_atspi_component_layer);
+ tcase_add_test(tc, elm_atspi_component_alpha);
+ tcase_add_test(tc, elm_atspi_children_and_parent2);
+}
+
+/*
+ * TO DO
+ * elm_interface_atspi_accessible_relation_set_get
+ * elm_interface_atspi_accessible_relation_set_set
+ * elm_interface_atspi_accessible_state_get
+ * elm_interface_atspi_accessible_attributes_get
+ * elm_interface_atspi_component_contains
+*/