Elementary: add test exposing issue on list with ELM_OBJECT_SELECT_MODE_ALWAYS

Items callbacks are called twice.

Going to investigate that, since it is breaking ephysics_test.



SVN revision: 73375
devs/felipealmeida/promises
Bruno Dilly 11 years ago
parent a225582bbe
commit 7ae6b9605c
  1. 2
      legacy/elementary/src/bin/test.c
  2. 55
      legacy/elementary/src/bin/test_list.c

@ -71,6 +71,7 @@ void test_list3(void *data, Evas_Object *obj, void *event_info);
void test_list4(void *data, Evas_Object *obj, void *event_info);
void test_list5(void *data, Evas_Object *obj, void *event_info);
void test_list6(void *data, Evas_Object *obj, void *event_info);
void test_list7(void *data, Evas_Object *obj, void *event_info);
void test_inwin(void *data, Evas_Object *obj, void *event_info);
void test_inwin2(void *data, Evas_Object *obj, void *event_info);
void test_scaling(void *data, Evas_Object *obj, void *event_info);
@ -538,6 +539,7 @@ add_tests:
ADD_TEST(NULL, "Lists", "List 4", test_list4);
ADD_TEST(NULL, "Lists", "List 5", test_list5);
ADD_TEST(NULL, "Lists", "List 6", test_list6);
ADD_TEST(NULL, "Lists", "List 7", test_list7);
ADD_TEST(NULL, "Lists", "Genlist", test_genlist);
ADD_TEST(NULL, "Lists", "Genlist 2", test_genlist2);
ADD_TEST(NULL, "Lists", "Genlist 3", test_genlist3);

@ -709,7 +709,7 @@ _it_clicked(void *data, Evas_Object *obj __UNUSED__,
{
printf("item was clicked\n");
if (!data) return;
Evas_Object *li = (Evas_Object *) data;
Evas_Object *li = data;
Evas_Object *lb;
char str[128];
@ -1175,4 +1175,57 @@ test_list6(void *data __UNUSED__,
evas_object_resize(win, 480, 480);
evas_object_show(win);
}
static void
_it_clicked_cb(void *data __UNUSED__, Evas_Object *li,
void *event_info __UNUSED__)
{
Elm_Object_Item *lit = elm_list_selected_item_get(li);
printf("Item clicked. %s is selected\n", elm_object_item_text_get(lit));
}
void
test_list7(void *data __UNUSED__,
Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
Evas_Object *win, *bg, *li;
char buf[PATH_MAX];
win = elm_win_add(NULL, "list7", ELM_WIN_BASIC);
elm_win_title_set(win, "List Always Select Mode");
elm_win_autodel_set(win, EINA_TRUE);
bg = elm_bg_add(win);
snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
elm_bg_file_set(bg, buf, NULL);
elm_win_resize_object_add(win, bg);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(bg);
li = elm_list_add(win);
evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, li);
elm_list_select_mode_set(li, ELM_OBJECT_SELECT_MODE_ALWAYS);
elm_list_item_append(li, "Items", NULL, NULL, _it_clicked_cb, NULL);
elm_list_item_append(li, "callbacks", NULL, NULL, _it_clicked_cb, NULL);
elm_list_item_append(li, "should be called", NULL, NULL, _it_clicked_cb,
NULL);
elm_list_item_append(li, "only once, each time", NULL, NULL, _it_clicked_cb,
NULL);
elm_list_item_append(li, "an item is clicked.", NULL, NULL, _it_clicked_cb,
NULL);
elm_list_item_append(li, "Including already", NULL, NULL, _it_clicked_cb,
NULL);
elm_list_item_append(li, "selected ones.", NULL, NULL, _it_clicked_cb, NULL);
elm_list_go(li);
evas_object_show(li);
evas_object_resize(win, 320, 300);
evas_object_show(win);
}
#endif

Loading…
Cancel
Save