summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-07-23 22:51:50 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2015-07-23 22:51:50 +0200
commit0d94dea224abba2632e713f25aecc8de5162e88a (patch)
tree965c0eb62a4922ea42d14ec832a6f1b090e957d3
parent761ccb491aa10b9d41ef6325dfd65d2823223db0 (diff)
made the test a bit better
-rw-r--r--src/test/list/list.c99
1 files changed, 73 insertions, 26 deletions
diff --git a/src/test/list/list.c b/src/test/list/list.c
index 72ed988..92084a8 100644
--- a/src/test/list/list.c
+++ b/src/test/list/list.c
@@ -5,6 +5,9 @@
5#include <Elementary.h> 5#include <Elementary.h>
6#include <Elm_Items.h> 6#include <Elm_Items.h>
7 7
8static Eina_Bool pause_realize = EINA_TRUE;
9
10static Evas_Object *spinner;
8static void 11static void
9on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 12on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
10{ 13{
@@ -13,25 +16,31 @@ on_done(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info E
13} 16}
14 17
15static Eina_Bool 18static Eina_Bool
16_realize(void *data, Eo *obj, const Eo_Event_Description2 *desc, void *event) 19_realize(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUSED, void *event EINA_UNUSED)
17{ 20{
18 Eo *btn; 21 Eo *btn;
19 struct timespec tim; 22 struct timespec tim;
20 btn = elm_button_add(obj); 23 btn = elm_label_add(obj);
24 elm_object_text_set(btn, "text");
21 25
22 eo_do(obj, elm_items_item_content_set(btn)); 26 eo_do(obj, elm_items_item_content_set(btn));
23 evas_object_color_set(btn, 30, 30, 30, 30);
24 27
25 tim.tv_sec = 0; 28 if (pause_realize)
26 tim.tv_nsec = 5000000; 29 {
27 nanosleep(&tim, NULL); 30 tim.tv_sec = 0;
31 tim.tv_nsec = 10000000;
32 nanosleep(&tim, NULL);
33 }
34
28 evas_object_show(btn); 35 evas_object_show(btn);
29 36
37 printf("REALIZE %p\n", obj);
38
30 return EINA_TRUE; 39 return EINA_TRUE;
31} 40}
32 41
33static Eina_Bool 42static Eina_Bool
34_unrealize(void *data, Eo *obj, const Eo_Event_Description2 *desc, void *event) 43_unrealize(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description2 *desc EINA_UNUSED, void *event EINA_UNUSED)
35{ 44{
36 Eo *content; 45 Eo *content;
37 46
@@ -39,13 +48,35 @@ _unrealize(void *data, Eo *obj, const Eo_Event_Description2 *desc, void *event)
39 elm_items_item_content_set(NULL);); 48 elm_items_item_content_set(NULL););
40 evas_object_hide(content); 49 evas_object_hide(content);
41 50
51 printf("UNREALIZE %p\n", obj);
42 return EINA_TRUE; 52 return EINA_TRUE;
43} 53}
44 54
55static void
56on_click(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
57{
58 Eo *item, *it, *root;
59 int number;
60
61 number = elm_spinner_value_get(spinner);
62
63 eo_do(data, root = elm_items_display_tree_get());
64
65 for(int i = 0; i < number; i++)
66 {
67 item = eo_add(ELM_ITEMS_ITEM_CLASS, data);
68 eo_do(item, eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_REALIZE, _realize, NULL);
69 eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_UNREALIZE, _unrealize, NULL));
70 eo_do(item, it = elm_items_item_get());
71 eo_do(root, efl_tree_base_append(it, NULL));
72 evas_object_show(item);
73 }
74}
75
45EAPI_MAIN int 76EAPI_MAIN int
46elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED) 77elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
47{ 78{
48 Evas_Object *win, *ic, *bx; 79 Evas_Object *win, *list, *bx, *toolbox, *o;
49 80
50 elm_need_ethumb(); 81 elm_need_ethumb();
51 elm_need_efreet(); 82 elm_need_efreet();
@@ -55,26 +86,42 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
55 win = elm_win_util_standard_add("efm", "efm - Jesus"); 86 win = elm_win_util_standard_add("efm", "efm - Jesus");
56 evas_object_smart_callback_add(win, "delete,request", on_done, NULL); 87 evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
57 88
58 bx = eo_add(ELM_ITEMS_LIST_CLASS, win); 89 bx = elm_box_add(win);
59 90 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
60 { 91 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 Eo *root, *it;
62 Eo *item;
63
64 eo_do(bx, root = elm_items_display_tree_get());
65
66 for(int i = 0; i < 5000; i++)
67 {
68 item = eo_add(ELM_ITEMS_ITEM_CLASS, bx);
69 eo_do(item, eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_REALIZE, _realize, NULL);
70 eo_event_callback_add(ELM_ITEMS_ITEM_EVENT_UNREALIZE, _unrealize, NULL));
71 eo_do(item, it = elm_items_item_get());
72 eo_do(root, efl_tree_base_append(it, NULL));
73 evas_object_show(item);
74 }
75 }
76 evas_object_show(bx); 92 evas_object_show(bx);
77 93
94 list = eo_add(ELM_ITEMS_LIST_CLASS, win);
95 evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
96 evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
97 evas_object_show(list);
98 elm_box_pack_end(bx, list);
99
100 toolbox = elm_box_add(win);
101 evas_object_size_hint_weight_set(toolbox, EVAS_HINT_EXPAND, 0);
102 evas_object_size_hint_align_set(toolbox, EVAS_HINT_FILL, 0);
103 evas_object_show(toolbox);
104 elm_box_pack_end(bx, toolbox);
105
106 o = elm_check_add(toolbox);
107 elm_object_text_set(o, "Long time realize");
108 elm_check_state_pointer_set(o, &pause_realize);
109 evas_object_show(o);
110 elm_box_pack_end(bx, o);
111
112 spinner = o = elm_spinner_add(toolbox);
113 elm_spinner_value_set(o, 20);
114 elm_spinner_min_max_set(o, 1, 10000);
115 elm_spinner_editable_set(o, EINA_TRUE);
116 evas_object_show(o);
117 elm_box_pack_end(bx, o);
118
119 o = elm_button_add(toolbox);
120 elm_object_text_set(o, "Add");
121 evas_object_show(o);
122 evas_object_smart_callback_add(o, "clicked", on_click, list);
123 elm_box_pack_end(bx, o);
124
78 elm_win_resize_object_add(win, bx); 125 elm_win_resize_object_add(win, bx);
79 evas_object_resize(win, 200,200); 126 evas_object_resize(win, 200,200);
80 evas_object_show(win); 127 evas_object_show(win);