summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2018-01-05 18:22:53 +0100
committerDave Andreoli <dave@gurumeditation.it>2018-01-05 18:28:41 +0100
commit5c5e29daa5455bc625b8287cf2437197e49ffa2a (patch)
treeba664c93c827b104025d54b73d55f6e2c40ff836
parent3d07b90461818804ed51b6dcaed9f05c0d0155bb (diff)
Elm focus navigation: other 2 failing tests
Added a new test "Focus 6", it's an not very complex elm layout: a swallowed genlist and three buttons in an edje box. You should be able to navigate the layout with just the keyboard, that is currently impossible. With the help of the mouse click you can randomly make the key navigation work again... this is mostly random. ...should help to make progress on T6453
-rw-r--r--data/elementary/objects/test.edc42
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_focus.c72
3 files changed, 116 insertions, 0 deletions
diff --git a/data/elementary/objects/test.edc b/data/elementary/objects/test.edc
index 6574ab3adf..cef0249d98 100644
--- a/data/elementary/objects/test.edc
+++ b/data/elementary/objects/test.edc
@@ -1011,4 +1011,46 @@ collections {
1011 } 1011 }
1012 } 1012 }
1013 } 1013 }
1014 group { "focus_test_6";
1015 parts {
1016 rect { "list_bg";
1017 description { state: "default";
1018 color: 200 0 0 100;
1019 rel1.to: "list_swallow";
1020 rel2.to: "list_swallow";
1021 }
1022 }
1023 rect { "box_bg";
1024 description { state: "default";
1025 color: 0 200 0 100;
1026 rel1.to: "box";
1027 rel2.to: "box";
1028 }
1029 }
1030 box { "box";
1031 description { state: "default";
1032 rel1.relative: 0.0 0.0;
1033 rel2.relative: 1.0 0.1;
1034 box {
1035 layout: "horizontal";
1036 padding: 4 4;
1037 align: 1.0 0.5;
1038 min: 1 0;
1039 }
1040 }
1041 }
1042 swallow { "list_swallow";
1043 description { state: "default";
1044 rel1.relative: 0.0 0.2;
1045 rel2.relative: 0.5 1.0;
1046 }
1047 }
1048 swallow { "label_swallow";
1049 description { state: "default";
1050 rel1.relative: 0.0 0.1;
1051 rel2.relative: 1.0 0.2;
1052 }
1053 }
1054 }
1055 }
1014} 1056}
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index eeb8275db2..1f75b930cb 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -249,6 +249,7 @@ void test_focus_object_style(void *data, Evas_Object *obj, void *event_info);
249void test_focus_object_policy(void *data, Evas_Object *obj, void *event_info); 249void test_focus_object_policy(void *data, Evas_Object *obj, void *event_info);
250void test_focus4(void *data, Evas_Object *obj, void *event_info); 250void test_focus4(void *data, Evas_Object *obj, void *event_info);
251void test_focus5(void *data, Evas_Object *obj, void *event_info); 251void test_focus5(void *data, Evas_Object *obj, void *event_info);
252void test_focus6(void *data, Evas_Object *obj, void *event_info);
252void test_flipselector(void *data, Evas_Object *obj, void *event_info); 253void test_flipselector(void *data, Evas_Object *obj, void *event_info);
253void test_diskselector(void *data, Evas_Object *obj, void *event_info); 254void test_diskselector(void *data, Evas_Object *obj, void *event_info);
254void test_colorselector(void *data, Evas_Object *obj, void *event_info); 255void test_colorselector(void *data, Evas_Object *obj, void *event_info);
@@ -1102,6 +1103,7 @@ add_tests:
1102 ADD_TEST(NULL, "Focus", "Focus Object Policy", test_focus_object_policy); 1103 ADD_TEST(NULL, "Focus", "Focus Object Policy", test_focus_object_policy);
1103 ADD_TEST(NULL, "Focus", "Focus 4", test_focus4); 1104 ADD_TEST(NULL, "Focus", "Focus 4", test_focus4);
1104 ADD_TEST(NULL, "Focus", "Focus 5", test_focus5); 1105 ADD_TEST(NULL, "Focus", "Focus 5", test_focus5);
1106 ADD_TEST(NULL, "Focus", "Focus 6", test_focus6);
1105 1107
1106 //------------------------------// 1108 //------------------------------//
1107 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe); 1109 ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
diff --git a/src/bin/elementary/test_focus.c b/src/bin/elementary/test_focus.c
index b5a6f9329c..6336c75a9c 100644
--- a/src/bin/elementary/test_focus.c
+++ b/src/bin/elementary/test_focus.c
@@ -1077,3 +1077,75 @@ test_focus5(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
1077 evas_object_resize(win, 400, 400); 1077 evas_object_resize(win, 400, 400);
1078 evas_object_show(win); 1078 evas_object_show(win);
1079} 1079}
1080
1081/**** focus 6 ****/
1082static char *
1083_focus6_gl_text_get(void *data, Evas_Object *obj EINA_UNUSED,
1084 const char *part EINA_UNUSED)
1085{
1086 char buf[32];
1087 snprintf(buf, sizeof(buf), "Focus item %d", (int)(uintptr_t)data);
1088 return strdup(buf);
1089}
1090void
1091test_focus6(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1092{
1093 Evas_Object *win, *ly, *lb, *btn, *gl;
1094 Elm_Genlist_Item_Class *itc;
1095 Elm_Object_Item *it;
1096 char buf[PATH_MAX];
1097 int i;
1098
1099 win = elm_win_util_standard_add("focus6", "Focus 6");
1100 elm_win_autodel_set(win, EINA_TRUE);
1101 elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
1102
1103 // main layout
1104 ly = elm_layout_add(win);
1105 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
1106 elm_layout_file_set(ly, buf, "focus_test_6");
1107 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1108 evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
1109 elm_win_resize_object_add(win, ly);
1110 evas_object_show(ly);
1111
1112 lb = elm_label_add(ly);
1113 elm_object_text_set(lb, "The game is to reach the buttons and the list items"
1114 " using only the keyboard");
1115 elm_layout_content_set(ly, "label_swallow", lb);
1116
1117 // genlist in a swallow
1118 gl = elm_genlist_add(ly);
1119 evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1120 evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1121 elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
1122 elm_layout_content_set(ly, "list_swallow", gl);
1123
1124 itc = elm_genlist_item_class_new();
1125 itc->item_style = "default";
1126 itc->func.text_get = _focus6_gl_text_get;
1127 for (i = 0; i < 3; i++)
1128 {
1129 it = elm_genlist_item_append(gl, itc, (void*)(uintptr_t)i, NULL,
1130 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1131 /* This is another bug! This focus item at start do not work */
1132 // if (i == 1)
1133 // elm_object_item_focus_set(it, EINA_TRUE);
1134 }
1135 elm_genlist_item_class_free(itc);
1136
1137 // 3 buttons in an edje box
1138 for (i = 0; i < 3; i++)
1139 {
1140 btn = elm_button_add(ly);
1141 elm_object_text_set(btn, "btn");
1142 elm_layout_box_append(ly, "box", btn);
1143 evas_object_show(btn);
1144 /* focus should start from second button */
1145 if (i == 1)
1146 elm_object_focus_set(btn, EINA_TRUE);
1147 }
1148
1149 evas_object_resize(win, 400, 400);
1150 evas_object_show(win);
1151}