From d6c8e6993f33930393205893aee60ce756f4d1ec Mon Sep 17 00:00:00 2001 From: Yossi Kantor Date: Wed, 24 Apr 2013 18:11:40 +0300 Subject: Vertical List focus test added to elementary_test --- src/bin/test.c | 2 ++ src/bin/test_list.c | 54 +++++++++++++++++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/bin/test.c b/src/bin/test.c index 3ff0aea38..f72dc3c01 100644 --- a/src/bin/test.c +++ b/src/bin/test.c @@ -77,6 +77,7 @@ 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_list8(void *data, Evas_Object *obj, void *event_info); +void test_list9(void *data, Evas_Object *obj, void *event_info); void test_list_separator(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); @@ -589,6 +590,7 @@ add_tests: ADD_TEST(NULL, "Lists", "List 6", test_list6); ADD_TEST(NULL, "Lists", "List 7", test_list7); ADD_TEST(NULL, "Lists", "List Focus", test_list8); + ADD_TEST(NULL, "Lists", "List Focus Horizontal", test_list9); ADD_TEST(NULL, "Lists", "List Separator", test_list_separator); ADD_TEST(NULL, "Lists", "Genlist", test_genlist); ADD_TEST(NULL, "Lists", "Genlist 2", test_genlist2); diff --git a/src/bin/test_list.c b/src/bin/test_list.c index f5758a1fd..931aac929 100644 --- a/src/bin/test_list.c +++ b/src/bin/test_list.c @@ -1255,7 +1255,7 @@ static unsigned _list_focus_objects = 5; static const char *_list_focus_names[] = {"None", "Square", "Button", "Check", "Box"}; static Evas_Object * -test_list8_content_get(Evas_Object *obj,unsigned type) +test_list8_content_get(Evas_Object *obj, unsigned type, Eina_Bool horiz) { Evas_Object *cnt = NULL; @@ -1274,10 +1274,10 @@ test_list8_content_get(Evas_Object *obj,unsigned type) case 4: cnt = elm_box_add(obj); evas_object_size_hint_align_set(cnt, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_horizontal_set(cnt, EINA_TRUE); - elm_box_pack_end(cnt,test_list8_content_get(obj,2)); - elm_box_pack_end(cnt,test_list8_content_get(obj,3)); - elm_box_pack_end(cnt,test_list8_content_get(obj,2)); + elm_box_horizontal_set(cnt, !horiz); + elm_box_pack_end(cnt,test_list8_content_get(obj, 2, horiz)); + elm_box_pack_end(cnt,test_list8_content_get(obj, 3, horiz)); + elm_box_pack_end(cnt,test_list8_content_get(obj, 2, horiz)); break; default: break; @@ -1294,8 +1294,8 @@ test_list8_content_get(Evas_Object *obj,unsigned type) static void test_list8_focus_on_selection_set(Evas_Object *gl, Evas_Object *chk, Eina_Bool focus) { - elm_list_focus_on_selection_set(gl,focus); - elm_check_state_set(chk,focus); + elm_list_focus_on_selection_set(gl, focus); + elm_check_state_set(chk, focus); printf("list_focus_on_selection = %s\n",(focus) ? "true" : "false"); } @@ -1303,20 +1303,17 @@ static void test_list8_focus_check_changed(void *data, Evas_Object *obj, void *event_info __UNUSED__) { Eina_Bool nextstate = !elm_list_focus_on_selection_get(data); - test_list8_focus_on_selection_set(data,obj,nextstate); + test_list8_focus_on_selection_set(data, obj, nextstate); } -void -test_list8(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) +void test_list_focus(const char *name, const char *title, Eina_Bool horiz) { Evas_Object *win, *li, *bx, *bxx, *chk; unsigned lhand, rhand; elm_config_focus_highlight_enabled_set(EINA_TRUE); - win = elm_win_util_standard_add("list-focus", "List Focus"); + win = elm_win_util_standard_add(name, title); elm_win_autodel_set(win, EINA_TRUE); bxx = elm_box_add(win); @@ -1327,6 +1324,7 @@ test_list8(void *data __UNUSED__, li = elm_list_add(win); evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(li, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_list_horizontal_set(li, horiz); elm_box_pack_end(bxx, li); evas_object_show(li); @@ -1354,16 +1352,20 @@ test_list8(void *data __UNUSED__, snprintf(buf, sizeof(buf), " %s / %s ", _list_focus_names[lhand], _list_focus_names[rhand]); - elm_list_item_append(li, buf, test_list8_content_get(li,lhand), - test_list8_content_get(li,rhand), NULL, NULL); + + elm_list_item_append(li, buf, + test_list8_content_get(li, lhand, horiz), + test_list8_content_get(li, rhand, horiz), + NULL, NULL); snprintf(buf, sizeof(buf), " %s / %s ", _list_focus_names[_list_focus_objects-lhand-1], _list_focus_names[_list_focus_objects-rhand-1]); + elm_list_item_append(li, buf, - test_list8_content_get(li,_list_focus_objects-lhand-1), - test_list8_content_get(li,_list_focus_objects-rhand-1), - NULL, NULL); + test_list8_content_get(li, (_list_focus_objects - lhand - 1), horiz), + test_list8_content_get(li, (_list_focus_objects - rhand - 1), horiz), + NULL, NULL); } elm_list_go(li); @@ -1373,6 +1375,22 @@ test_list8(void *data __UNUSED__, evas_object_show(win); } +void +test_list8(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + test_list_focus("list-focus", "List Focus", EINA_FALSE); +} + +void +test_list9(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + test_list_focus("list-focus-horizontal", "List Focus Horizontal", EINA_TRUE); +} + void test_list_separator(void *data __UNUSED__, Evas_Object *obj __UNUSED__, -- cgit v1.2.1