summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-25 19:14:50 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-10-01 15:37:32 +0200
commit628842e386b01faae5373c9ab5005883ec68cea7 (patch)
tree33be6241f13d37d5be1690f1b381f347d170bc4e
parentc1ffcff1d3c3da399404d1b9a0f125d6d3020bac (diff)
elm: add basics test to create a destroy *every* widget with errorsdevs/bu5hm4n/build-try
this simply creates packs, resizes, and destroys every single widget that we have in legacy elm. This i made to ensure that there are no mistakes in the construction chain. Additionally, a second test case checks that creation with none elm parents is erroring but not failing, this seems weird, but we have provided that in the past, so we should continue providing this. Differential Revision: https://phab.enlightenment.org/D10088
-rw-r--r--src/tests/elementary/elm_suite.c1
-rw-r--r--src/tests/elementary/elm_suite.h1
-rw-r--r--src/tests/elementary/elm_test_widget_basics.c140
-rw-r--r--src/tests/elementary/meson.build3
4 files changed, 144 insertions, 1 deletions
diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c
index 87fac6e..d6aa463 100644
--- a/src/tests/elementary/elm_suite.c
+++ b/src/tests/elementary/elm_suite.c
@@ -86,6 +86,7 @@ static const Efl_Test_Case etc[] = {
86 { "elm_code_widget_selection", elm_code_test_widget_selection }, 86 { "elm_code_widget_selection", elm_code_test_widget_selection },
87 { "elm_code_widget_undo", elm_code_test_widget_undo }, 87 { "elm_code_widget_undo", elm_code_test_widget_undo },
88 { "elm_widget_focus", elm_test_widget_focus}, 88 { "elm_widget_focus", elm_test_widget_focus},
89 { "elm_widget_basics", elm_test_widget_basics},
89 { NULL, NULL } 90 { NULL, NULL }
90}; 91};
91 92
diff --git a/src/tests/elementary/elm_suite.h b/src/tests/elementary/elm_suite.h
index ba76b29..67f5d0d 100644
--- a/src/tests/elementary/elm_suite.h
+++ b/src/tests/elementary/elm_suite.h
@@ -84,6 +84,7 @@ void elm_test_slideshow(TCase *tc);
84void elm_test_spinner(TCase *tc); 84void elm_test_spinner(TCase *tc);
85void elm_test_plug(TCase *tc); 85void elm_test_plug(TCase *tc);
86void elm_test_widget_focus(TCase *tc); 86void elm_test_widget_focus(TCase *tc);
87void elm_test_widget_basics(TCase *tc);
87 88
88void elm_code_file_test_load(TCase *tc); 89void elm_code_file_test_load(TCase *tc);
89void elm_code_file_test_memory(TCase *tc); 90void elm_code_file_test_memory(TCase *tc);
diff --git a/src/tests/elementary/elm_test_widget_basics.c b/src/tests/elementary/elm_test_widget_basics.c
new file mode 100644
index 0000000..e6f1c7f
--- /dev/null
+++ b/src/tests/elementary/elm_test_widget_basics.c
@@ -0,0 +1,140 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#include <Elementary.h>
6#include "elm_suite.h"
7
8typedef struct _Simple_Test_Widget
9{
10 Evas_Object* (*constructor)(Evas_Object *win);
11 const char *name;
12} Simple_Test_Widget;
13
14
15static const Simple_Test_Widget simple_widgets[] = {
16 {elm_flip_add, "flip"},
17 {elm_frame_add, "frame"},
18 {elm_player_add, "player"},
19 {elm_video_add, "video"},
20 {elm_ctxpopup_add, "ctxpopup"},
21 {elm_fileselector_add, "fileselector"},
22 {elm_hoversel_add, "hoversel"},
23 {elm_multibuttonentry_add, "multibuttonentry"},
24 {elm_naviframe_add, "naviframe"},
25 {elm_popup_add, "popup"},
26 {elm_actionslider_add, "actionslider"},
27 {elm_bg_add, "bg"},
28 {elm_box_add, "box"},
29 {elm_bubble_add, "bubble"},
30 {elm_calendar_add, "calendar"},
31 {elm_button_add, "button"},
32 {elm_check_add, "check"},
33 {elm_clock_add, "clock"},
34 {elm_colorselector_add, "colorselector"},
35 {elm_conformant_add, "conformant"},
36 {elm_dayselector_add, "dayselector"},
37 {elm_entry_add, "entry"},
38 {elm_flipselector_add, "flipselector"},
39 {elm_gengrid_add, "gengrid"},
40 {elm_genlist_add, "genlist"},
41 {elm_grid_add, "grid"},
42 {elm_hover_add, "hover"},
43 {elm_icon_add, "icon"},
44 {elm_image_add, "image"},
45 {elm_index_add, "index"},
46 {elm_label_add, "label"},
47 {elm_layout_add, "layout"},
48 {elm_list_add, "list"},
49 {elm_map_add, "map"},
50 {elm_mapbuf_add, "mapbuf"},
51 {elm_menu_add, "menu"},
52 {elm_notify_add, "notify"},
53 {elm_panel_add, "panel"},
54 {elm_panes_add, "panes"},
55 {elm_photo_add, "photo"},
56 {elm_photocam_add, "photocam"},
57 {elm_plug_add, "plug"},
58 {elm_prefs_add, "prefs"},
59 {elm_progressbar_add, "progressbar"},
60 {elm_radio_add, "radio"},
61 {elm_route_add, "route"},
62 {elm_separator_add, "seperator"},
63 {elm_slider_add, "slider"},
64 {elm_slideshow_add, "slideshow"},
65 {elm_spinner_add, "spinner"},
66 {elm_table_add, "table"},
67 {elm_textpath_add, "textpath"},
68 {elm_toolbar_add, "toolbar"},
69 {elm_web_add, "web"},
70 {elm_diskselector_add, "diskselector"},
71 {elm_datetime_add, "datetime"},
72 //{elm_glview_add, "glview"}, This can cause errors on some CI platforms, because the gl drivers there are not working properly
73 //{elm_combobox_add, "button"}, This is a beta widget which was never public and is written in a few ways that break basic assertions of widgets base class
74 //{elm_thumb_add, "button"}, This dies because of a ethumb bug, where the log domain is not correctly inited
75 //{elm_systray_add, "button"}, This is not a elm widget, but matches the API regax
76 //{elm_factory_add, "button"}, This is a beta widget which was never public but matches the API regax
77 {NULL, NULL},
78};
79
80EFL_START_TEST(elm_test_widget_creation_easy)
81{
82 Evas_Object *win, *o;
83 win = win_add();
84
85 evas_object_resize(win, 200, 200);
86 evas_object_show(win);
87 for (int i = 0; simple_widgets[i].name; ++i)
88 {
89 printf("B: %s\n", simple_widgets[i].name);
90 o = simple_widgets[i].constructor(win);
91 ck_assert_ptr_nonnull(o);
92 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
94 elm_win_resize_object_add(win, o);
95 evas_object_show(o);
96 evas_object_del(o);
97 }
98}
99EFL_END_TEST
100
101EFL_START_TEST(elm_test_widget_creation_error_parent)
102{
103 Evas_Object *win, *o, *parent;
104 Evas *evas;
105
106 win = win_add();
107 evas = evas_object_evas_get(win);
108 evas_object_resize(win, 200, 200);
109 evas_object_show(win);
110
111 parent = evas_object_rectangle_add(evas);
112
113 for (int i = 0; simple_widgets[i].name; ++i)
114 {
115 if (eina_streq(simple_widgets[i].name, "gengrid") ||
116 eina_streq(simple_widgets[i].name, "genlist"))
117 continue;
118 if (eina_streq(simple_widgets[i].name, "datetime")) //this crashes in textblock
119 continue;
120
121 printf("A: %s\n", simple_widgets[i].name);
122
123 EXPECT_ERROR_START;
124 o = simple_widgets[i].constructor(parent);
125 EXPECT_ERROR_END;
126 ck_assert_ptr_nonnull(o);
127 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
128 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
129 elm_win_resize_object_add(win, o);
130 evas_object_show(o);
131 evas_object_del(o);
132 }
133}
134EFL_END_TEST
135
136void elm_test_widget_basics(TCase *tc)
137{
138 tcase_add_test(tc, elm_test_widget_creation_easy);
139 tcase_add_test(tc, elm_test_widget_creation_error_parent);
140}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index f7d56d7..5495315 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -99,7 +99,8 @@ elementary_suite_src = [
99 'elm_code_test_widget_text.c', 99 'elm_code_test_widget_text.c',
100 'elm_code_test_widget_selection.c', 100 'elm_code_test_widget_selection.c',
101 'elm_code_test_widget_undo.c', 101 'elm_code_test_widget_undo.c',
102 'elm_test_widget_focus.c' 102 'elm_test_widget_focus.c',
103 'elm_test_widget_basics.c'
103] 104]
104 105
105elementary_suite = executable('elementary_suite', 106elementary_suite = executable('elementary_suite',