stefan pushed a commit to branch master.

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

commit 633a2e506cf8f98dc2a1d79d402c00df1fde1d19
Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Jan 29 12:07:54 2019 -0500

    tests: move efl_ui_layout tests into efl_ui_suite
    
    also use legacy api for elm_layout swallow test
    
    ref T6815
    
    Reviewed-by: Stefan Schmidt <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D7824
---
 src/Makefile_Elementary.am                |   3 +-
 src/tests/elementary/efl_ui_suite.c       |   1 +
 src/tests/elementary/efl_ui_suite.h       |   1 +
 src/tests/elementary/efl_ui_test_layout.c |  99 +++++++++++++++++++++++++++++
 src/tests/elementary/elm_test_layout.c    | 102 ++----------------------------
 src/tests/elementary/meson.build          |   1 +
 6 files changed, 111 insertions(+), 96 deletions(-)

diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index db06766362..da52460707 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -1610,7 +1610,8 @@ tests_elementary_efl_ui_suite_SOURCES = \
        tests/elementary/elm_test_init.c \
        tests/elementary/efl_ui_test_atspi.c \
        tests/elementary/efl_ui_test_image_zoomable.c \
-       tests/elementary/efl_ui_test_grid.c
+       tests/elementary/efl_ui_test_grid.c \
+       tests/elementary/efl_ui_test_layout.c
 
 tests_elementary_efl_ui_suite_CPPFLAGS = \
 -DELM_INTERNAL_API_ARGESFSDFEFC=1 \
diff --git a/src/tests/elementary/efl_ui_suite.c 
b/src/tests/elementary/efl_ui_suite.c
index 1fc0b49c6b..b98df8a03a 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -15,6 +15,7 @@ static const Efl_Test_Case etc[] = {
   { "efl_ui_atspi", efl_ui_test_atspi},
   { "efl_ui_grid", efl_ui_test_grid},
   { "efl_ui_image_zoomable", efl_ui_test_image_zoomable},
+  { "efl_ui_layout", efl_ui_test_layout},
   { NULL, NULL }
 };
 
diff --git a/src/tests/elementary/efl_ui_suite.h 
b/src/tests/elementary/efl_ui_suite.h
index 0fabdcfd47..35cd13f845 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -19,6 +19,7 @@
 void efl_ui_test_grid(TCase *tc);
 void efl_ui_test_atspi(TCase *tc);
 void efl_ui_test_image_zoomable(TCase *tc);
+void efl_ui_test_layout(TCase *tc);
 
 Eo *win_add();
 Eo *win_add_focused();
diff --git a/src/tests/elementary/efl_ui_test_layout.c 
b/src/tests/elementary/efl_ui_test_layout.c
new file mode 100644
index 0000000000..45f603b958
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_layout.c
@@ -0,0 +1,99 @@
+#define EFL_NOLEGACY_API_SUPPORT
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#define EFL_LAYOUT_CALC_PROTECTED
+#include <Efl_Ui.h>
+#include "efl_ui_suite.h"
+
+static Eina_Value
+_propagated_cb(void *data EINA_UNUSED,
+               const Eina_Value v,
+               const Eina_Future *dead_future EINA_UNUSED)
+{
+   ecore_main_loop_quit();
+
+   fprintf(stderr, "delivered '%s'\n", eina_value_to_string(&v));
+
+   return v;
+}
+
+EFL_START_TEST(efl_ui_layout_test_model_connect)
+{
+   char buf[PATH_MAX];
+   Evas_Object *win, *ly;
+   Efl_Model_Item *model;
+   Eina_Value v;
+   Eina_Future *f;
+   const char *part_text;
+   const char text_value[] = "A random string for elm_layout_model_connect 
test";
+
+   win = win_add(NULL, "layout", EFL_UI_WIN_BASIC);
+
+   ly = efl_add(EFL_UI_LAYOUT_CLASS, win);
+   snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR);
+   efl_file_set(ly, buf, "layout");
+   efl_gfx_entity_visible_set(ly, EINA_TRUE);
+
+   model = efl_add(EFL_MODEL_ITEM_CLASS, win);
+   ck_assert(!!eina_value_setup(&v, EINA_VALUE_TYPE_STRING));
+   ck_assert(!!eina_value_set(&v, text_value));
+   f = efl_model_property_set(model, "text_property", &v);
+   eina_future_then(f, _propagated_cb, NULL, NULL);
+
+   efl_ui_model_connect(ly, "text", "text_property");
+   efl_ui_view_model_set(ly, model);
+
+   ecore_main_loop_begin();
+
+   part_text = efl_text_get(efl_part(ly, "text"));
+
+   ck_assert_str_eq(part_text, text_value);
+
+}
+EFL_END_TEST
+
+EFL_START_TEST(efl_ui_layout_test_layout_api_size_min)
+{
+   Evas_Object *win;
+   Eina_Size2D res;
+
+   win = win_add(NULL, "layout", EFL_UI_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_test_layout_api_update_hints)
+{
+   Evas_Object *win;
+
+   win = win_add(NULL, "layout", EFL_UI_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_test_layout_force)
+{
+   Evas_Object *win;
+
+   win = win_add(NULL, "layout", EFL_UI_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 efl_ui_test_layout(TCase *tc)
+{
+   tcase_add_test(tc, efl_ui_layout_test_model_connect);
+   tcase_add_test(tc, efl_ui_layout_test_layout_api_size_min);
+   tcase_add_test(tc, efl_ui_layout_test_layout_api_update_hints);
+   tcase_add_test(tc, efl_ui_layout_test_layout_force);
+}
diff --git a/src/tests/elementary/elm_test_layout.c 
b/src/tests/elementary/elm_test_layout.c
index 998ec55ef2..5184086538 100644
--- a/src/tests/elementary/elm_test_layout.c
+++ b/src/tests/elementary/elm_test_layout.c
@@ -2,7 +2,6 @@
 # include "elementary_config.h"
 #endif
 
-#define EFL_LAYOUT_CALC_PROTECTED
 #define EFL_ACCESS_OBJECT_BETA
 #include <Elementary.h>
 #include "elm_suite.h"
@@ -49,118 +48,31 @@ EFL_START_TEST(elm_layout_test_swallows)
 
    win = win_add(NULL, "layout", ELM_WIN_BASIC);
 
-   ly = efl_add(EFL_UI_LAYOUT_CLASS, win);
+   ly = elm_layout_add(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 = efl_add(EFL_UI_BUTTON_CLASS, ly);
-   fail_if(!efl_content_set(efl_part(ly, "element1"), bt));
+   bt = elm_button_add(ly);
+   fail_if(!elm_layout_content_set(ly, "element1", bt));
    ck_assert_ptr_eq(efl_parent_get(bt), ly);
 
-   bt = efl_content_unset(efl_part(ly, "element1"));
+   bt = elm_object_part_content_unset(ly, "element1");
    ck_assert_ptr_eq(efl_parent_get(bt), evas_object_evas_get(bt));
 
-   fail_if(!efl_content_set(efl_part(ly, "element1"), bt));
+   fail_if(!elm_layout_content_set(ly, "element1", bt));
    ck_assert_ptr_eq(efl_parent_get(bt), ly);
 
-   bt2 = efl_add(EFL_UI_BUTTON_CLASS, ly);
-   fail_if(!efl_content_set(efl_part(ly, "element1"), bt2));
+   bt2 = elm_button_add(ly);
+   fail_if(!elm_layout_content_set(ly, "element1", bt2));
    ck_assert_ptr_eq(efl_parent_get(bt2), ly);
 
 }
 EFL_END_TEST
 
-static Eina_Value
-_propagated_cb(void *data EINA_UNUSED,
-               const Eina_Value v,
-               const Eina_Future *dead_future EINA_UNUSED)
-{
-   ecore_main_loop_quit();
-
-   fprintf(stderr, "delivered '%s'\n", eina_value_to_string(&v));
-
-   return v;
-}
-
-EFL_START_TEST(elm_layout_test_model_connect)
-{
-   char buf[PATH_MAX];
-   Evas_Object *win, *ly;
-   Efl_Model_Item *model;
-   Eina_Value v;
-   Eina_Future *f;
-   const char *part_text;
-   const char text_value[] = "A random string for elm_layout_model_connect 
test";
-
-   win = win_add(NULL, "layout", ELM_WIN_BASIC);
-
-   ly = efl_add(EFL_UI_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);
-
-   model = efl_add(EFL_MODEL_ITEM_CLASS, win);
-   ck_assert(!!eina_value_setup(&v, EINA_VALUE_TYPE_STRING));
-   ck_assert(!!eina_value_set(&v, text_value));
-   f = efl_model_property_set(model, "text_property", &v);
-   eina_future_then(f, _propagated_cb, NULL, NULL);
-
-   efl_ui_model_connect(ly, "text", "text_property");
-   efl_ui_view_model_set(ly, model);
-
-   ecore_main_loop_begin();
-
-   part_text = elm_layout_text_get(ly, "text");
-
-   ck_assert_str_eq(part_text, text_value);
-
-}
-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);
 }
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index 4821f3bbe3..097590ef05 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -123,6 +123,7 @@ efl_ui_suite_src = [
   'efl_ui_test_atspi.c',
   'efl_ui_test_grid.c',
   'efl_ui_test_image_zoomable.c',
+  'efl_ui_test_layout.c',
 ]
 
 efl_ui_suite = executable('efl_ui_suite',

-- 


Reply via email to