summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-27 17:52:53 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-01 11:41:30 +0200
commit7610920ed07b88278375dc03e028a478da43142e (patch)
treec0c9627ca883ed59091438ef997fd60615a70767 /src/bin
parentd02a3ecb663a2691e13f8ea861d3f64b46d4b92e (diff)
elementary_test: add a test to show our frame widget
it does not work yet, but we at least have the chance of seeing it. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D9194
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/meson.build1
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_ui_frame.c55
3 files changed, 58 insertions, 0 deletions
diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build
index 9c26bc3eb4..6c453298f3 100644
--- a/src/bin/elementary/meson.build
+++ b/src/bin/elementary/meson.build
@@ -158,6 +158,7 @@ elementary_test_src = [
158 'test_ui_relative_layout.c', 158 'test_ui_relative_layout.c',
159 'test_ui_item_container.c', 159 'test_ui_item_container.c',
160 'test_ui_items.c', 160 'test_ui_items.c',
161 'test_ui_frame.c',
161 'test.h' 162 'test.h'
162] 163]
163 164
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 5264ab146a..186af020b8 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -402,6 +402,7 @@ void test_efl_ui_radio(void *data, Evas_Object *obj, void *event_info);
402void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info ); 402void test_efl_ui_collection_list(void *data, Evas_Object *obj, void *event_info );
403void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info); 403void test_efl_ui_collection_grid(void *data, Evas_Object *obj, void *event_info);
404void test_efl_ui_item(void *data, Evas_Object *obj, void *event_info); 404void test_efl_ui_item(void *data, Evas_Object *obj, void *event_info);
405void test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED);
405 406
406static void _list_udpate(void); 407static void _list_udpate(void);
407 408
@@ -907,6 +908,7 @@ add_tests:
907 ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list); 908 ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection List", test_efl_ui_collection_list);
908 ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid); 909 ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Collection Grid", test_efl_ui_collection_grid);
909 ADD_TEST_EO(NULL, "Containers", "Items", test_efl_ui_item); 910 ADD_TEST_EO(NULL, "Containers", "Items", test_efl_ui_item);
911 ADD_TEST_EO(NULL, "Containers", "Efl.Ui.Frame", test_ui_frame);
910 912
911 //------------------------------// 913 //------------------------------//
912 ADD_TEST_EO(NULL, "Events", "Event Refeed", test_events); 914 ADD_TEST_EO(NULL, "Events", "Event Refeed", test_events);
diff --git a/src/bin/elementary/test_ui_frame.c b/src/bin/elementary/test_ui_frame.c
new file mode 100644
index 0000000000..84e574778e
--- /dev/null
+++ b/src/bin/elementary/test_ui_frame.c
@@ -0,0 +1,55 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4#include <Efl_Ui.h>
5#include <Elementary.h>
6
7static void
8_inc_clicked(void *data, const Efl_Event *ev EINA_UNUSED)
9{
10 efl_ui_frame_collapse_go(data, EINA_TRUE);
11}
12
13void
14test_ui_frame(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
15{
16 Eo *win, *bx, *f, *txt;
17
18 win = efl_add_ref(EFL_UI_WIN_CLASS, efl_main_loop_get(),
19 efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
20 efl_text_set(efl_added, "Efl.Ui.Frame"),
21 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
22
23 bx = efl_add(EFL_UI_BOX_CLASS, win,
24 efl_content_set(win, efl_added),
25 efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL));
26
27 f = efl_add(EFL_UI_FRAME_CLASS, win,
28 efl_pack_end(bx, efl_added),
29 efl_ui_frame_autocollapse_set(efl_added, EINA_FALSE));
30 efl_text_set(f, "Test 1");
31
32 txt = efl_add(EFL_UI_TEXT_CLASS, f);
33 efl_text_set(txt, "Not collapseable");
34 efl_content_set(f, txt);
35
36 f = efl_add(EFL_UI_FRAME_CLASS, win,
37 efl_pack_end(bx, efl_added),
38 efl_ui_frame_autocollapse_set(efl_added, EINA_TRUE));
39 efl_text_set(f, "Test2");
40
41 txt = efl_add(EFL_UI_TEXT_CLASS, f);
42 efl_text_set(txt, "Collapseable");
43 efl_content_set(f, txt);
44
45 f = efl_add(EFL_UI_FRAME_CLASS, win,
46 efl_pack_end(bx, efl_added));
47 efl_text_set(f, "Test 3");
48
49 efl_add(EFL_UI_BUTTON_CLASS, bx,
50 efl_text_set(efl_added, "frame collapse externally"),
51 efl_event_callback_add(efl_added, EFL_INPUT_EVENT_CLICKED, _inc_clicked, f),
52 efl_content_set(f, efl_added));
53
54 efl_gfx_entity_size_set(win, EINA_SIZE2D(100, 120));
55}