forked from enlightenment/efl
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
This commit is contained in:
parent
3d07b90461
commit
5c5e29daa5
|
@ -1011,4 +1011,46 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
group { "focus_test_6";
|
||||
parts {
|
||||
rect { "list_bg";
|
||||
description { state: "default";
|
||||
color: 200 0 0 100;
|
||||
rel1.to: "list_swallow";
|
||||
rel2.to: "list_swallow";
|
||||
}
|
||||
}
|
||||
rect { "box_bg";
|
||||
description { state: "default";
|
||||
color: 0 200 0 100;
|
||||
rel1.to: "box";
|
||||
rel2.to: "box";
|
||||
}
|
||||
}
|
||||
box { "box";
|
||||
description { state: "default";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel2.relative: 1.0 0.1;
|
||||
box {
|
||||
layout: "horizontal";
|
||||
padding: 4 4;
|
||||
align: 1.0 0.5;
|
||||
min: 1 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
swallow { "list_swallow";
|
||||
description { state: "default";
|
||||
rel1.relative: 0.0 0.2;
|
||||
rel2.relative: 0.5 1.0;
|
||||
}
|
||||
}
|
||||
swallow { "label_swallow";
|
||||
description { state: "default";
|
||||
rel1.relative: 0.0 0.1;
|
||||
rel2.relative: 1.0 0.2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,6 +249,7 @@ void test_focus_object_style(void *data, Evas_Object *obj, void *event_info);
|
|||
void test_focus_object_policy(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_focus4(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_focus5(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_focus6(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_flipselector(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_diskselector(void *data, Evas_Object *obj, void *event_info);
|
||||
void test_colorselector(void *data, Evas_Object *obj, void *event_info);
|
||||
|
@ -1102,6 +1103,7 @@ add_tests:
|
|||
ADD_TEST(NULL, "Focus", "Focus Object Policy", test_focus_object_policy);
|
||||
ADD_TEST(NULL, "Focus", "Focus 4", test_focus4);
|
||||
ADD_TEST(NULL, "Focus", "Focus 5", test_focus5);
|
||||
ADD_TEST(NULL, "Focus", "Focus 6", test_focus6);
|
||||
|
||||
//------------------------------//
|
||||
ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
|
||||
|
|
|
@ -1077,3 +1077,75 @@ test_focus5(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_in
|
|||
evas_object_resize(win, 400, 400);
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
/**** focus 6 ****/
|
||||
static char *
|
||||
_focus6_gl_text_get(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
const char *part EINA_UNUSED)
|
||||
{
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "Focus item %d", (int)(uintptr_t)data);
|
||||
return strdup(buf);
|
||||
}
|
||||
void
|
||||
test_focus6(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *win, *ly, *lb, *btn, *gl;
|
||||
Elm_Genlist_Item_Class *itc;
|
||||
Elm_Object_Item *it;
|
||||
char buf[PATH_MAX];
|
||||
int i;
|
||||
|
||||
win = elm_win_util_standard_add("focus6", "Focus 6");
|
||||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
|
||||
|
||||
// main layout
|
||||
ly = elm_layout_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
|
||||
elm_layout_file_set(ly, buf, "focus_test_6");
|
||||
evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_win_resize_object_add(win, ly);
|
||||
evas_object_show(ly);
|
||||
|
||||
lb = elm_label_add(ly);
|
||||
elm_object_text_set(lb, "The game is to reach the buttons and the list items"
|
||||
" using only the keyboard");
|
||||
elm_layout_content_set(ly, "label_swallow", lb);
|
||||
|
||||
// genlist in a swallow
|
||||
gl = elm_genlist_add(ly);
|
||||
evas_object_size_hint_weight_set(gl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_align_set(gl, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
elm_genlist_select_mode_set(gl, ELM_OBJECT_SELECT_MODE_ALWAYS);
|
||||
elm_layout_content_set(ly, "list_swallow", gl);
|
||||
|
||||
itc = elm_genlist_item_class_new();
|
||||
itc->item_style = "default";
|
||||
itc->func.text_get = _focus6_gl_text_get;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
it = elm_genlist_item_append(gl, itc, (void*)(uintptr_t)i, NULL,
|
||||
ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
/* This is another bug! This focus item at start do not work */
|
||||
// if (i == 1)
|
||||
// elm_object_item_focus_set(it, EINA_TRUE);
|
||||
}
|
||||
elm_genlist_item_class_free(itc);
|
||||
|
||||
// 3 buttons in an edje box
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
btn = elm_button_add(ly);
|
||||
elm_object_text_set(btn, "btn");
|
||||
elm_layout_box_append(ly, "box", btn);
|
||||
evas_object_show(btn);
|
||||
/* focus should start from second button */
|
||||
if (i == 1)
|
||||
elm_object_focus_set(btn, EINA_TRUE);
|
||||
}
|
||||
|
||||
evas_object_resize(win, 400, 400);
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue