summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-16 13:41:47 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-07-17 10:17:50 -0700
commit4016de252cc73ffccaf0f6f79a113bdbd94800f4 (patch)
tree9516f8b5a548048789d3c378a3fa6fc56b12a36a
parentf97df4212a0a993ac71c27b8cc8871eedb304975 (diff)
elm_test: add comparable "simple" scroller tests
this should be roughly identical and can be more directly compared in terms of performance (which is not good in either case) Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9334
-rw-r--r--src/bin/elementary/test.c3
-rw-r--r--src/bin/elementary/test_scroller.c58
-rw-r--r--src/bin/elementary/test_ui_scroller.c36
3 files changed, 97 insertions, 0 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 3835a63797..0b2904d1dd 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -181,6 +181,7 @@ void test_scroller4(void *data, Evas_Object *obj, void *event_info);
181void test_scroller5(void *data, Evas_Object *obj, void *event_info); 181void test_scroller5(void *data, Evas_Object *obj, void *event_info);
182void test_scroller6(void *data, Evas_Object *obj, void *event_info); 182void test_scroller6(void *data, Evas_Object *obj, void *event_info);
183void test_scroller7(void *data, Evas_Object *obj, void *event_info); 183void test_scroller7(void *data, Evas_Object *obj, void *event_info);
184void test_scroller_simple(void *data, Evas_Object *obj, void *event_info);
184void test_efl_ui_scroller(void *data, Evas_Object *obj, void *event_info); 185void test_efl_ui_scroller(void *data, Evas_Object *obj, void *event_info);
185void test_efl_ui_scroller2(void *data, Evas_Object *obj, void *event_info); 186void test_efl_ui_scroller2(void *data, Evas_Object *obj, void *event_info);
186void test_spinner(void *data, Evas_Object *obj, void *event_info); 187void test_spinner(void *data, Evas_Object *obj, void *event_info);
@@ -1093,7 +1094,9 @@ add_tests:
1093 ADD_TEST(NULL, "Scroller", "Scroller on Popup", test_scroller5); 1094 ADD_TEST(NULL, "Scroller", "Scroller on Popup", test_scroller5);
1094 ADD_TEST(NULL, "Scroller", "Scroller 6", test_scroller6); 1095 ADD_TEST(NULL, "Scroller", "Scroller 6", test_scroller6);
1095 ADD_TEST(NULL, "Scroller", "Scroller 7", test_scroller7); 1096 ADD_TEST(NULL, "Scroller", "Scroller 7", test_scroller7);
1097 ADD_TEST(NULL, "Scroller", "Scroller Simple", test_scroller_simple);
1096 ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller", test_efl_ui_scroller); 1098 ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller", test_efl_ui_scroller);
1099 ADD_TEST_EO(NULL, "Scroller", "Efl.Ui.Scroller Simple", test_efl_ui_scroller2);
1097 1100
1098 //------------------------------// 1101 //------------------------------//
1099 // FIXME: add frame test 1102 // FIXME: add frame test
diff --git a/src/bin/elementary/test_scroller.c b/src/bin/elementary/test_scroller.c
index 3861e924b5..1626564900 100644
--- a/src/bin/elementary/test_scroller.c
+++ b/src/bin/elementary/test_scroller.c
@@ -691,6 +691,64 @@ test_scroller2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
691 } 691 }
692} 692}
693 693
694static void
695_scroll_anim_start(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
696{
697 int x, y;
698 elm_scroller_region_get(obj, &x, &y, NULL, NULL);
699 printf("scroll start: %p x: %d y: %d\n", obj, x, y);
700}
701
702static void
703_scroll_anim_stop(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
704{
705 int x, y;
706 elm_scroller_region_get(obj, &x, &y, NULL, NULL);
707 printf("scroll stop: %p x: %d y: %d\n", obj, x, y);
708}
709
710void
711test_scroller_simple(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
712{
713 Evas_Object *win, *bt, *bx, *sc;
714 int i;
715
716
717 win = elm_win_util_standard_add("scroller2", "Scroller Simple");
718 elm_win_autodel_set(win, EINA_TRUE);
719
720 bx = elm_box_add(win);
721 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0);
722 evas_object_size_hint_align_set(bx, 0.5, 0);
723
724 /* { */
725 sc = elm_scroller_add(win);
726 evas_object_smart_callback_add(sc, "scroll,anim,start", _scroll_anim_start, NULL);
727 evas_object_smart_callback_add(sc, "scroll,anim,stop", _scroll_anim_stop, NULL);
728 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
729 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
730 elm_scroller_bounce_set(sc, EINA_TRUE, EINA_TRUE);
731 evas_object_show(sc);
732 evas_object_show(bx);
733
734 elm_object_content_set(sc, bx);
735 elm_win_resize_object_add(win, sc);
736 /* } */
737
738 for (i = 0; i < 2000; i++)
739 {
740 bt = elm_button_add(win);
741 elm_object_text_set(bt, "Vertical");
742 evas_object_smart_callback_add(bt, "clicked", _click_through, NULL);
743 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
744 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
745 elm_box_pack_end(bx, bt);
746 evas_object_show(bt);
747 }
748 evas_object_resize(win, 320, 400);
749 evas_object_show(win);
750}
751
694static Ecore_Timer *_timer = NULL; 752static Ecore_Timer *_timer = NULL;
695static int _append = 0; 753static int _append = 0;
696static int _count = 0; 754static int _count = 0;
diff --git a/src/bin/elementary/test_ui_scroller.c b/src/bin/elementary/test_ui_scroller.c
index fc47d0706d..84602735c7 100644
--- a/src/bin/elementary/test_ui_scroller.c
+++ b/src/bin/elementary/test_ui_scroller.c
@@ -129,3 +129,39 @@ test_efl_ui_scroller(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
129 efl_pack(bx, efl_added)); 129 efl_pack(bx, efl_added));
130 } 130 }
131} 131}
132
133void
134test_efl_ui_scroller2(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
135{
136 Eo *win, *sc, *bx;
137 int i;
138
139 win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
140 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
141 efl_text_set(efl_added, "Efl Ui Scroller Simple"),
142 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
143 efl_gfx_entity_size_set(win, EINA_SIZE2D(320, 400));
144
145 sc = efl_add(EFL_UI_SCROLLER_CLASS, win,
146 efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
147 efl_event_callback_add(efl_added, EFL_UI_EVENT_SCROLL_START, _scroll_start_cb, NULL),
148 efl_event_callback_add(efl_added, EFL_UI_EVENT_SCROLL_STOP, _scroll_stop_cb, NULL),
149 efl_content_set(win, efl_added));
150
151 bx = efl_add(EFL_UI_BOX_CLASS, sc,
152 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
153 efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0),
154 efl_gfx_hint_align_set(efl_added, 0.5, 0),
155 efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
156 efl_content_set(sc, efl_added));
157
158 for (i = 0; i < 2000; i++)
159 {
160 efl_add(EFL_UI_BUTTON_CLASS, bx,
161 efl_text_set(efl_added, "Vertical"),
162 efl_gfx_hint_weight_set(efl_added, EVAS_HINT_EXPAND, 0.0),
163 efl_gfx_hint_fill_set(efl_added, EINA_TRUE, EINA_FALSE),
164 efl_event_callback_add(efl_added, EFL_UI_EVENT_CLICKED, _bt_clicked, NULL),
165 efl_pack(bx, efl_added));
166 }
167}