summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2014-09-30 13:10:22 +0200
committerLukasz Stanislawski <l.stanislaws@samsung.com>2014-09-30 13:10:22 +0200
commitd83e3b046875f630149b52162b1f54eb82164e22 (patch)
tree5b91d49d6510fad4b671272056ced579c06c3b1e
parentada4c082beb20cb584a8997d9cd4658605480ecf (diff)
atspi: overload children_get method for elm_genlist
-rw-r--r--src/lib/elm_genlist.c15
-rw-r--r--src/lib/elm_genlist.eo1
-rw-r--r--src/tests/elm_test_genlist.c74
3 files changed, 84 insertions, 6 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index b4b6c0f18..144d5a5ec 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -7693,5 +7693,20 @@ _elm_genlist_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUS
7693 return &atspi_actions[0]; 7693 return &atspi_actions[0];
7694} 7694}
7695 7695
7696EOLIAN Eina_List*
7697_elm_genlist_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
7698{
7699 Eina_List *ret = NULL;
7700 Elm_Gen_Item *it;
7701
7702 EINA_INLIST_FOREACH(sd->items, it)
7703 {
7704 if (!it->parent)
7705 ret = eina_list_append(ret, EO_OBJ(it));
7706 }
7707
7708 return ret;
7709}
7710
7696#include "elm_genlist.eo.c" 7711#include "elm_genlist.eo.c"
7697#include "elm_genlist_item.eo.c" 7712#include "elm_genlist_item.eo.c"
diff --git a/src/lib/elm_genlist.eo b/src/lib/elm_genlist.eo
index 790762609..5c9334a11 100644
--- a/src/lib/elm_genlist.eo
+++ b/src/lib/elm_genlist.eo
@@ -728,6 +728,7 @@ class Elm_Genlist (Elm_Layout, Elm_Interface_Scrollable, Evas.Clickable_Interfac
728 Elm_Layout.sizing_eval; 728 Elm_Layout.sizing_eval;
729 Elm_Interface_Scrollable.bounce_allow; 729 Elm_Interface_Scrollable.bounce_allow;
730 Elm_Interface_Scrollable.policy; 730 Elm_Interface_Scrollable.policy;
731 Elm_Interface_Atspi_Accessible.children.get;
731 Elm_Interface_Atspi_Widget_Action.elm_actions.get; 732 Elm_Interface_Atspi_Widget_Action.elm_actions.get;
732 } 733 }
733 events { 734 events {
diff --git a/src/tests/elm_test_genlist.c b/src/tests/elm_test_genlist.c
index 9387e0bfb..7a0410c64 100644
--- a/src/tests/elm_test_genlist.c
+++ b/src/tests/elm_test_genlist.c
@@ -9,16 +9,22 @@
9#include "elm_interface_atspi_accessible.h" 9#include "elm_interface_atspi_accessible.h"
10#include "elm_interface_atspi_accessible.eo.h" 10#include "elm_interface_atspi_accessible.eo.h"
11 11
12static Evas_Object *win, *genlist;
13static Elm_Gen_Item_Class itc;
12 14
13START_TEST (elm_atspi_role_get) 15void test_init(void)
14{ 16{
15 Evas_Object *win, *genlist;
16 Elm_Atspi_Role role;
17
18 elm_init(1, NULL); 17 elm_init(1, NULL);
19 win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC); 18 win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
20
21 genlist = elm_genlist_add(win); 19 genlist = elm_genlist_add(win);
20}
21
22START_TEST (elm_atspi_role_get)
23{
24 test_init();
25
26 Elm_Atspi_Role role;
27
22 eo_do(genlist, role = elm_interface_atspi_accessible_role_get()); 28 eo_do(genlist, role = elm_interface_atspi_accessible_role_get());
23 29
24 ck_assert(role == ELM_ATSPI_ROLE_LIST); 30 ck_assert(role == ELM_ATSPI_ROLE_LIST);
@@ -27,7 +33,63 @@ START_TEST (elm_atspi_role_get)
27} 33}
28END_TEST 34END_TEST
29 35
36START_TEST(elm_atspi_children_get1)
37{
38 test_init();
39 Eina_List *children;
40 Elm_Object_Item *it[3];
41
42 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
43 ck_assert(children == NULL);
44
45 it[0] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
46 it[1] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
47 it[2] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
48
49 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
50 ck_assert(eina_list_count(children) == 3);
51 ck_assert(eina_list_nth(children, 0) == it[0]);
52 ck_assert(eina_list_nth(children, 1) == it[1]);
53 ck_assert(eina_list_nth(children, 2) == it[2]);
54
55 eina_list_free(children);
56
57 elm_genlist_item_append(genlist, &itc, NULL, it[0], ELM_GENLIST_ITEM_NONE, NULL, NULL);
58 elm_genlist_item_append(genlist, &itc, NULL, it[1], ELM_GENLIST_ITEM_NONE, NULL, NULL);
59 elm_genlist_item_append(genlist, &itc, NULL, it[2], ELM_GENLIST_ITEM_NONE, NULL, NULL);
60
61 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
62 ck_assert(eina_list_count(children) == 3);
63 ck_assert(eina_list_nth(children, 0) == it[0]);
64 ck_assert(eina_list_nth(children, 1) == it[1]);
65 ck_assert(eina_list_nth(children, 2) == it[2]);
66
67 elm_shutdown();
68}
69END_TEST
70
71START_TEST(elm_atspi_children_get2)
72{
73 test_init();
74 Eina_List *children;
75 Elm_Object_Item *it[3];
76
77 it[0] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
78 it[1] = elm_genlist_item_prepend(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
79 it[2] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
80
81 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
82 ck_assert(eina_list_nth(children, 1) == it[0]);
83 ck_assert(eina_list_nth(children, 0) == it[1]);
84 ck_assert(eina_list_nth(children, 2) == it[2]);
85
86 elm_shutdown();
87}
88END_TEST
89
30void elm_test_genlist(TCase *tc) 90void elm_test_genlist(TCase *tc)
31{ 91{
32 tcase_add_test(tc, elm_atspi_role_get); 92 tcase_add_test(tc, elm_atspi_role_get);
93 tcase_add_test(tc, elm_atspi_children_get1);
94 tcase_add_test(tc, elm_atspi_children_get2);
33} 95}