2014-06-10 19:07:15 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
2018-04-03 04:27:30 -07:00
|
|
|
#define EFL_ACCESS_OBJECT_BETA
|
2014-06-10 19:07:15 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_suite.h"
|
|
|
|
|
2019-01-11 07:45:26 -08:00
|
|
|
EFL_START_TEST(elm_layout_test_legacy_type_check)
|
2018-02-14 12:04:24 -08:00
|
|
|
{
|
|
|
|
Evas_Object *win, *layout;
|
|
|
|
const char *type;
|
|
|
|
|
2018-04-27 05:59:04 -07:00
|
|
|
win = win_add(NULL, "layout", ELM_WIN_BASIC);
|
2018-02-14 12:04:24 -08:00
|
|
|
|
|
|
|
layout = elm_layout_add(win);
|
|
|
|
|
|
|
|
type = elm_object_widget_type_get(layout);
|
|
|
|
ck_assert(type != NULL);
|
|
|
|
ck_assert(!strcmp(type, "Elm_Layout"));
|
|
|
|
|
|
|
|
type = evas_object_type_get(layout);
|
|
|
|
ck_assert(type != NULL);
|
|
|
|
ck_assert(!strcmp(type, "elm_layout"));
|
|
|
|
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2014-06-10 19:07:15 -07:00
|
|
|
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_START_TEST(elm_atspi_role_get)
|
2014-06-10 19:07:15 -07:00
|
|
|
{
|
|
|
|
Evas_Object *win, *layout;
|
2017-10-18 18:13:54 -07:00
|
|
|
Efl_Access_Role role;
|
2014-06-10 19:07:15 -07:00
|
|
|
|
2018-04-27 05:59:04 -07:00
|
|
|
win = win_add(NULL, "layout", ELM_WIN_BASIC);
|
2014-06-10 19:07:15 -07:00
|
|
|
|
|
|
|
layout = elm_layout_add(win);
|
2018-04-03 04:27:30 -07:00
|
|
|
role = efl_access_object_role_get(layout);
|
2014-06-10 19:07:15 -07:00
|
|
|
|
2017-10-18 18:13:54 -07:00
|
|
|
ck_assert(role == EFL_ACCESS_ROLE_FILLER);
|
2014-06-10 19:07:15 -07:00
|
|
|
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2014-06-10 19:07:15 -07:00
|
|
|
|
2019-01-11 07:45:26 -08:00
|
|
|
EFL_START_TEST(elm_layout_test_swallows)
|
2016-04-15 07:06:41 -07:00
|
|
|
{
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
Evas_Object *win, *ly, *bt, *bt2;
|
|
|
|
|
2018-04-27 05:59:04 -07:00
|
|
|
win = win_add(NULL, "layout", ELM_WIN_BASIC);
|
2016-04-15 07:06:41 -07:00
|
|
|
|
2019-01-29 09:07:54 -08:00
|
|
|
ly = elm_layout_add(win);
|
2016-04-15 07:06:41 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR);
|
|
|
|
elm_layout_file_set(ly, buf, "layout");
|
|
|
|
evas_object_show(ly);
|
|
|
|
|
2019-01-29 09:07:54 -08:00
|
|
|
bt = elm_button_add(ly);
|
|
|
|
fail_if(!elm_layout_content_set(ly, "element1", bt));
|
2016-08-10 07:23:04 -07:00
|
|
|
ck_assert_ptr_eq(efl_parent_get(bt), ly);
|
2016-04-15 07:06:41 -07:00
|
|
|
|
2019-01-29 09:07:54 -08:00
|
|
|
bt = elm_object_part_content_unset(ly, "element1");
|
2016-08-10 07:23:04 -07:00
|
|
|
ck_assert_ptr_eq(efl_parent_get(bt), evas_object_evas_get(bt));
|
2016-04-15 07:06:41 -07:00
|
|
|
|
2019-01-29 09:07:54 -08:00
|
|
|
fail_if(!elm_layout_content_set(ly, "element1", bt));
|
2016-08-10 07:23:04 -07:00
|
|
|
ck_assert_ptr_eq(efl_parent_get(bt), ly);
|
2016-04-15 07:06:41 -07:00
|
|
|
|
2019-01-29 09:07:54 -08:00
|
|
|
bt2 = elm_button_add(ly);
|
|
|
|
fail_if(!elm_layout_content_set(ly, "element1", bt2));
|
2016-08-10 07:23:04 -07:00
|
|
|
ck_assert_ptr_eq(efl_parent_get(bt2), ly);
|
2016-04-15 07:06:41 -07:00
|
|
|
|
|
|
|
}
|
2018-03-26 11:19:28 -07:00
|
|
|
EFL_END_TEST
|
2016-04-15 07:06:41 -07:00
|
|
|
|
2014-06-10 19:07:15 -07:00
|
|
|
void elm_test_layout(TCase *tc)
|
|
|
|
{
|
2019-01-11 07:45:26 -08:00
|
|
|
tcase_add_test(tc, elm_layout_test_legacy_type_check);
|
2016-04-15 06:10:35 -07:00
|
|
|
tcase_add_test(tc, elm_atspi_role_get);
|
2019-01-11 07:45:26 -08:00
|
|
|
tcase_add_test(tc, elm_layout_test_swallows);
|
2014-06-10 19:07:15 -07:00
|
|
|
}
|