summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Stanislawski <l.stanislaws@samsung.com>2014-09-30 13:10:22 +0200
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>2015-04-06 10:24:56 +0200
commit0993198ee250797e8557fd2e50609f0157f3fb16 (patch)
tree950f63024c5892c8aac7557c3b4a825b8a2228e4
parent3751545aa49bab69d8e8d7cbd4885e5a9d21b49e (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 4aa0d8681..84af80030 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -7817,5 +7817,20 @@ _elm_genlist_elm_interface_atspi_widget_action_elm_actions_get(Eo *obj EINA_UNUS
7817 return &atspi_actions[0]; 7817 return &atspi_actions[0];
7818} 7818}
7819 7819
7820EOLIAN Eina_List*
7821_elm_genlist_elm_interface_atspi_accessible_children_get(Eo *obj EINA_UNUSED, Elm_Genlist_Data *sd)
7822{
7823 Eina_List *ret = NULL;
7824 Elm_Gen_Item *it;
7825
7826 EINA_INLIST_FOREACH(sd->items, it)
7827 {
7828 if (!it->parent)
7829 ret = eina_list_append(ret, EO_OBJ(it));
7830 }
7831
7832 return ret;
7833}
7834
7820#include "elm_genlist.eo.c" 7835#include "elm_genlist.eo.c"
7821#include "elm_genlist_item.eo.c" 7836#include "elm_genlist_item.eo.c"
diff --git a/src/lib/elm_genlist.eo b/src/lib/elm_genlist.eo
index dcf40f352..0595a74cd 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 d3bb70d5a..1dd313541 100644
--- a/src/tests/elm_test_genlist.c
+++ b/src/tests/elm_test_genlist.c
@@ -6,16 +6,22 @@
6#include <Elementary.h> 6#include <Elementary.h>
7#include "elm_suite.h" 7#include "elm_suite.h"
8 8
9static Evas_Object *win, *genlist;
10static Elm_Gen_Item_Class itc;
9 11
10START_TEST (elm_atspi_role_get) 12void test_init(void)
11{ 13{
12 Evas_Object *win, *genlist;
13 Elm_Atspi_Role role;
14
15 elm_init(1, NULL); 14 elm_init(1, NULL);
16 win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC); 15 win = elm_win_add(NULL, "genlist", ELM_WIN_BASIC);
17
18 genlist = elm_genlist_add(win); 16 genlist = elm_genlist_add(win);
17}
18
19START_TEST (elm_atspi_role_get)
20{
21 test_init();
22
23 Elm_Atspi_Role role;
24
19 eo_do(genlist, role = elm_interface_atspi_accessible_role_get()); 25 eo_do(genlist, role = elm_interface_atspi_accessible_role_get());
20 26
21 ck_assert(role == ELM_ATSPI_ROLE_LIST); 27 ck_assert(role == ELM_ATSPI_ROLE_LIST);
@@ -24,7 +30,63 @@ START_TEST (elm_atspi_role_get)
24} 30}
25END_TEST 31END_TEST
26 32
33START_TEST(elm_atspi_children_get1)
34{
35 test_init();
36 Eina_List *children;
37 Elm_Object_Item *it[3];
38
39 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
40 ck_assert(children == NULL);
41
42 it[0] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
43 it[1] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
44 it[2] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
45
46 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
47 ck_assert(eina_list_count(children) == 3);
48 ck_assert(eina_list_nth(children, 0) == it[0]);
49 ck_assert(eina_list_nth(children, 1) == it[1]);
50 ck_assert(eina_list_nth(children, 2) == it[2]);
51
52 eina_list_free(children);
53
54 elm_genlist_item_append(genlist, &itc, NULL, it[0], ELM_GENLIST_ITEM_NONE, NULL, NULL);
55 elm_genlist_item_append(genlist, &itc, NULL, it[1], ELM_GENLIST_ITEM_NONE, NULL, NULL);
56 elm_genlist_item_append(genlist, &itc, NULL, it[2], ELM_GENLIST_ITEM_NONE, NULL, NULL);
57
58 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
59 ck_assert(eina_list_count(children) == 3);
60 ck_assert(eina_list_nth(children, 0) == it[0]);
61 ck_assert(eina_list_nth(children, 1) == it[1]);
62 ck_assert(eina_list_nth(children, 2) == it[2]);
63
64 elm_shutdown();
65}
66END_TEST
67
68START_TEST(elm_atspi_children_get2)
69{
70 test_init();
71 Eina_List *children;
72 Elm_Object_Item *it[3];
73
74 it[0] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
75 it[1] = elm_genlist_item_prepend(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_GROUP, NULL, NULL);
76 it[2] = elm_genlist_item_append(genlist, &itc, NULL, NULL, ELM_GENLIST_ITEM_TREE, NULL, NULL);
77
78 eo_do(genlist, children = elm_interface_atspi_accessible_children_get());
79 ck_assert(eina_list_nth(children, 1) == it[0]);
80 ck_assert(eina_list_nth(children, 0) == it[1]);
81 ck_assert(eina_list_nth(children, 2) == it[2]);
82
83 elm_shutdown();
84}
85END_TEST
86
27void elm_test_genlist(TCase *tc) 87void elm_test_genlist(TCase *tc)
28{ 88{
29 tcase_add_test(tc, elm_atspi_role_get); 89 tcase_add_test(tc, elm_atspi_role_get);
90 tcase_add_test(tc, elm_atspi_children_get1);
91 tcase_add_test(tc, elm_atspi_children_get2);
30} 92}