tasn pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=cd26435434efb8c84bac15f0ade75a149b6c83c4

commit cd26435434efb8c84bac15f0ade75a149b6c83c4
Author: Tom Hacohen <t...@stosb.com>
Date:   Fri Apr 15 15:06:41 2016 +0100

    Elm layout: Add parent updating tests to elm layout.
---
 src/Makefile_Elementary.am             |  1 +
 src/tests/elementary/elm_test_layout.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 17c5f79..00427ba 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -1232,6 +1232,7 @@ tests_elementary_elm_suite_SOURCES = \
 tests_elementary_elm_suite_CPPFLAGS = \
        -DTESTS_BUILD_DIR=\"${top_builddir}/src/tests/elementary\" \
        -DELM_IMAGE_DATA_DIR=\"${top_srcdir}/data/elementary\" \
+       -DELM_TEST_DATA_DIR=\"${abs_top_builddir}/data/elementary\" \
        -I$(top_srcdir)/src/lib/elementary \
        -I$(top_builddir)/src/lib/elementary \
        @CHECK_CFLAGS@ \
diff --git a/src/tests/elementary/elm_test_layout.c 
b/src/tests/elementary/elm_test_layout.c
index 923ce32..e90390a 100644
--- a/src/tests/elementary/elm_test_layout.c
+++ b/src/tests/elementary/elm_test_layout.c
@@ -24,7 +24,41 @@ START_TEST(elm_atspi_role_get)
 }
 END_TEST
 
+START_TEST(elm_layout_swallows)
+{
+   char buf[PATH_MAX];
+   Evas_Object *win, *ly, *bt, *bt2;
+
+   elm_init(1, NULL);
+   win = elm_win_add(NULL, "layout", ELM_WIN_BASIC);
+
+   ly = eo_add(ELM_LAYOUT_CLASS, win);
+   snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR);
+   elm_layout_file_set(ly, buf, "layout");
+   evas_object_show(ly);
+
+   bt = eo_add(ELM_BUTTON_CLASS, ly);
+   fail_if(!elm_obj_container_content_set(ly, "element1", bt));
+   ck_assert_ptr_eq(eo_parent_get(bt), ly);
+
+   bt = elm_obj_container_content_unset(ly, "element1");
+   ck_assert_ptr_eq(eo_parent_get(bt), evas_common_evas_get(bt));
+
+   fail_if(!elm_obj_container_content_set(ly, "element1", bt));
+   ck_assert_ptr_eq(eo_parent_get(bt), ly);
+
+   bt2 = eo_add(ELM_BUTTON_CLASS, ly);
+   fail_if(!elm_obj_container_content_set(ly, "element1", bt2));
+   ck_assert_ptr_eq(eo_parent_get(bt2), ly);
+   /* bt is deleted at this point. */
+   ck_assert_ptr_eq(eo_parent_get(bt), evas_common_evas_get(bt));
+
+   elm_shutdown();
+}
+END_TEST
+
 void elm_test_layout(TCase *tc)
 {
    tcase_add_test(tc, elm_atspi_role_get);
+   tcase_add_test(tc, elm_layout_swallows);
 }

-- 


Reply via email to