seoz pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=4cdb146c5d6aeeb57ce0408372ee569e60d02550

commit 4cdb146c5d6aeeb57ce0408372ee569e60d02550
Author: nirajkr <[email protected]>
Date:   Tue Feb 4 20:29:29 2014 +0900

    focus: Added test cases for the existing issues/feature enhancement relate 
to focus
    
    Summary:
    Below are the test cases to reproduce the exisiting issues with focus or 
feature enhancement
             1. Focus cut for the first/last item by scroller.
             2. Focus animation on the last item.
             3. Focus goes out of view point while scrolling.
             4. Focus moves but the area of focus does not change.
             5. No focus highlight on widget items.
             6. No animation on widget item.
             7. No focus movement between widget to widget items.
    
    Reviewers: seoz, woohyun
    
    CC: singh.amitesh
    
    Differential Revision: https://phab.enlightenment.org/D502
---
 src/bin/test.c         |  6 +++-
 src/bin/test_focus.c   | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/bin/test_genlist.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 185 insertions(+), 1 deletion(-)

diff --git a/src/bin/test.c b/src/bin/test.c
index c270bd6..290cdb7 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -111,6 +111,7 @@ void test_genlist17(void *data, Evas_Object *obj, void 
*event_info);
 void test_genlist18(void *data, Evas_Object *obj, void *event_info);
 void test_genlist19(void *data, Evas_Object *obj, void *event_info);
 void test_genlist_focus(void *data, Evas_Object *obj, void *event_info);
+void test_genlist_item_focus(void *data, Evas_Object *obj, void *event_info);
 void test_genlist_item_styles(void *data, Evas_Object *obj, void *event_info);
 void test_genlist_multi_select(void *data, Evas_Object *obj, void *event_info);
 void test_genlist_del(void *data, Evas_Object *obj, void *event_info);
@@ -189,6 +190,7 @@ void test_focus_hide_del(void *data, Evas_Object *obj, void 
*event_info);
 void test_focus_custom_chain(void *data, Evas_Object *obj, void *event_info);
 void test_focus_style(void *data, Evas_Object *obj, void *event_info);
 void test_focus_part(void *data, Evas_Object *obj, void *event_info);
+void test_focus3(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);
@@ -641,6 +643,7 @@ add_tests:
    ADD_TEST(NULL, "Lists - Genlist", "Genlist Tree and Decorate All Mode", 
test_genlist18);
    ADD_TEST(NULL, "Lists - Genlist", "Genlist Full Widget", test_genlist19);
    ADD_TEST(NULL, "Lists - Genlist", "Genlist Focus", test_genlist_focus);
+   ADD_TEST(NULL, "Lists - Genlist", "Genlist Item Focus", 
test_genlist_item_focus);
    ADD_TEST(NULL, "Lists - Genlist", "Genlist Item Styles", 
test_genlist_item_styles);
    ADD_TEST(NULL, "Lists - Genlist", "Genlist Multi Select", 
test_genlist_multi_select);
    ADD_TEST(NULL, "Lists - Genlist", "Genlist Del", test_genlist_del);
@@ -755,7 +758,8 @@ add_tests:
    ADD_TEST(NULL, "Focus", "Focus Custom Chain", test_focus_custom_chain);
    ADD_TEST(NULL, "Focus", "Focus Style", test_focus_style);
    ADD_TEST(NULL, "Focus", "Focus On Part", test_focus_part);
-
+   ADD_TEST(NULL, "Focus", "Focus 3", test_focus3);
+   
    //------------------------------//
    ADD_TEST(NULL, "Naviframe", "Naviframe", test_naviframe);
    ADD_TEST(NULL, "Naviframe", "Naviframe 2", test_naviframe2);
diff --git a/src/bin/test_focus.c b/src/bin/test_focus.c
index beceace..f755737 100644
--- a/src/bin/test_focus.c
+++ b/src/bin/test_focus.c
@@ -659,3 +659,93 @@ test_focus_hide_del(void *data EINA_UNUSED, Evas_Object 
*obj EINA_UNUSED, void *
    evas_object_resize(win, 320, 480);
    evas_object_show(win);
 }
+
+/**** focus 3 ****/
+
+static Evas_Object *
+create_button(Evas_Object *parent, const char *text, Eina_Bool expand)
+{
+   Evas_Object *btn = elm_button_add(parent);
+   elm_object_text_set(btn, text);
+   if (expand)
+     {
+        evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND);
+        evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+     }
+
+   evas_object_show(btn);
+
+   return btn;
+}
+
+void
+test_focus3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void 
*event_info EINA_UNUSED)
+{
+   Evas_Object *win, *box, *sc, *btn_top, *btn_down, *btn[20], *box_btn, *lb, 
*fr;
+
+   char win_focus_theme[PATH_MAX] = { 0 };
+   char item_name[PATH_MAX];
+   int  i;
+
+   snprintf(win_focus_theme, sizeof(win_focus_theme), 
"%s/objects/test_focus_custom.edj", elm_app_data_dir_get());
+
+   elm_theme_extension_add(NULL, win_focus_theme);
+
+   win = elm_win_util_standard_add("focus3", "Focus 3");
+   elm_win_autodel_set(win, EINA_TRUE);
+   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+   elm_win_focus_highlight_animate_set(win, EINA_TRUE);
+   elm_win_focus_highlight_style_set(win, "glow");
+   evas_object_resize(win, 320, 400);
+
+   box = elm_box_add(win);
+   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, box);
+   evas_object_show(box);
+
+   fr = elm_frame_add(box);
+   elm_object_text_set(fr, "Focus Check Points");
+   elm_box_pack_end(box, fr);
+   evas_object_show(fr);
+
+   lb = elm_label_add(fr);
+   elm_object_text_set(lb, "<align=left>This test cases list down the"
+                           " focus related check points for regression 
test.<br/>"
+                           " 1. Focus cut for the first/last item by 
scroller<br/>"
+                           " 2. Focus animation on the last item<br/>"
+                           " 3. Focus goes out of view port while 
scrolling<br/>"
+                           " 4. Sometimes focus moves but the area of focus 
does not change<br/>"
+                           "    e.g if focus is on 'top' and with down key it 
comes on Item1 <br/>"
+                           "    but the area is same as of top <br/>"
+                           " </align>");
+   elm_object_content_set(fr, lb);
+   evas_object_show(lb);
+
+   btn_top = create_button(box, "top", EINA_FALSE);
+   elm_box_pack_end(box, btn_top);
+
+   sc = elm_scroller_add(box);
+   evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(box, sc);
+
+   box_btn = elm_box_add(sc);
+   evas_object_size_hint_weight_set(box_btn, EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND);
+   elm_object_content_set(sc, box_btn);
+   evas_object_show(box_btn);
+   evas_object_show(sc);
+
+   for (i = 0; i < 20; i++)
+     {
+        sprintf(item_name, "Item %d", i);
+        btn[i] = create_button(box_btn, item_name, EINA_TRUE);
+        elm_box_pack_end(box_btn, btn[i]);
+     }
+
+   btn_down = create_button(box, "down", EINA_FALSE);
+   evas_object_show(btn_down);
+   elm_box_pack_end(box, btn_down);
+
+   evas_object_show(win);
+}
+
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index f4247af..693da2c 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -3781,3 +3781,93 @@ test_genlist_del(void *data EINA_UNUSED,
    evas_object_resize(win, 320, 500);
    evas_object_show(win);
 }
+
+void
+test_genlist_item_focus(void *data EINA_UNUSED,
+                        Evas_Object *obj EINA_UNUSED,
+                        void *event_info EINA_UNUSED)
+{
+   Evas_Object *win, *bx, *bx_horiz, *gl, *btn, *fr, *lb;
+   int i;
+
+   win = elm_win_util_standard_add("genlist-item-focus", "Genlist Item Focus");
+   elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+   elm_win_focus_highlight_animate_set(win, EINA_TRUE);
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   bx_horiz = elm_box_add(win);
+   elm_box_horizontal_set(bx_horiz, EINA_TRUE);
+   evas_object_size_hint_weight_set(bx_horiz, EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, bx_horiz);
+   evas_object_show(bx_horiz);
+
+   btn = elm_button_add(bx_horiz);
+   elm_object_text_set(btn, "Left");
+   elm_box_pack_end(bx_horiz, btn);
+   evas_object_show(btn);
+
+   bx = elm_box_add(bx_horiz);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
+   elm_box_pack_end(bx_horiz, bx);
+   evas_object_show(bx);
+
+   fr = elm_frame_add(bx);
+   elm_object_text_set(fr, "Genlist Item Focus");
+   elm_box_pack_end(bx, fr);
+   evas_object_show(fr);
+
+   lb = elm_label_add(fr);
+   elm_object_text_set(lb, "<align=left>This test cases list down the"
+                           " focus check points related to genlist items.<br/>"
+                           "   1. No focus highlight on widget items<br/>"
+                           "   2. No animation on widget item<br/>"
+                           "   3. No focus movement between widget to widget 
items<br/>"
+                           "   </align>");
+   elm_object_content_set(fr, lb);
+   evas_object_show(lb);
+
+   btn = elm_button_add(bx);
+   elm_object_text_set(btn, "Up");
+   elm_box_pack_end(bx, btn);
+   evas_object_show(btn);
+
+   gl = elm_genlist_add(bx);
+   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_box_pack_end(bx, gl);
+   evas_object_show(gl);
+   elm_object_focus_set(gl, EINA_TRUE);
+
+   btn = elm_button_add(bx);
+   elm_object_text_set(btn, "Down");
+   elm_box_pack_end(bx, btn);
+   evas_object_show(btn);
+
+   btn = elm_button_add(bx_horiz);
+   elm_object_text_set(btn, "Right");
+   elm_box_pack_end(bx_horiz, btn);
+   evas_object_show(btn);
+
+   itc1 = elm_genlist_item_class_new();
+   itc1->item_style = "default";
+   itc1->func.text_get = gl_text_get;
+   itc1->func.content_get  = gl_content_get;
+   itc1->func.state_get = gl_state_get;
+   itc1->func.del = NULL;
+
+   for (i = 0; i < 50; i++)
+     {
+        elm_genlist_item_append(gl, itc1,
+                                (void *)(uintptr_t)i/* item data */,
+                                NULL/* parent */,
+                                ELM_GENLIST_ITEM_NONE,
+                                gl_sel/* func */,
+                                (void *)(uintptr_t)(i * 10)/* func data */);
+     }
+   elm_genlist_item_class_free(itc1);
+
+   evas_object_resize(win, 320, 450);
+   evas_object_show(win);
+}
+

-- 


Reply via email to