elementary: add a test for Efl.Model_provider.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D9295
This commit is contained in:
Cedric BAIL 2019-07-11 15:03:05 -07:00 committed by Marcel Hollerbach
parent 0aba6030bd
commit 16b662d5d1
1 changed files with 40 additions and 0 deletions

View File

@ -53,6 +53,45 @@ EFL_START_TEST(efl_ui_layout_test_property_bind)
}
EFL_END_TEST
EFL_START_TEST(efl_ui_layout_test_property_bind_provider)
{
char buf[PATH_MAX];
Evas_Object *win, *ly;
Efl_Generic_Model *model;
Efl_Model_Provider *provider;
Eina_Value v;
Eina_Future *f;
const char *part_text;
const char text_value[] = "A random string for elm_layout_property_bind test";
win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
provider = efl_add(EFL_MODEL_PROVIDER_CLASS, win);
efl_provider_register(win, EFL_MODEL_PROVIDER_CLASS, provider);
ly = efl_add(EFL_UI_LAYOUT_CLASS, win);
snprintf(buf, sizeof(buf), "%s/objects/test.edj", ELM_TEST_DATA_DIR);
efl_file_simple_load(ly, buf, "layout");
efl_gfx_entity_visible_set(ly, EINA_TRUE);
model = efl_add(EFL_GENERIC_MODEL_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_property_bind(ly, "text", "text_property");
efl_ui_view_model_set(provider, 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;
@ -130,4 +169,5 @@ void efl_ui_test_layout(TCase *tc)
tcase_add_test(tc, efl_ui_layout_test_layout_force);
tcase_add_test(tc, efl_ui_layout_test_layout_theme);
tcase_add_test(tc, efl_ui_layout_test_api_ordering);
tcase_add_test(tc, efl_ui_layout_test_property_bind_provider);
}