diff options
author | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-05-28 12:01:57 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2019-05-28 12:01:57 -0400 |
commit | 8721caf787ce1a9abb6198f41bfc1a033d4f799a (patch) | |
tree | 2ec813d4f045cfa658302385d4baa36f3f114a43 | |
parent | 52b2701bc3bfb64a3f6ca4ce0b992ac83d7c9e73 (diff) | |
download | efl-8721caf787ce1a9abb6198f41bfc1a033d4f799a.tar.gz |
efl_ui: add a helper for not tollerating errors in a testsuite
Summary:
We now also fail in the focus tests
Depends on D9021
Reviewers: zmike, cedric, segfaultxavi
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D9022
-rw-r--r-- | src/tests/elementary/efl_ui_test_focus.c | 2 | ||||
-rw-r--r-- | src/tests/elementary/efl_ui_test_widget.c | 22 | ||||
-rw-r--r-- | src/tests/elementary/elm_test_genlist.c | 13 | ||||
-rw-r--r-- | src/tests/elementary/spec/efl_ui_spec_suite.c | 18 | ||||
-rwxr-xr-x | src/tests/elementary/spec/generator.py | 2 | ||||
-rw-r--r-- | src/tests/elementary/suite_helpers.c | 18 | ||||
-rw-r--r-- | src/tests/elementary/suite_helpers.h | 2 |
7 files changed, 28 insertions, 49 deletions
diff --git a/src/tests/elementary/efl_ui_test_focus.c b/src/tests/elementary/efl_ui_test_focus.c index 38a2ac0200..8e754592e8 100644 --- a/src/tests/elementary/efl_ui_test_focus.c +++ b/src/tests/elementary/efl_ui_test_focus.c @@ -1,4 +1,5 @@ #include "efl_ui_test_focus_common.h" +#include "suite_helpers.h" EFL_START_TEST(focus_unregister_twice) { @@ -1072,6 +1073,7 @@ EFL_END_TEST void efl_ui_test_focus(TCase *tc) { + tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); tcase_add_test(tc, focus_register_twice); tcase_add_test(tc, focus_unregister_twice); tcase_add_test(tc, pos_check); diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c index 00e5293eff..79d172fa14 100644 --- a/src/tests/elementary/efl_ui_test_widget.c +++ b/src/tests/elementary/efl_ui_test_widget.c @@ -7,6 +7,7 @@ #include <Efl_Ui.h> #include "efl_ui_suite.h" #include "eo_internal.h" +#include "suite_helpers.h" EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS) @@ -326,25 +327,6 @@ EFL_START_TEST(efl_ui_test_widget_disabled_behaviour) } EFL_END_TEST -static int tree_abort; -static int tree_abort_level; - -static void -_shutdown(void) -{ - eina_log_abort_on_critical_set(tree_abort); - eina_log_abort_on_critical_level_set(tree_abort_level); -} - -static void -_setup(void) -{ - tree_abort = eina_log_abort_on_critical_get(); - tree_abort_level = eina_log_abort_on_critical_level_get(); - eina_log_abort_on_critical_level_set(2); - eina_log_abort_on_critical_set(1); -} - EFL_START_TEST(efl_ui_test_widget_win_provider_find) { State s; @@ -359,7 +341,7 @@ EFL_END_TEST void efl_ui_test_widget(TCase *tc) { - tcase_add_checked_fixture(tc, _setup, _shutdown); + tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); tcase_add_test(tc, efl_ui_test_widget_parent_iterator); tcase_add_test(tc, efl_ui_test_widget_widget_iterator); tcase_add_test(tc, efl_ui_test_widget_widget_sub_iterator); diff --git a/src/tests/elementary/elm_test_genlist.c b/src/tests/elementary/elm_test_genlist.c index 1ffec17647..2fea52e4c8 100644 --- a/src/tests/elementary/elm_test_genlist.c +++ b/src/tests/elementary/elm_test_genlist.c @@ -6,6 +6,7 @@ #define EFL_ACCESS_OBJECT_PROTECTED #include <Elementary.h> #include "elm_suite.h" +#include "suite_helpers.h" static Evas_Object *win, *genlist; static Elm_Gen_Item_Class itc = { .version = ELM_GENLIST_ITEM_CLASS_VERSION }; @@ -14,9 +15,6 @@ static int counter; static Efl_Access_Event_Children_Changed_Data ev_data; Evas_Object *content; -static int tree_abort_level; -static int tree_abort; - static void verify_item_iteration_api(Elm_Object_Item *parent) { @@ -452,8 +450,7 @@ static void _do_quit() { itc.func.content_get = NULL; - eina_log_abort_on_critical_set(tree_abort); - eina_log_abort_on_critical_level_set(tree_abort_level); + fail_on_errors_teardown(); ecore_main_loop_quit(); } @@ -513,11 +510,7 @@ EFL_START_TEST(elm_genlist_test_tree_expand) evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS); evas_object_show(win); evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS); - tree_abort = eina_log_abort_on_critical_get(); - tree_abort_level = eina_log_abort_on_critical_level_get(); - /* this should never trigger errors */ - eina_log_abort_on_critical_level_set(1); - eina_log_abort_on_critical_set(1); + fail_on_errors_setup(); ecore_main_loop_begin(); } EFL_END_TEST diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.c b/src/tests/elementary/spec/efl_ui_spec_suite.c index 9dd476528d..5c98af28a5 100644 --- a/src/tests/elementary/spec/efl_ui_spec_suite.c +++ b/src/tests/elementary/spec/efl_ui_spec_suite.c @@ -12,24 +12,6 @@ Evas_Object *win = NULL; Evas_Object *widget = NULL; const Efl_Class *test_content_klass = NULL; EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS); -static int tree_abort; -static int tree_abort_level; - -static void -_shutdown(void) -{ - eina_log_abort_on_critical_set(tree_abort); - eina_log_abort_on_critical_level_set(tree_abort_level); -} - -static void -_setup(void) -{ - tree_abort = eina_log_abort_on_critical_get(); - tree_abort_level = eina_log_abort_on_critical_level_get(); - eina_log_abort_on_critical_level_set(2); - eina_log_abort_on_critical_set(1); -} static void _setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass) diff --git a/src/tests/elementary/spec/generator.py b/src/tests/elementary/spec/generator.py index 15042d3afd..c11ab21fdd 100755 --- a/src/tests/elementary/spec/generator.py +++ b/src/tests/elementary/spec/generator.py @@ -13,7 +13,7 @@ static void {}(TCase *tc) {{ tcase_add_checked_fixture(tc, _{}_fixture, NULL); - tcase_add_checked_fixture(tc, _setup, _shutdown); + tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown); {}(tc); }} diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index a57ae493fa..e5d43c38b9 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -16,6 +16,8 @@ static Eina_Bool did_shutdown; static Evas_Object *global_win; static Eina_Bool buffer = EINA_FALSE; static Eina_Bool legacy_mode = EINA_FALSE; +static int log_abort; +static int log_abort_level; void elm_test_init(TCase *tc); @@ -340,3 +342,19 @@ suite_setup(Eina_Bool legacy) } return 0; } + +void +fail_on_errors_teardown(void) +{ + eina_log_abort_on_critical_set(log_abort); + eina_log_abort_on_critical_level_set(log_abort_level); +} + +void +fail_on_errors_setup(void) +{ + log_abort = eina_log_abort_on_critical_get(); + log_abort_level = eina_log_abort_on_critical_level_get(); + eina_log_abort_on_critical_level_set(2); + eina_log_abort_on_critical_set(1); +} diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h index 903fa02929..75cc0487d3 100644 --- a/src/tests/elementary/suite_helpers.h +++ b/src/tests/elementary/suite_helpers.h @@ -7,5 +7,7 @@ int suite_setup(Eina_Bool legacy); void _elm2_suite_init(void); void _elm_suite_shutdown(void); void *real_timer_add(double in, Ecore_Task_Cb cb, void *data); +void fail_on_errors_teardown(void); +void fail_on_errors_setup(void); #endif |