Merge changes I6abbe506,Ibfd12197
[framework/uifw/elementary.git] / src / bin / test.c
index 522f6d2..8d6bd19 100644 (file)
@@ -1,4 +1,5 @@
 #include <Elementary.h>
+#include "test.h"
 #ifdef HAVE_CONFIG_H
 # include "elementary_config.h"
 #endif
@@ -9,11 +10,15 @@ void test_bg_plain(void *data, Evas_Object *obj, void *event_info);
 void test_bg_image(void *data, Evas_Object *obj, void *event_info);
 void test_bg_options(void *data, Evas_Object *obj, void *event_info);
 void test_icon(void *data, Evas_Object *obj, void *event_info);
+void test_icon_transparent(void *data, Evas_Object *obj, void *event_info);
 void test_box_vert(void *data, Evas_Object *obj, void *event_info);
 void test_box_vert2(void *data, Evas_Object *obj, void *event_info);
+void test_box_pack(void *data, Evas_Object *obj, void *event_info);
 void test_box_horiz(void *data, Evas_Object *obj, void *event_info);
+void test_box_homo(void *data, Evas_Object *obj, void *event_info);
 void test_box_transition(void *data, Evas_Object *obj, void *event_info);
 void test_button(void *data, Evas_Object *obj, void *event_info);
+void test_cnp(void *data, Evas_Object *obj, void *event_info);
 void test_transit(void *data, Evas_Object *obj, void *event_info);
 void test_transit2(void *data, Evas_Object *obj, void *event_info);
 void test_transit3(void *data, Evas_Object *obj, void *event_info);
@@ -28,6 +33,7 @@ void test_fileselector_entry(void *data, Evas_Object *obj, void *event_info);
 void test_toggle(void *data, Evas_Object *obj, void *event_info);
 void test_clock(void *data, Evas_Object *obj, void *event_info);
 void test_clock2(void *data, Evas_Object *obj, void *event_info);
+void test_clock3(void *data, Evas_Object *obj, void *event_info);
 void test_check(void *data, Evas_Object *obj, void *event_info);
 void test_radio(void *data, Evas_Object *obj, void *event_info);
 void test_layout(void *data, Evas_Object *obj, void *event_info);
@@ -38,16 +44,21 @@ void test_entry_scrolled(void *data, Evas_Object *obj, void *event_info);
 void test_entry3(void *data, Evas_Object *obj, void *event_info);
 void test_entry4(void *data, Evas_Object *obj, void *event_info);
 void test_entry5(void *data, Evas_Object *obj, void *event_info);
+void test_entry6(void *data, Evas_Object *obj, void *event_info);
+void test_entry7(void *data, Evas_Object *obj, void *event_info);
+void test_entry8(void *data, Evas_Object *obj, void *event_info);
 void test_entry_notepad(void *data, Evas_Object *obj, void *event_info);
 void test_multibuttonentry(void *data, Evas_Object *obj, void *event_info);
-void test_anchorview(void *data, Evas_Object *obj, void *event_info);
-void test_anchorblock(void *data, Evas_Object *obj, void *event_info);
+void test_entry_anchor2(void *data, Evas_Object *obj, void *event_info);
+void test_entry_anchor(void *data, Evas_Object *obj, void *event_info);
 void test_toolbar(void *data, Evas_Object *obj, void *event_info);
 void test_toolbar2(void *data, Evas_Object *obj, void *event_info);
 void test_toolbar3(void *data, Evas_Object *obj, void *event_info);
 void test_toolbar4(void *data, Evas_Object *obj, void *event_info);
 void test_toolbar5(void *data, Evas_Object *obj, void *event_info);
 void test_toolbar6(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar7(void *data, Evas_Object *obj, void *event_info);
+void test_toolbar8(void *data, Evas_Object *obj, void *event_info);
 void test_hoversel(void *data, Evas_Object *obj, void *event_info);
 void test_list(void *data, Evas_Object *obj, void *event_info);
 void test_list_horizontal(void *data, Evas_Object *obj, void *event_info);
@@ -73,19 +84,24 @@ void test_genlist9(void *data, Evas_Object *obj, void *event_info);
 void test_genlist10(void *data, Evas_Object *obj, void *event_info);
 void test_genlist11(void *data, Evas_Object *obj, void *event_info);
 void test_genlist12(void *data, Evas_Object *obj, void *event_info);
+void test_genlist13(void *data, Evas_Object *obj, void *event_info);
+void test_genlist14(void *data, Evas_Object *obj, void *event_info);
+void test_genlist15(void *data, Evas_Object *obj, void *event_info);
+void test_genlist16(void *data, Evas_Object *obj, void *event_info);
+void test_genlist17(void *data, Evas_Object *obj, void *event_info);
 void test_gesture_layer(void *data, Evas_Object *obj, void *event_info);
 void test_gesture_layer2(void *data, Evas_Object *obj, void *event_info);
+void test_gesture_layer3(void *data, Evas_Object *obj, void *event_info);
 void test_table(void *data, Evas_Object *obj, void *event_info);
 void test_table2(void *data, Evas_Object *obj, void *event_info);
 void test_table3(void *data, Evas_Object *obj, void *event_info);
 void test_table4(void *data, Evas_Object *obj, void *event_info);
 void test_table5(void *data, Evas_Object *obj, void *event_info);
 void test_table6(void *data, Evas_Object *obj, void *event_info);
+void test_table7(void *data, Evas_Object *obj, void *event_info);
 void test_gengrid(void *data, Evas_Object *obj, void *event_info);
 void test_gengrid2(void *data, Evas_Object *obj, void *event_info);
 void test_gengrid3(void *data, Evas_Object *obj, void *event_info);
-void test_pager(void *data, Evas_Object *obj, void *event_info);
-void test_pager_slide(void *data, Evas_Object *obj, void *event_info);
 void test_win_state(void *data, Evas_Object *obj, void *event_info);
 void test_win_state2(void *data, Evas_Object *obj, void *event_info);
 void test_progressbar(void *data, Evas_Object *obj, void *event_info);
@@ -116,6 +132,7 @@ void test_flip3(void *data, Evas_Object *obj, void *event_info);
 void test_flip4(void *data, Evas_Object *obj, void *event_info);
 void test_flip_page(void *data, Evas_Object *obj, void *event_info);
 void test_label(void *data, Evas_Object *obj, void *event_info);
+void test_label2(void *data, Evas_Object *obj, void *event_info);
 void test_conformant(void *data, Evas_Object *obj, void *event_info);
 void test_conformant2(void *data, Evas_Object *obj, void *event_info);
 void test_multi(void *data, Evas_Object *obj, void *event_info);
@@ -133,6 +150,7 @@ void test_cursor4(void *data, Evas_Object *obj, void *event_info);
 void test_focus(void *data, Evas_Object *obj, void *event_info);
 void test_focus2(void *data, Evas_Object *obj, void *event_info);
 void test_focus3(void *data, Evas_Object *obj, void *event_info);
+void test_focus4(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);
@@ -141,12 +159,17 @@ void test_bubble(void *data, Evas_Object *obj, void *event_info);
 void test_segment_control(void *data, Evas_Object *obj, void *event_info);
 void test_store(void *data, Evas_Object *obj, void *event_info);
 void test_win_inline(void *data, Evas_Object *obj, void *event_info);
+void test_win_socket(void *data, Evas_Object *obj, void *event_info);
+void test_win_plug(void *data, Evas_Object *obj, void *event_info);
 void test_grid(void *data, Evas_Object *obj, void *event_info);
 void test_glview_simple(void *data, Evas_Object *obj, void *event_info);
 void test_glview(void *data, Evas_Object *obj, void *event_info);
 void test_3d(void *data, Evas_Object *obj, void *event_info);
 void test_naviframe(void *data, Evas_Object *obj, void *event_info);
-void test_factory(void *data, Evas_Object *obj, void *event_info);
+//void test_factory(void *data, Evas_Object *obj, void *event_info);
+void test_datetime(void *data, Evas_Object *obj, void *event_info);
+void test_popup(void *data, Evas_Object *obj, void *event_info);
+void test_dayselector(void *data, Evas_Object *obj, void *event_info);
 #ifdef HAVE_EMOTION
 void test_video(void *data, Evas_Object *obj, void *event_info);
 #endif
@@ -154,7 +177,8 @@ void test_video(void *data, Evas_Object *obj, void *event_info);
 void test_eio(void *data, Evas_Object *obj, void *event_info);
 #endif
 #ifdef HAVE_ELEMENTARY_WEB
-void test_web(void *data, Evas_Object *obj, void *event_info);
+void test_web_normal(void *data, Evas_Object *obj, void *event_info);
+void test_web_mobile(void *data, Evas_Object *obj, void *event_info);
 #endif
 
 struct elm_test
@@ -175,7 +199,7 @@ elm_test_sort(const void *pa, const void *pb)
 }
 
 static void
-elm_test_add(Eina_List **p_list, const char *icon, const char *category, const char *name, void (*cb)(void *, Evas_Object *, void *))
+_elm_test_add(Eina_List **p_list, const char *icon, const char *category, const char *name, void (*cb)(void *, Evas_Object *, void *))
 {
    struct elm_test *t = malloc(sizeof(struct elm_test));
    t->icon = icon;
@@ -185,10 +209,9 @@ elm_test_add(Eina_List **p_list, const char *icon, const char *category, const c
    *p_list = eina_list_sorted_insert(*p_list, elm_test_sort, t);
 }
 
-static void
+void
 my_win_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   /* called when my_win_main is requested to be deleted */
    elm_exit(); /* exit the program's main loop that runs in elm_run() */
 }
 
@@ -196,9 +219,14 @@ static void
 _ui_tg_changed(void *data, Evas_Object *obj, void *event_info)
 {
    (void) data; (void) event_info;
-   elm_mirrored_set(elm_check_state_get(obj));
+   elm_config_mirrored_set(elm_check_state_get(obj));
 }
 
+static void
+_frame_clicked(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+{
+   printf("frame %p is: %s\n", obj, elm_frame_collapse_get(obj) ? "collapsed" : "expanded");
+}
 
 static void
 my_win_main(char *autorun, Eina_Bool test_win_only)
@@ -207,7 +235,8 @@ my_win_main(char *autorun, Eina_Bool test_win_only)
    Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *ic = NULL;
    Evas_Object *tbx = NULL, *cfr = NULL, *tbx2 = NULL, *bt = NULL;
    Eina_List *tests, *l;
-   struct elm_test *t;
+   struct elm_test *t = NULL;
+   void *tt;
 
    if (test_win_only) goto add_tests;
    /* Create an elm window - It returns an evas object. This is a little
@@ -235,8 +264,8 @@ my_win_main(char *autorun, Eina_Bool test_win_only)
 
    /* Add a background to our window. This just uses the standard theme set
     * background. Without a background, you could make a window seem
-    * transparent with elm_win_alpha_set(win, 1); For example. if you have
-    * a compositor running this will make the window able to be
+    * transparent with elm_win_alpha_set(win, EINA_TRUE); For example. if you
+    * have a compositor running this will make the window able to be
     * semi-transparent and any space not filled by object/widget pixels will
     * be transparent or translucent based on alpha. If you do not have a
     * compositor running this should fall back to using shaped windows
@@ -262,22 +291,23 @@ my_win_main(char *autorun, Eina_Bool test_win_only)
    evas_object_show(bx0);
 
    fr = elm_frame_add(win);
+   evas_object_smart_callback_add(fr, "clicked", _frame_clicked, NULL);
+   elm_frame_autocollapse_set(fr, EINA_TRUE);
    elm_object_text_set(fr, "Information");
    elm_box_pack_end(bx0, fr);
    evas_object_show(fr);
 
    lb = elm_label_add(win);
    elm_object_text_set(lb,
-                       "Please select a test from the list below<br/>"
-                       "by clicking the test button to show the<br/>"
-                       "test window.");
+                       "Please select a test from the list below by clicking<br/>"
+                       "the test button to show the test window.");
    elm_object_content_set(fr, lb);
    evas_object_show(lb);
 
    tg = elm_check_add(win);
    elm_object_style_set(tg, "toggle");
    elm_object_text_set(tg, "UI-Mirroring:");
-   elm_check_state_set(tg, elm_mirrored_get());
+   elm_check_state_set(tg, elm_config_mirrored_get());
    evas_object_smart_callback_add(tg, "changed", _ui_tg_changed, NULL);
    elm_box_pack_end(bx0, tg);
    evas_object_show(tg);
@@ -297,7 +327,7 @@ my_win_main(char *autorun, Eina_Bool test_win_only)
 
 add_tests:
    tests = NULL;
-#define ADD_TEST(icon_, cat_, name_, cb_) elm_test_add(&tests, icon_, cat_, name_, cb_)
+#define ADD_TEST(icon_, cat_, name_, cb_) _elm_test_add(&tests, icon_, cat_, name_, cb_)
 
    //------------------------------//
    ADD_TEST(NULL, "Window / Background", "Bg Plain", test_bg_plain);
@@ -308,9 +338,12 @@ add_tests:
    ADD_TEST(NULL, "Window / Background", "Inwin", test_inwin);
    ADD_TEST(NULL, "Window / Background", "Inwin 2", test_inwin2);
    ADD_TEST(NULL, "Window / Background", "Window Inline", test_win_inline);
+   ADD_TEST(NULL, "Window / Background", "Window Socket", test_win_socket);
+   ADD_TEST(NULL, "Window / Background", "Window Plug", test_win_plug);
 
    //------------------------------//
-   ADD_TEST(NULL, "Images", "Icon Transparent", test_icon);
+   ADD_TEST(NULL, "Images", "Icon", test_icon);
+   ADD_TEST(NULL, "Images", "Icon Transparent", test_icon_transparent);
    ADD_TEST(NULL, "Images", "Icon Animation", test_icon_animated);
    ADD_TEST(NULL, "Images", "Photocam", test_photocam);
    ADD_TEST(NULL, "Images", "Photo", test_photo);
@@ -323,7 +356,9 @@ add_tests:
    //------------------------------//
    ADD_TEST(NULL, "Containers", "Box Vert", test_box_vert);
    ADD_TEST(NULL, "Containers", "Box Vert 2", test_box_vert2);
+   ADD_TEST(NULL, "Containers", "Box Pack", test_box_pack);
    ADD_TEST(NULL, "Containers", "Box Horiz", test_box_horiz);
+   ADD_TEST(NULL, "Containers", "Box Homogeneous", test_box_homo);
    ADD_TEST(NULL, "Containers", "Box Transition", test_box_transition);
    ADD_TEST(NULL, "Containers", "Table", test_table);
    ADD_TEST(NULL, "Containers", "Table Homogeneous", test_table2);
@@ -331,6 +366,7 @@ add_tests:
    ADD_TEST(NULL, "Containers", "Table 4", test_table4);
    ADD_TEST(NULL, "Containers", "Table 5", test_table5);
    ADD_TEST(NULL, "Containers", "Table 6", test_table6);
+   ADD_TEST(NULL, "Containers", "Table 7", test_table7);
    ADD_TEST(NULL, "Containers", "Layout", test_layout);
    ADD_TEST(NULL, "Containers", "Grid", test_grid);
 
@@ -340,8 +376,13 @@ add_tests:
    ADD_TEST(NULL, "Entries", "Entry 3", test_entry3);
    ADD_TEST(NULL, "Entries", "Entry 4", test_entry4);
    ADD_TEST(NULL, "Entries", "Entry 5", test_entry5);
+   ADD_TEST(NULL, "Entries", "Entry 6", test_entry6);
+   ADD_TEST(NULL, "Entries", "Entry 7", test_entry7);
+   ADD_TEST(NULL, "Entries", "Entry 8", test_entry8);
    ADD_TEST(NULL, "Entries", "Entry Notepad", test_entry_notepad);
    ADD_TEST(NULL, "Entries", "Multibuttonentry", test_multibuttonentry);
+   ADD_TEST(NULL, "Entries", "Entry Anchor", test_entry_anchor);
+   ADD_TEST(NULL, "Entries", "Entry Anchor2", test_entry_anchor2);
 
    //------------------------------//
    ADD_TEST(NULL, "Buttons", "Buttons", test_button);
@@ -370,6 +411,8 @@ add_tests:
    ADD_TEST(NULL, "Toolbars", "Toolbar 4", test_toolbar4);
    ADD_TEST(NULL, "Toolbars", "Toolbar 5", test_toolbar5);
    ADD_TEST(NULL, "Toolbars", "Toolbar 6", test_toolbar6);
+   ADD_TEST(NULL, "Toolbars", "Toolbar 7", test_toolbar7);
+   ADD_TEST(NULL, "Toolbars", "Toolbar 8", test_toolbar8);
 
    //------------------------------//
    ADD_TEST(NULL, "Lists", "List", test_list);
@@ -393,6 +436,11 @@ add_tests:
    ADD_TEST(NULL, "Lists", "Genlist Eio", test_eio);
 #endif
    ADD_TEST(NULL, "Lists", "Genlist Textblock", test_genlist12);
+   ADD_TEST(NULL, "Lists", "Genlist Tree, Insert Sorted", test_genlist13);
+   ADD_TEST(NULL, "Lists", "Genlist Tree, Insert Relative", test_genlist14);
+   ADD_TEST(NULL, "Lists", "Genlist Edit Mode", test_genlist15);
+   ADD_TEST(NULL, "Lists", "Genlist Flip Mode", test_genlist16);
+   ADD_TEST(NULL, "Lists", "Genlist Tree Effect", test_genlist17);
    ADD_TEST(NULL, "Lists", "GenGrid", test_gengrid);
    ADD_TEST(NULL, "Lists", "GenGrid 2", test_gengrid2);
    ADD_TEST(NULL, "Lists", "GenGrid Group", test_gengrid3);
@@ -408,12 +456,14 @@ add_tests:
 
    //------------------------------//
 #ifdef HAVE_ELEMENTARY_WEB
-   ADD_TEST(NULL, "Web", "Web", test_web);
+   ADD_TEST(NULL, "Web", "Web", test_web_normal);
+   ADD_TEST(NULL, "Web", "Web-mobile", test_web_mobile);
 #endif
 
    //------------------------------//
    ADD_TEST(NULL, "Input", "Gesture Layer", test_gesture_layer);
    ADD_TEST(NULL, "Input", "Gesture Layer 2", test_gesture_layer2);
+   ADD_TEST(NULL, "Input", "Gesture Layer 3", test_gesture_layer3);
    ADD_TEST(NULL, "Input", "Multi Touch", test_multi);
 
    //------------------------------//
@@ -430,6 +480,7 @@ add_tests:
    ADD_TEST(NULL, "Selectors", "Hoversel", test_hoversel);
    ADD_TEST(NULL, "Selectors", "Radios", test_radio);
    ADD_TEST(NULL, "Selectors", "Flip Selector", test_flipselector);
+   ADD_TEST(NULL, "Selectors", "Dayselector", test_dayselector);
 
    //------------------------------//
    ADD_TEST(NULL, "Cursors", "Cursor", test_cursor);
@@ -461,18 +512,20 @@ add_tests:
    ADD_TEST(NULL, "Popups", "Hover 2", test_hover2);
    ADD_TEST(NULL, "Popups", "Notify", test_notify);
    ADD_TEST(NULL, "Popups", "Tooltip", test_tooltip);
-   ADD_TEST(NULL, "Popups", "Tooltip2", test_tooltip2);
+   ADD_TEST(NULL, "Popups", "Tooltip 2", test_tooltip2);
+   ADD_TEST(NULL, "Popups", "Popup", test_popup);
 
    //------------------------------//
    ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);
    ADD_TEST(NULL, "Times & Dates", "Calendar 2", test_calendar2);
    ADD_TEST(NULL, "Times & Dates", "Clock", test_clock);
    ADD_TEST(NULL, "Times & Dates", "Clock 2", test_clock2);
+   ADD_TEST(NULL, "Times & Dates", "Clock 3", test_clock3);
+   ADD_TEST(NULL, "Times & Dates", "Datetime", test_datetime);
 
    //------------------------------//
-   ADD_TEST(NULL, "Text", "Anchorview", test_anchorview);
-   ADD_TEST(NULL, "Text", "Anchorblock", test_anchorblock);
    ADD_TEST(NULL, "Text", "Label", test_label);
+   ADD_TEST(NULL, "Text", "Label2", test_label2);
 
    //------------------------------//
    ADD_TEST(NULL, "Stored Surface Buffer", "Launcher", test_launcher);
@@ -483,11 +536,10 @@ add_tests:
    ADD_TEST(NULL, "Focus", "Focus", test_focus);
    ADD_TEST(NULL, "Focus", "Focus 2", test_focus2);
    ADD_TEST(NULL, "Focus", "Focus 3", test_focus3);
+   ADD_TEST(NULL, "Focus", "Focus 4", test_focus4);
 
    //------------------------------//
    ADD_TEST(NULL, "Storyboard", "Naviframe", test_naviframe);
-   ADD_TEST(NULL, "Storyboard", "Pager", test_pager);
-   ADD_TEST(NULL, "Storyboard", "Pager Slide", test_pager_slide);
 
    //------------------------------//
    ADD_TEST(NULL, "Geographic", "Map", test_map);
@@ -502,9 +554,10 @@ add_tests:
 
    //------------------------------//
    ADD_TEST(NULL, "Helpers", "Store", test_store);
-   ADD_TEST(NULL, "Helpers", "Factory", test_factory);
+//   ADD_TEST(NULL, "Helpers", "Factory", test_factory);
 
    //------------------------------//
+   ADD_TEST(NULL, "Micellaneous", "Copy And Paste", test_cnp);
    ADD_TEST(NULL, "Micellaneous", "Weather", test_weather);
    ADD_TEST(NULL, "Micellaneous", "Icon Desktops", test_icon_desktops);
    ADD_TEST(NULL, "Micellaneous", "Floating Objects", test_floating);
@@ -524,8 +577,15 @@ add_tests:
           }
 
      }
+   tt = t;
+
+   if (test_win_only)
+     {
+        EINA_LIST_FREE(tests, t)
+           free (t);
 
-   if (test_win_only) return;
+        return;
+     }
 
    if (tests)
      {
@@ -537,6 +597,8 @@ add_tests:
                {
                   cfr = elm_frame_add(win);
                   // FIXME: add new style of frame for this
+                  evas_object_smart_callback_add(cfr, "clicked", _frame_clicked, NULL);
+                  elm_frame_autocollapse_set(cfr, EINA_TRUE);
                   elm_object_text_set(cfr, t->category);
                   evas_object_size_hint_weight_set(cfr, EVAS_HINT_EXPAND, 0.0);
                   evas_object_size_hint_fill_set(cfr, EVAS_HINT_FILL, 0.0);
@@ -568,6 +630,7 @@ add_tests:
              evas_object_show(bt);
              evas_object_smart_callback_add(bt, "clicked", t->cb, NULL);
              pcat = t->category;
+             if (t == tt) tt = cfr;
              free(t);
           }
      }
@@ -576,7 +639,16 @@ add_tests:
    evas_object_resize(win, 480, 480);
    /* show the window */
    if (!test_win_only)
-     evas_object_show(win);
+     {
+        evas_object_show(win);
+        /* bring in autorun frame */
+        if (autorun)
+          {
+             Evas_Coord x, y;
+             evas_object_geometry_get(tt, &x, &y, NULL, NULL);
+             elm_scroller_region_bring_in(sc, x, y, 0, 0);
+          }
+     }
 }
 
 /* this is your elementary main function - it MUST be called IMMEDIATELY