summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2015-04-17 13:59:08 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2015-05-15 10:15:27 +0200
commit015df8afe94011f07883cb6a7bc3a69e7ba7de79 (patch)
tree90ad7a3a0d4a1bb050e8f5b29b819397bc473542
parent9c8ddce6179253487dd01730a55de1f5273b498e (diff)
atspi: add new APIs for setting atspi relationship.devs/stanluk/relations
Introduce new APIs elm_object_atspi_relationship_append and elm_object_atspi_relationship_remove allowing to set developer-defined accessibility relationships between widgets.
-rw-r--r--src/lib/elm_atspi_bridge.c11
-rw-r--r--src/lib/elm_interface_atspi_accessible.c102
-rw-r--r--src/lib/elm_interface_atspi_accessible.eo2
-rw-r--r--src/lib/elm_interface_atspi_accessible.h39
-rw-r--r--src/lib/elm_main.c11
-rw-r--r--src/lib/elm_object.h28
-rw-r--r--src/lib/elm_widget.c43
-rw-r--r--src/lib/elm_widget.eo15
-rw-r--r--src/lib/elm_widget.h3
-rw-r--r--src/tests/elm_test_atspi.c84
10 files changed, 300 insertions, 38 deletions
diff --git a/src/lib/elm_atspi_bridge.c b/src/lib/elm_atspi_bridge.c
index ec9e2db15..4961f3033 100644
--- a/src/lib/elm_atspi_bridge.c
+++ b/src/lib/elm_atspi_bridge.c
@@ -652,7 +652,8 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
652 Eldbus_Message *ret = NULL; 652 Eldbus_Message *ret = NULL;
653 Eldbus_Message_Iter *iter = NULL, *iter_array = NULL, *iter_array2 = NULL, *iter_struct; 653 Eldbus_Message_Iter *iter = NULL, *iter_array = NULL, *iter_array2 = NULL, *iter_struct;
654 Elm_Atspi_Relation *rel; 654 Elm_Atspi_Relation *rel;
655 Eina_List *rels; 655 Eina_List *l;
656 Elm_Atspi_Relation_Set rels;
656 657
657 ret = eldbus_message_method_return_new(msg); 658 ret = eldbus_message_method_return_new(msg);
658 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL); 659 EINA_SAFETY_ON_NULL_RETURN_VAL(ret, NULL);
@@ -663,17 +664,19 @@ _accessible_get_relation_set(const Eldbus_Service_Interface *iface EINA_UNUSED,
663 664
664 eo_do(obj, rels = elm_interface_atspi_accessible_relation_set_get()); 665 eo_do(obj, rels = elm_interface_atspi_accessible_relation_set_get());
665 666
666 EINA_LIST_FREE(rels, rel) 667 EINA_LIST_FOREACH(rels, l, rel)
667 { 668 {
669 Eo *rel_obj;
668 iter_struct = eldbus_message_iter_container_new(iter_array, 'r', NULL); 670 iter_struct = eldbus_message_iter_container_new(iter_array, 'r', NULL);
669 eldbus_message_iter_basic_append(iter_struct, 'u', _elm_relation_to_atspi_relation(rel->type)); 671 eldbus_message_iter_basic_append(iter_struct, 'u', _elm_relation_to_atspi_relation(rel->type));
670 iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)"); 672 iter_array2 = eldbus_message_iter_container_new(iter_struct, 'a', "(so)");
671 EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail); 673 EINA_SAFETY_ON_NULL_GOTO(iter_array2, fail);
672 _iter_object_reference_append(iter_array2, rel->obj); 674 EINA_LIST_FOREACH(rel->objects, l, rel_obj)
675 _iter_object_reference_append(iter_array2, rel_obj);
673 eldbus_message_iter_container_close(iter_struct, iter_array2); 676 eldbus_message_iter_container_close(iter_struct, iter_array2);
674 eldbus_message_iter_container_close(iter_array, iter_struct); 677 eldbus_message_iter_container_close(iter_array, iter_struct);
675 free(rel);
676 } 678 }
679 elm_atspi_relation_set_free(&rels);
677 eldbus_message_iter_container_close(iter, iter_array); 680 eldbus_message_iter_container_close(iter, iter_array);
678 681
679 return ret; 682 return ret;
diff --git a/src/lib/elm_interface_atspi_accessible.c b/src/lib/elm_interface_atspi_accessible.c
index 36e0cc042..ac0480072 100644
--- a/src/lib/elm_interface_atspi_accessible.c
+++ b/src/lib/elm_interface_atspi_accessible.c
@@ -262,12 +262,13 @@ _elm_interface_atspi_accessible_state_set_get(Eo *obj EINA_UNUSED, void *pd EINA
262 return ret; 262 return ret;
263} 263}
264 264
265EOLIAN Eina_List* 265EOLIAN Elm_Atspi_Relation_Set
266_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED) 266_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
267{ 267{
268 Elm_Atspi_Relation_Set ret = 0;
268 WRN("The %s object does not implement the \"accessible_relation_set\" function.", 269 WRN("The %s object does not implement the \"accessible_relation_set\" function.",
269 eo_class_name_get(eo_class_get(obj))); 270 eo_class_name_get(eo_class_get(obj)));
270 return NULL; 271 return ret;
271} 272}
272 273
273EAPI void elm_atspi_attributes_list_free(Eina_List *list) 274EAPI void elm_atspi_attributes_list_free(Eina_List *list)
@@ -281,4 +282,101 @@ EAPI void elm_atspi_attributes_list_free(Eina_List *list)
281 } 282 }
282} 283}
283 284
285EAPI void elm_atspi_relation_free(Elm_Atspi_Relation *relation)
286{
287 eina_list_free(relation->objects);
288 free(relation);
289}
290
291EAPI Elm_Atspi_Relation *elm_atspi_relation_clone(const Elm_Atspi_Relation *relation)
292{
293 Elm_Atspi_Relation *ret = calloc(sizeof(Elm_Atspi_Relation), 1);
294 ret->type = relation->type;
295 ret->objects = eina_list_clone(relation->objects);
296 return ret;
297}
298
299EAPI Eina_Bool elm_atspi_relation_set_relation_append(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj)
300{
301 Elm_Atspi_Relation *rel;
302 Eina_List *l;
303
304 if (!eo_isa(rel_obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
305 return EINA_FALSE;
306
307 EINA_LIST_FOREACH(*set, l, rel)
308 {
309 if (rel->type == type)
310 {
311 if (!eina_list_data_find(rel->objects, rel_obj))
312 rel->objects = eina_list_append(rel->objects, rel_obj);
313 return EINA_TRUE;
314 }
315 }
316
317 rel = calloc(sizeof(Elm_Atspi_Relation), 1);
318 rel->type = type;
319 rel->objects = eina_list_append(rel->objects, rel_obj);
320 *set = eina_list_append(*set, rel);
321 return EINA_TRUE;
322}
323
324EAPI void elm_atspi_relation_set_relation_remove(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj)
325{
326 Eina_List *l;
327 Elm_Atspi_Relation *rel;
328
329 EINA_LIST_FOREACH(*set, l, rel)
330 {
331 if (rel->type == type)
332 {
333 rel->objects = eina_list_remove(rel->objects, rel_obj);
334 if (!rel->objects)
335 {
336 *set = eina_list_remove(*set, rel);
337 elm_atspi_relation_free(rel);
338 }
339 return;
340 }
341 }
342}
343
344EAPI void elm_atspi_relation_set_relation_type_remove(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type)
345{
346 Eina_List *l;
347 Elm_Atspi_Relation *rel;
348
349 EINA_LIST_FOREACH(*set, l, rel)
350 {
351 if (rel->type == type)
352 {
353 *set = eina_list_remove(*set, rel);
354 elm_atspi_relation_free(rel);
355 return;
356 }
357 }
358}
359
360EAPI void elm_atspi_relation_set_free(Elm_Atspi_Relation_Set *set)
361{
362 Elm_Atspi_Relation *rel;
363 EINA_LIST_FREE(*set, rel)
364 elm_atspi_relation_free(rel);
365}
366
367EAPI Elm_Atspi_Relation_Set elm_atspi_relation_set_clone(const Elm_Atspi_Relation_Set *set)
368{
369 Elm_Atspi_Relation_Set ret = NULL;
370 Eina_List *l;
371 Elm_Atspi_Relation *rel;
372
373 EINA_LIST_FOREACH(*set, l, rel)
374 {
375 Elm_Atspi_Relation *cpy = elm_atspi_relation_clone(rel);
376 ret = eina_list_append(ret, cpy);
377 }
378
379 return ret;
380}
381
284#include "elm_interface_atspi_accessible.eo.c" 382#include "elm_interface_atspi_accessible.eo.c"
diff --git a/src/lib/elm_interface_atspi_accessible.eo b/src/lib/elm_interface_atspi_accessible.eo
index 9556e5739..5e0c1b3e1 100644
--- a/src/lib/elm_interface_atspi_accessible.eo
+++ b/src/lib/elm_interface_atspi_accessible.eo
@@ -29,7 +29,7 @@ mixin Elm_Interface_Atspi_Accessible ()
29 elements Should be free by a user. */ 29 elements Should be free by a user. */
30 } 30 }
31 values { 31 values {
32 own(list<own(Elm_Atspi_Relation *)> *) relations; 32 Elm_Atspi_Relation_Set relations;
33 } 33 }
34 } 34 }
35 @property role @protected { 35 @property role @protected {
diff --git a/src/lib/elm_interface_atspi_accessible.h b/src/lib/elm_interface_atspi_accessible.h
index acd152e1b..293a79f08 100644
--- a/src/lib/elm_interface_atspi_accessible.h
+++ b/src/lib/elm_interface_atspi_accessible.h
@@ -246,16 +246,53 @@ typedef struct _Elm_Atspi_Attribute Elm_Atspi_Attribute;
246struct _Elm_Atspi_Relation 246struct _Elm_Atspi_Relation
247{ 247{
248 Elm_Atspi_Relation_Type type; 248 Elm_Atspi_Relation_Type type;
249 const Eo *obj; 249 Eina_List *objects;
250}; 250};
251 251
252typedef struct _Elm_Atspi_Relation Elm_Atspi_Relation; 252typedef struct _Elm_Atspi_Relation Elm_Atspi_Relation;
253 253
254typedef Eina_List *Elm_Atspi_Relation_Set;
255
254/** 256/**
255 * Free Elm_Atspi_Attributes_List 257 * Free Elm_Atspi_Attributes_List
256 */ 258 */
257EAPI void elm_atspi_attributes_list_free(Eina_List *list); 259EAPI void elm_atspi_attributes_list_free(Eina_List *list);
258 260
261/**
262 * Free Elm_Atspi_Relation
263 */
264EAPI void elm_atspi_relation_free(Elm_Atspi_Relation *rel);
265
266/**
267 * Clones relation
268 */
269EAPI Elm_Atspi_Relation *elm_atspi_relation_clone(const Elm_Atspi_Relation *relation);
270
271/**
272 * Appends relation to relation set
273 */
274EAPI Eina_Bool elm_atspi_relation_set_relation_append(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj);
275
276/**
277 * Removes relation from relation set
278 */
279EAPI void elm_atspi_relation_set_relation_remove(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type, const Eo *rel_obj);
280
281/**
282 * Removes all relation from relation set of a given type
283 */
284EAPI void elm_atspi_relation_set_relation_type_remove(Elm_Atspi_Relation_Set *set, Elm_Atspi_Relation_Type type);
285
286/**
287 * Frees Elm_Atspi_State_Set
288 */
289EAPI void elm_atspi_relation_set_free(Elm_Atspi_Relation_Set *set);
290
291/**
292 * Makes a deep copy of Elm_Atspi_State_Set
293 */
294EAPI Elm_Atspi_Relation_Set elm_atspi_relation_set_clone(const Elm_Atspi_Relation_Set *set);
295
259#ifdef EFL_EO_API_SUPPORT 296#ifdef EFL_EO_API_SUPPORT
260 297
261/** 298/**
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index c1f57c777..4ec0aa263 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -1731,3 +1731,14 @@ elm_object_focused_item_get(const Evas_Object *obj)
1731 return elm_widget_focused_item_get(obj); 1731 return elm_widget_focused_item_get(obj);
1732} 1732}
1733 1733
1734EAPI Eina_Bool
1735elm_object_atspi_relationship_append(Evas_Object *obj, Elm_Atspi_Relation_Type type, const Evas_Object *relation_obj)
1736{
1737 return elm_widget_atspi_relationship_append(obj, type, relation_obj);
1738}
1739
1740EAPI void
1741elm_object_atspi_relationship_remove(Evas_Object *obj, Elm_Atspi_Relation_Type type, const Evas_Object *relation_obj)
1742{
1743 elm_widget_atspi_relationship_remove(obj, type, relation_obj);
1744}
diff --git a/src/lib/elm_object.h b/src/lib/elm_object.h
index df066d07b..e94664175 100644
--- a/src/lib/elm_object.h
+++ b/src/lib/elm_object.h
@@ -508,3 +508,31 @@ EAPI void elm_object_orientation_mode_disabled_set(Evas_Object *obj, Eina
508 */ 508 */
509EAPI Eina_Bool elm_object_orientation_mode_disabled_get(const Evas_Object *obj); 509EAPI Eina_Bool elm_object_orientation_mode_disabled_get(const Evas_Object *obj);
510 510
511#ifdef ELM_BETA_API_SUPPORT
512
513/**
514 * Set ATSPI2 relationship between two elementary widgets.
515 *
516 * @param obj The Elementary widget.
517 * @param type Type of relationship.
518 * @param relation_obj object being second side of the relation.
519 *
520 * @since 1.15
521 *
522 * @ingroup General
523 */
524EAPI Eina_Bool elm_object_atspi_relationship_append(Evas_Object *obj, Elm_Atspi_Relation_Type type, Evas_Object *relation_obj);
525
526/**
527 * Removes ATSPI2 relationship between widgets.
528 *
529 * @param obj The Elementary widget.
530 * @param type Type of relationship.
531 * @param relation_obj object being second side of the relation.
532 *
533 * @since 1.15
534 *
535 * @ingroup General
536 */
537EAPI void elm_object_atspi_relationship_remove(Evas_Object *obj, Elm_Atspi_Relation_Type type, Evas_Object *relation_obj);
538#endif
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 27221d55b..44e03fced 100644
--- a/src/lib/elm_widget.c
+++ b/src/lib/elm_widget.c
@@ -5456,6 +5456,9 @@ _elm_widget_eo_base_destructor(Eo *obj, Elm_Widget_Smart_Data *sd)
5456 if (parent && !eo_destructed_is(parent)) 5456 if (parent && !eo_destructed_is(parent))
5457 elm_interface_atspi_accessible_children_changed_del_signal_emit(parent, obj); 5457 elm_interface_atspi_accessible_children_changed_del_signal_emit(parent, obj);
5458 5458
5459 if (sd->atspi_custom_relations)
5460 elm_atspi_relation_set_free(&sd->atspi_custom_relations);
5461
5459 eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor()); 5462 eo_do_super(obj, ELM_WIDGET_CLASS, eo_destructor());
5460} 5463}
5461 5464
@@ -5662,40 +5665,22 @@ _elm_widget_elm_interface_atspi_accessible_attributes_get(Eo *obj, Elm_Widget_Sm
5662 return ret; 5665 return ret;
5663} 5666}
5664 5667
5665static Elm_Atspi_Relation* 5668EOLIAN static Elm_Atspi_Relation_Set
5666_relation_new(Elm_Atspi_Relation_Type type, Eo *obj) 5669_elm_widget_elm_interface_atspi_accessible_relation_set_get(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd)
5667{ 5670{
5668 Elm_Atspi_Relation *rel = calloc(1, sizeof(Elm_Atspi_Relation)); 5671 return elm_atspi_relation_set_clone(&sd->atspi_custom_relations);
5669 if (!rel) return NULL;
5670
5671 rel->type = type;
5672 rel->obj = obj;
5673
5674 return rel;
5675} 5672}
5676 5673
5677EOLIAN static Eina_List* 5674EOLIAN static Eina_Bool
5678_elm_widget_elm_interface_atspi_accessible_relation_set_get(Eo *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED) 5675_elm_widget_atspi_relationship_append(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Elm_Atspi_Relation_Type type, const Eo *relation_obj)
5679{ 5676{
5680 Eina_List *list = NULL; 5677 return elm_atspi_relation_set_relation_append(&sd->atspi_custom_relations, type, relation_obj);
5681 Elm_Atspi_Relation *rel; 5678}
5682 Evas_Object *rel_obj;
5683
5684 rel_obj = elm_object_focus_next_object_get(obj, ELM_FOCUS_NEXT);
5685 if (eo_isa(rel_obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
5686 {
5687 rel = _relation_new(ELM_ATSPI_RELATION_FLOWS_TO, rel_obj);
5688 list = eina_list_append(list, rel);
5689 }
5690
5691 rel_obj = elm_object_focus_next_object_get(obj, ELM_FOCUS_PREVIOUS);
5692 if (eo_isa(rel_obj, ELM_INTERFACE_ATSPI_ACCESSIBLE_MIXIN))
5693 {
5694 rel = _relation_new(ELM_ATSPI_RELATION_FLOWS_FROM, rel_obj);
5695 list = eina_list_append(list, rel);
5696 }
5697 5679
5698 return list; 5680EOLIAN static void
5681_elm_widget_atspi_relationship_remove(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, Elm_Atspi_Relation_Type type, const Eo *relation_obj)
5682{
5683 elm_atspi_relation_set_relation_remove(&sd->atspi_custom_relations, type, relation_obj);
5699} 5684}
5700 5685
5701EOLIAN static void 5686EOLIAN static void
diff --git a/src/lib/elm_widget.eo b/src/lib/elm_widget.eo
index 75bc7d924..dd3efe985 100644
--- a/src/lib/elm_widget.eo
+++ b/src/lib/elm_widget.eo
@@ -790,6 +790,21 @@ abstract Elm.Widget (Evas.Object_Smart, Elm_Interface_Atspi_Accessible, Elm_Inte
790 @in Evas_Object *relative_child @optional; 790 @in Evas_Object *relative_child @optional;
791 } 791 }
792 } 792 }
793 atspi_relationship_append {
794 /*@ No description supplied by the EAPI. */
795 return: bool;
796 params {
797 @in Elm_Atspi_Relation_Type type;
798 @in const(Eo) *relation_object;
799 }
800 }
801 atspi_relationship_remove {
802 /*@ No description supplied by the EAPI. */
803 params {
804 @in Elm_Atspi_Relation_Type type;
805 @in const(Eo) *relation_object;
806 }
807 }
793 } 808 }
794 implements { 809 implements {
795 class.constructor; 810 class.constructor;
diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h
index a0189a80f..5350442de 100644
--- a/src/lib/elm_widget.h
+++ b/src/lib/elm_widget.h
@@ -410,6 +410,7 @@ typedef struct _Elm_Widget_Smart_Data
410 int role; /**< Accessibility role */ 410 int role; /**< Accessibility role */
411 const char *description; /**< Accessibility description */ 411 const char *description; /**< Accessibility description */
412 Eo *atspi_custom_parent; /**< Accessibility parent if different then parent_obj */ 412 Eo *atspi_custom_parent; /**< Accessibility parent if different then parent_obj */
413 Elm_Atspi_Relation_Set atspi_custom_relations; /**< Developer-defined accessiblity relations @since 1.15 */
413 414
414 /* this is a hook to be set on-the-fly on widgets. this is code 415 /* this is a hook to be set on-the-fly on widgets. this is code
415 * handling the request of showing a specific region from an inner 416 * handling the request of showing a specific region from an inner
@@ -776,6 +777,8 @@ EAPI Elm_Object_Item *elm_widget_focused_item_get(const Evas_Object *obj);
776EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled); 777EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled);
777EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj); 778EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj);
778EAPI void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h); 779EAPI void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
780EAPI Eina_Bool elm_widget_atspi_relationship_append(Evas_Object *obj, Elm_Atspi_Relation_Type type, const Evas_Object *relation_obj);
781EAPI void elm_widget_atspi_relationship_remove(Evas_Object *obj, Elm_Atspi_Relation_Type type, const Evas_Object *relation_obj);
779void _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *it); 782void _elm_widget_item_highlight_in_theme(Evas_Object *obj, Elm_Object_Item *it);
780 783
781/** 784/**
diff --git a/src/tests/elm_test_atspi.c b/src/tests/elm_test_atspi.c
index da616ff07..e4e18fc3c 100644
--- a/src/tests/elm_test_atspi.c
+++ b/src/tests/elm_test_atspi.c
@@ -9,7 +9,7 @@
9#include "elm_priv.h" 9#include "elm_priv.h"
10#include "elm_suite.h" 10#include "elm_suite.h"
11 11
12static Evas_Object *g_win, *g_btn, *g_bg; 12static Evas_Object *g_win, *g_btn, *g_bg, *g_btn2, *g_btn3, *g_box, *g_lbl;
13 13
14void generate_app(void) 14void generate_app(void)
15{ 15{
@@ -25,6 +25,34 @@ void generate_app(void)
25 evas_object_show(g_win); 25 evas_object_show(g_win);
26} 26}
27 27
28void generate_app2(void)
29{
30 g_win = elm_win_add(NULL, "Title", ELM_WIN_BASIC);
31 evas_object_geometry_set(g_win, 100, 100, 100, 100);
32
33 g_bg = elm_bg_add(g_win);
34
35 g_box = elm_box_add(g_win);
36
37 g_btn = elm_button_add(g_win);
38 g_btn2 = elm_button_add(g_win);
39 g_btn3 = elm_button_add(g_win);
40 g_lbl = elm_label_add(g_win);
41
42 elm_box_pack_end(g_box, g_btn);
43 elm_box_pack_end(g_box, g_btn2);
44 elm_box_pack_end(g_box, g_btn3);
45 elm_box_pack_end(g_box, g_lbl);
46
47 evas_object_show(g_btn);
48 evas_object_show(g_bg);
49 evas_object_show(g_win);
50 evas_object_show(g_box);
51 evas_object_show(g_btn2);
52 evas_object_show(g_btn3);
53 evas_object_show(g_lbl);
54}
55
28START_TEST (elm_atspi_name_get) 56START_TEST (elm_atspi_name_get)
29{ 57{
30 elm_init(0, NULL); 58 elm_init(0, NULL);
@@ -184,6 +212,59 @@ START_TEST (elm_atspi_children_and_parent2)
184} 212}
185END_TEST 213END_TEST
186 214
215START_TEST (elm_atspi_elm_widget_custom_relations)
216{
217 Elm_Atspi_Relation_Set set;
218 Elm_Atspi_Relation *rel, *rel_to, *rel_from;
219 Eina_List *l;
220
221 elm_init(0, NULL);
222 generate_app2();
223
224 eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get());
225 ck_assert(set == NULL);
226
227 elm_widget_atspi_relationship_append(g_btn, ELM_ATSPI_RELATION_FLOWS_TO, g_lbl);
228 elm_widget_atspi_relationship_append(g_btn, ELM_ATSPI_RELATION_FLOWS_FROM, g_win);
229
230 eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get());
231 ck_assert(set != NULL);
232 ck_assert(eina_list_count(set) >= 2);
233
234 rel_to = rel_from = NULL;
235 EINA_LIST_FOREACH(set, l, rel)
236 {
237 if (rel->type == ELM_ATSPI_RELATION_FLOWS_TO)
238 rel_to = rel;
239 if (rel->type == ELM_ATSPI_RELATION_FLOWS_FROM)
240 rel_from = rel;
241 }
242
243 ck_assert(rel_to != NULL);
244 ck_assert(rel_from != NULL);
245 ck_assert(eina_list_data_find(rel_to->objects, g_lbl) != NULL);
246 ck_assert(eina_list_data_find(rel_from->objects, g_win) != NULL);
247
248 elm_atspi_relation_set_free(&set);
249
250 elm_widget_atspi_relationship_remove(g_btn, ELM_ATSPI_RELATION_FLOWS_TO, g_lbl);
251 eo_do(g_btn, set = elm_interface_atspi_accessible_relation_set_get());
252 ck_assert(set != NULL);
253 ck_assert(eina_list_count(set) >= 1);
254
255 rel_to = rel_from = NULL;
256 EINA_LIST_FOREACH(set, l, rel)
257 {
258 if (rel->type == ELM_ATSPI_RELATION_FLOWS_TO)
259 ck_assert(EINA_FALSE);
260 }
261
262 elm_atspi_relation_set_free(&set);
263
264 elm_shutdown();
265}
266END_TEST
267
187void elm_test_atspi(TCase *tc) 268void elm_test_atspi(TCase *tc)
188{ 269{
189 tcase_add_test(tc, elm_atspi_name_get); 270 tcase_add_test(tc, elm_atspi_name_get);
@@ -193,4 +274,5 @@ void elm_test_atspi(TCase *tc)
193 tcase_add_test(tc, elm_atspi_description_set); 274 tcase_add_test(tc, elm_atspi_description_set);
194 tcase_add_test(tc, elm_atspi_children_and_parent); 275 tcase_add_test(tc, elm_atspi_children_and_parent);
195 tcase_add_test(tc, elm_atspi_children_and_parent2); 276 tcase_add_test(tc, elm_atspi_children_and_parent2);
277 tcase_add_test(tc, elm_atspi_elm_widget_custom_relations);
196} 278}