efl_ui_layout: use the correct object

the obejct used in D7740 have been false.
Here comes the fix + a few tests.

Reviewed-by: YeongJong Lee <yj34.lee@samsung.com>
Differential Revision: https://phab.enlightenment.org/D7746
This commit is contained in:
Marcel Hollerbach 2019-01-24 09:52:37 +01:00
parent eb10662030
commit 993c843291
2 changed files with 43 additions and 3 deletions

View File

@ -1777,21 +1777,21 @@ EOLIAN Eina_Size2D
_efl_ui_layout_efl_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED, Eina_Size2D restricted)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, restricted);
return efl_layout_calc_size_min(wd->obj, restricted);
return efl_layout_calc_size_min(wd->resize_obj, restricted);
}
EOLIAN Eina_Rect
_efl_ui_layout_efl_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, (Eina_Rect){.rect = {0, 0, 0, 0}});
return efl_layout_calc_parts_extends(wd->obj);
return efl_layout_calc_parts_extends(wd->resize_obj);
}
EOLIAN void
_efl_ui_layout_efl_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Layout_Data *sd EINA_UNUSED)
{
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
efl_layout_calc_force(wd->obj);
efl_layout_calc_force(wd->resize_obj);
}
static Eina_Bool

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#define EFL_LAYOUT_CALC_PROTECTED
#define EFL_ACCESS_OBJECT_BETA
#include <Elementary.h>
#include "elm_suite.h"
@ -117,10 +118,49 @@ EFL_START_TEST(elm_layout_test_model_connect)
}
EFL_END_TEST
EFL_START_TEST(efl_ui_layout_layout_api_size_min)
{
Evas_Object *win;
Eina_Size2D res;
win = win_add(NULL, "layout", ELM_WIN_BASIC);
/* this is just a test to not get segfaults in those calls */
Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win);
res = efl_layout_calc_size_min(layout, EINA_SIZE2D(2, 2));
ck_assert_int_eq(res.w, 2);
ck_assert_int_eq(res.h, 2);
}
EFL_END_TEST
EFL_START_TEST(efl_ui_layout_layout_api_update_hints)
{
Evas_Object *win;
win = win_add(NULL, "layout", ELM_WIN_BASIC);
/* this is just a test to not get segfaults in those calls */
Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win);
efl_layout_calc_auto_update_hints_set(layout, EINA_TRUE);
ck_assert_int_eq(efl_layout_calc_auto_update_hints_get(layout), EINA_TRUE);
}
EFL_END_TEST
EFL_START_TEST(efl_ui_layout_layout_force)
{
Evas_Object *win;
win = win_add(NULL, "layout", ELM_WIN_BASIC);
/* this is just a test to not get segfaults in those calls */
Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win);
efl_layout_calc_force(layout);
}
EFL_END_TEST
void elm_test_layout(TCase *tc)
{
tcase_add_test(tc, elm_layout_test_legacy_type_check);
tcase_add_test(tc, elm_atspi_role_get);
tcase_add_test(tc, elm_layout_test_swallows);
tcase_add_test(tc, elm_layout_test_model_connect);
tcase_add_test(tc, efl_ui_layout_layout_api_size_min);
tcase_add_test(tc, efl_ui_layout_layout_api_update_hints);
tcase_add_test(tc, efl_ui_layout_layout_force);
}