This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository efl.
View the commit online.
commit f5edb6d57ba2800d800e8b2a545e2f61d4ed7c99
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Nov 10 18:37:42 2026 -0600
elementary: exact_model: only walk wrappers that keep a row's index
_efl_ui_exact_model_find walked through every Efl.Composite_Model, the
Filter_Model among them, which numbers the rows differently than the
Exact_Model under it does. The sizes are kept under the index of the
Exact_Model, and were read back under the index of the view, so the rows
of a Filter_Model(Exact_Model) took each other's heights. The second
test (efl_isa View interface) did nothing, as every Composite_Model is
one.
Walk through a Boolean_Model (the Select_Model) and a Size_Model (the
Homogeneous_Model, the Average_Model) only, and answer NULL for anything
else, so that the view asks the rows themselves.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
src/lib/elementary/efl_ui_exact_model.c | 12 +++-
src/lib/elementary/elm_priv.h | 4 ++
src/tests/elementary/efl_ui_test_collection_view.c | 75 ++++++++++++++++++++++
3 files changed, 88 insertions(+), 3 deletions(-)
diff --git a/src/lib/elementary/efl_ui_exact_model.c b/src/lib/elementary/efl_ui_exact_model.c
index 7db041104e..453c4e691e 100644
--- a/src/lib/elementary/efl_ui_exact_model.c
+++ b/src/lib/elementary/efl_ui_exact_model.c
@@ -416,14 +416,20 @@ _efl_ui_exact_model_efl_model_property_get(const Eo *obj, Efl_Ui_Exact_Model_Dat
return efl_model_property_get(efl_super(obj, EFL_UI_EXACT_MODEL_CLASS), property);
}
-/* The Exact_Model under the models the view wraps its own around, or NULL. */
+/* The Exact_Model under the models the view wraps its own around, or NULL.
+
+ Only wrappers that keep the index of a row are walked through: a Boolean_Model
+ (the Select_Model) and a Size_Model (the Homogeneous_Model and the
+ Average_Model). Any other model (a Filter_Model, say) may
+ number a row differently than the Exact_Model under it does, and the
+ sizes are kept under the index of the Exact_Model. */
Efl_Model *
_efl_ui_exact_model_find(Efl_Model *model)
{
while (model && !efl_isa(model, EFL_UI_EXACT_MODEL_CLASS))
{
- if (!efl_isa(model, EFL_COMPOSITE_MODEL_CLASS) ||
- !efl_isa(model, EFL_UI_VIEW_INTERFACE))
+ if (!efl_isa(model, EFL_BOOLEAN_MODEL_CLASS) &&
+ !efl_isa(model, EFL_UI_SIZE_MODEL_CLASS))
return NULL;
model = efl_ui_view_model_get(model);
}
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index 4347673327..028b2df8f6 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -653,6 +653,10 @@ struct _Elm_Module
int references;
};
+/* Valid only under the view's own wrappers, which keep the index of a row
+ (the Select_Model, the Homogeneous_Model, a Boolean_Model...): the sizes
+ are kept under the index of the Exact_Model, which another model may
+ number differently. _find answers NULL for those. */
Efl_Model *_efl_ui_exact_model_find(Efl_Model *model);
Eina_Bool _efl_ui_exact_model_row_size_get(Efl_Model *exact,
unsigned int index,
diff --git a/src/tests/elementary/efl_ui_test_collection_view.c b/src/tests/elementary/efl_ui_test_collection_view.c
index 7464e4a286..ec2d03ff46 100644
--- a/src/tests/elementary/efl_ui_test_collection_view.c
+++ b/src/tests/elementary/efl_ui_test_collection_view.c
@@ -1077,6 +1077,80 @@ EFL_START_TEST(test_efl_ui_collection_view_many_single_adds)
}
EFL_END_TEST
+static Eina_Future *
+_skip_first_row(void *data EINA_UNUSED, Efl_Filter_Model *parent, Efl_Model *child)
+{
+ Eina_Value *initial = efl_model_property_get(child, "initial");
+ int row = 0;
+
+ eina_value_int_get(initial, &row);
+ eina_value_free(initial);
+ return efl_loop_future_resolved(parent, eina_value_bool_init(row != 0));
+}
+
+/* A view over a model that renumbers the rows of an Exact_Model (a
+ Filter_Model that does not keep the first one) must not read a size by the
+ index the row has in the view: the Exact_Model keeps it under the index of
+ the row in the source. Each row has the height its own index in the view
+ says. */
+EFL_START_TEST(test_efl_ui_collection_view_exact_model_renumbered)
+{
+ Efl_Ui_Win *win;
+ Efl_Model *model, *sizes, *filtered;
+ Efl_Ui_Factory *fl;
+ Efl_Ui_List_View *lv;
+ Eina_List *realized = NULL, *l;
+ Efl_Gfx_Entity *item;
+ int errors = 0, i, checked = 0;
+
+ win = win_add(NULL, "win", EFL_UI_WIN_TYPE_BASIC);
+ efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 100));
+ eina_log_print_cb_set(_count_err_cri, &errors);
+
+ model = _make_model(win);
+ sizes = efl_add(EFL_UI_EXACT_MODEL_CLASS, win, efl_ui_view_model_set(efl_added, model));
+ filtered = efl_add(EFL_FILTER_MODEL_CLASS, win,
+ efl_ui_view_model_set(efl_added, sizes),
+ efl_filter_model_filter_set(efl_added, NULL, _skip_first_row, NULL));
+ fl = efl_add(EFL_UI_WIDGET_FACTORY_CLASS, win,
+ efl_ui_widget_factory_item_class_set(efl_added, EFL_UI_LIST_PLACEHOLDER_ITEM_CLASS),
+ efl_event_callback_add(efl_added, EFL_UI_FACTORY_EVENT_ITEM_BUILDING,
+ _row_height_on_build, NULL));
+ lv = efl_add(EFL_UI_LIST_VIEW_CLASS, win,
+ efl_ui_collection_view_factory_set(efl_added, fl),
+ efl_ui_view_model_set(efl_added, filtered));
+ efl_content_set(win, lv);
+ efl_event_callback_add(lv, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED,
+ _realized_track, &realized);
+ efl_event_callback_add(lv, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED,
+ _unrealized_track, &realized);
+ get_me_to_those_events(lv);
+ for (i = 0; i < 50; i++)
+ {
+ ecore_main_loop_iterate();
+ }
+
+ EINA_LIST_FOREACH(realized, l, item)
+ {
+ Eina_Rect g = efl_gfx_entity_geometry_get(item);
+
+ if (g.h == 0) continue;
+ ck_assert_int_eq(g.h, (efl_composite_model_index_get(efl_ui_view_model_get(item)) % 2) ?
+ 40 : 90);
+ checked++;
+ }
+ ck_assert_int_ge(checked, 2);
+
+ eina_log_print_cb_set(eina_log_print_cb_stderr, NULL);
+ ck_assert_int_eq(errors, 0);
+ efl_event_callback_del(lv, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_REALIZED,
+ _realized_track, &realized);
+ efl_event_callback_del(lv, EFL_UI_COLLECTION_VIEW_EVENT_ITEM_UNREALIZED,
+ _unrealized_track, &realized);
+ eina_list_free(realized);
+}
+EFL_END_TEST
+
void efl_ui_test_collection_view(TCase *tc)
{
tcase_add_test(tc, test_efl_ui_collection_view_basic);
@@ -1098,4 +1172,5 @@ void efl_ui_test_collection_view(TCase *tc)
tcase_add_test(tc, test_efl_ui_collection_view_remove_last_row);
tcase_add_test(tc, test_efl_ui_collection_view_exact_model_jump);
tcase_add_test(tc, test_efl_ui_collection_view_many_single_adds);
+ tcase_add_test(tc, test_efl_ui_collection_view_exact_model_renumbered);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.