elm test_genlist.c: I introduce "Genlist Textblock" test case into
authorseoz <seoz@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 8 Sep 2011 10:21:04 +0000 (10:21 +0000)
committerMike McCormack <mj.mccormack@samsung.com>
Fri, 18 Nov 2011 05:52:27 +0000 (14:52 +0900)
elementary_test. This will help test textblock with genlist. Enjoy it!

git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@63291 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/test.c
src/bin/test_genlist.c

index d5d867b..b4285a2 100644 (file)
@@ -71,6 +71,7 @@ void test_genlist8(void *data, Evas_Object *obj, void *event_info);
 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_gesture_layer(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);
@@ -362,6 +363,7 @@ add_tests:
 #ifdef HAVE_EIO
    ADD_TEST("Genlist Eio", test_eio);
 #endif
+   ADD_TEST("Genlist Textblock", test_genlist12);
    ADD_TEST("GenGrid", test_gengrid);
    ADD_TEST("GenGrid 2", test_gengrid2);
    ADD_TEST("Checks", test_check);
index e25725a..e6a81e9 100644 (file)
@@ -1878,4 +1878,57 @@ test_genlist11(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
    evas_object_resize(win, 400, 500);
    evas_object_show(win);
 }
+
+char *gl12_label_get(void *data __UNUSED__, Evas_Object *obj __UNUSED__, const char *part __UNUSED__)
+{
+   return strdup("Enlightenment is not just a window manager for Linux/X11 and others, but also a whole suite of libraries to help you create beautiful user interfaces with much less work than doing it the old fashioned way and fighting with traditional toolkits, not to mention a traditional window manager. It covers uses from small mobile devices like phones all the way to powerful multi-core desktops (which are the primary development environment).");
+}
+
+void
+test_genlist12(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+   Evas_Object *win, *bg, *bx, *gl;
+   int i;
+   Elm_Genlist_Item *gli;
+
+   win = elm_win_add(NULL, "genlist-textblock", ELM_WIN_BASIC);
+   elm_win_title_set(win, "Genlist Textblock");
+   elm_win_autodel_set(win, EINA_TRUE);
+
+   bg = elm_bg_add(win);
+   elm_win_resize_object_add(win, bg);
+   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_show(bg);
+
+   bx = elm_box_add(win);
+   evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_win_resize_object_add(win, bx);
+   evas_object_show(bx);
+
+   gl = elm_genlist_add(win);
+   elm_genlist_height_for_width_mode_set(gl, EINA_TRUE);
+   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);
+
+   itc1.item_style     = "message";
+   itc1.func.label_get = gl12_label_get;
+   itc1.func.icon_get  = gl_icon_get;
+   itc1.func.state_get = gl_state_get;
+   itc1.func.del       = gl_del;
+
+   for (i = 0; i < 1000; i++)
+     {
+        gli = elm_genlist_item_append(gl, &itc1,
+                                      (void *)(long)i/* item data */,
+                                      NULL/* parent */,
+                                      ELM_GENLIST_ITEM_NONE,
+                                      gl_sel/* func */,
+                                      (void *)(long)(i * 10)/* func data */);
+     }
+
+   evas_object_resize(win, 400, 500);
+   evas_object_show(win);
+}
 #endif