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-09-30 16:38:41 +0200
commit30a799b5e5b9e5d6a5e8de1d5b77338e27329bb7 (patch)
tree451b002b8652ef020ab9007cb74b85308e6d499d
parentf3199ba04bcb6f7dffdeb8b79d22f819dfe0fcd7 (diff)
elm: add basics test to create a destroy *every* widget with errorsdevs/bu5hm4n/test-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.c137
-rw-r--r--src/tests/elementary/meson.build3
4 files changed, 141 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..e66a9ac
--- /dev/null
+++ b/src/tests/elementary/elm_test_widget_basics.c
@@ -0,0 +1,137 @@
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_glview_add, "glview"},
42 {elm_grid_add, "grid"},
43 {elm_hover_add, "hover"},
44 {elm_icon_add, "icon"},
45 {elm_image_add, "image"},
46 {elm_index_add, "index"},
47 {elm_label_add, "label"},
48 {elm_layout_add, "layout"},
49 {elm_list_add, "list"},
50 {elm_map_add, "map"},
51 {elm_mapbuf_add, "mapbuf"},
52 {elm_menu_add, "menu"},
53 {elm_notify_add, "notify"},
54 {elm_panel_add, "panel"},
55 {elm_panes_add, "panes"},
56 {elm_photo_add, "photo"},
57 {elm_photocam_add, "photocam"},
58 {elm_plug_add, "plug"},
59 {elm_prefs_add, "prefs"},
60 {elm_progressbar_add, "progressbar"},
61 {elm_radio_add, "radio"},
62 {elm_route_add, "route"},
63 {elm_separator_add, "seperator"},
64 {elm_slider_add, "slider"},
65 {elm_slideshow_add, "slideshow"},
66 {elm_spinner_add, "spinner"},
67 {elm_table_add, "table"},
68 {elm_textpath_add, "textpath"},
69 {elm_toolbar_add, "toolbar"},
70 {elm_web_add, "web"},
71 {elm_diskselector_add, "diskselector"},
72 {elm_datetime_add, "datetime"},
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 o = simple_widgets[i].constructor(win);
90 ck_assert_ptr_nonnull(o);
91 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
92 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
93 elm_win_resize_object_add(win, o);
94 evas_object_show(o);
95 evas_object_del(o);
96 }
97}
98EFL_END_TEST
99
100EFL_START_TEST(elm_test_widget_creation_error_parent)
101{
102 Evas_Object *win, *o, *parent;
103 Evas *evas;
104
105 win = win_add();
106 evas = evas_object_evas_get(win);
107 evas_object_resize(win, 200, 200);
108 evas_object_show(win);
109
110 parent = evas_object_rectangle_add(evas);
111
112 for (int i = 0; simple_widgets[i].name; ++i)
113 {
114 if (eina_streq(simple_widgets[i].name, "gengrid") ||
115 eina_streq(simple_widgets[i].name, "genlist"))
116 continue;
117 if (eina_streq(simple_widgets[i].name, "datetime")) //this crashes in textblock
118 continue;
119
120 EXPECT_ERROR_START;
121 o = simple_widgets[i].constructor(parent);
122 EXPECT_ERROR_END;
123 ck_assert_ptr_nonnull(o);
124 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
125 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
126 elm_win_resize_object_add(win, o);
127 evas_object_show(o);
128 evas_object_del(o);
129 }
130}
131EFL_END_TEST
132
133void elm_test_widget_basics(TCase *tc)
134{
135 tcase_add_test(tc, elm_test_widget_creation_easy);
136 tcase_add_test(tc, elm_test_widget_creation_error_parent);
137}
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',