From e0ab85cff942f2ca8b2c2882661439641d02e032 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Mon, 9 Dec 2019 18:45:37 +0100 Subject: [PATCH] efl_ui_spec_test: make this test work I do not know what i was thinking when i initially wrote that test. It never worked, the test created a widget captured all elements, deleted the widget, then checked if there are elements left that are not knon on the canvas yet. Not the test first captures all elements, then creates the widget, then deletes the widget, and checks if there are more elements than expected. This found all the fix leaks prior to this leak. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D10842 --- src/tests/elementary/spec/efl_test_basics.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/elementary/spec/efl_test_basics.c b/src/tests/elementary/spec/efl_test_basics.c index 0985adb43c..99a441c059 100644 --- a/src/tests/elementary/spec/efl_test_basics.c +++ b/src/tests/elementary/spec/efl_test_basics.c @@ -66,6 +66,8 @@ EFL_START_TEST(no_leaking_canvas_object) Eina_Iterator *iter = eo_objects_iterator_new(); Eo *obj; + if (efl_isa(widget, EFL_UI_FLIP_CLASS)) return; //FIXME Flip needs more work for this. However, flip should be redone as a spotlight manager, When this is done, we can add these classes to the check here. + EINA_ITERATOR_FOREACH(iter, obj) { if (!efl_alive_get(obj)) continue; @@ -75,6 +77,12 @@ EFL_START_TEST(no_leaking_canvas_object) } eina_iterator_free(iter); + //Just overwrite the widget pointer, and expect errors, if any error is happening here, we are not interested in it, another testcase will take care of them + EXPECT_ERROR_START; + widget = efl_add(widget_klass, win); + expect_error_start = EINA_TRUE; + EXPECT_ERROR_END; + //now try to will those widgets if (efl_isa(widget, EFL_PACK_LINEAR_INTERFACE)) { @@ -105,7 +113,10 @@ EFL_START_TEST(no_leaking_canvas_object) if (!efl_alive_get(obj)) continue; if (!efl_isa(obj, EFL_CANVAS_OBJECT_CLASS)) continue; - ck_assert_ptr_ne(eina_list_data_find(not_invalidate, obj), NULL); + if (eina_list_data_find(not_invalidate, obj) == NULL) + { + ck_abort_msg("Leak detected %s Evas-Parent: %s", efl_debug_name_get(obj), efl_class_name_get(efl_canvas_object_render_parent_get(obj))); + } } eina_iterator_free(iter);