summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2012-11-27 15:21:27 +0000
committerDaniel Juyung Seo <seojuyung2@gmail.com>2012-11-27 15:21:27 +0000
commit8363bd8dcc2b7ea9b504a711b4a6062a28e0e06d (patch)
tree8b1ad1f8f045e480f052ed9632569821e720d3d3
parent087728853cbc4874538601c04b3619e5d3487fda (diff)
elm test_genlist.c: Added 'Genlist Item Styles' to check more genlist item styles.
SVN revision: 79746
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_genlist.c103
2 files changed, 105 insertions, 0 deletions
diff --git a/src/bin/test.c b/src/bin/test.c
index 57f4aea37..573ddca23 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -98,6 +98,7 @@ void test_genlist16(void *data, Evas_Object *obj, void *event_info);
98void test_genlist17(void *data, Evas_Object *obj, void *event_info); 98void test_genlist17(void *data, Evas_Object *obj, void *event_info);
99void test_genlist18(void *data, Evas_Object *obj, void *event_info); 99void test_genlist18(void *data, Evas_Object *obj, void *event_info);
100void test_genlist19(void *data, Evas_Object *obj, void *event_info); 100void test_genlist19(void *data, Evas_Object *obj, void *event_info);
101void test_genlist_item_styles(void *data, Evas_Object *obj, void *event_info);
101void test_gesture_layer(void *data, Evas_Object *obj, void *event_info); 102void test_gesture_layer(void *data, Evas_Object *obj, void *event_info);
102void test_gesture_layer2(void *data, Evas_Object *obj, void *event_info); 103void test_gesture_layer2(void *data, Evas_Object *obj, void *event_info);
103void test_gesture_layer3(void *data, Evas_Object *obj, void *event_info); 104void test_gesture_layer3(void *data, Evas_Object *obj, void *event_info);
@@ -590,6 +591,7 @@ add_tests:
590 ADD_TEST(NULL, "Lists", "Genlist Decorate Modes", test_genlist17); 591 ADD_TEST(NULL, "Lists", "Genlist Decorate Modes", test_genlist17);
591 ADD_TEST(NULL, "Lists", "Genlist Tree and Decorate All Mode", test_genlist18); 592 ADD_TEST(NULL, "Lists", "Genlist Tree and Decorate All Mode", test_genlist18);
592 ADD_TEST(NULL, "Lists", "Genlist Full Widget", test_genlist19); 593 ADD_TEST(NULL, "Lists", "Genlist Full Widget", test_genlist19);
594 ADD_TEST(NULL, "Lists", "Genlist Item Styles", test_genlist_item_styles);
593 ADD_TEST(NULL, "Lists", "GenGrid", test_gengrid); 595 ADD_TEST(NULL, "Lists", "GenGrid", test_gengrid);
594 ADD_TEST(NULL, "Lists", "GenGrid 2", test_gengrid2); 596 ADD_TEST(NULL, "Lists", "GenGrid 2", test_gengrid2);
595 ADD_TEST(NULL, "Lists", "GenGrid Group", test_gengrid3); 597 ADD_TEST(NULL, "Lists", "GenGrid Group", test_gengrid3);
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 0de145343..46ee83958 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -5,6 +5,15 @@
5#endif 5#endif
6#include <Elementary.h> 6#include <Elementary.h>
7#ifndef ELM_LIB_QUICKLAUNCH 7#ifndef ELM_LIB_QUICKLAUNCH
8
9#define WEIGHT evas_object_size_hint_weight_set
10#define ALIGN_ evas_object_size_hint_align_set
11#define EXPAND(X) WEIGHT((X), EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
12#define FILL(X) ALIGN_((X), EVAS_HINT_FILL, EVAS_HINT_FILL)
13
14Evas_Object * _elm_min_set(Evas_Object *obj, Evas_Object *parent,
15 Evas_Coord w, Evas_Coord h);
16
8struct _api_data 17struct _api_data
9{ 18{
10 unsigned int state; /* What state we are testing */ 19 unsigned int state; /* What state we are testing */
@@ -3175,4 +3184,98 @@ test_genlist19(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_i
3175 evas_object_show(win); 3184 evas_object_show(win);
3176} 3185}
3177 3186
3187/* test genlist item styles */
3188
3189const char *_genlist_styles[] = {
3190 "default", "full", "one_icon", "end_icon", "no_icon",
3191 "default_style", "double_label", "icon_top_text_bottom",
3192 NULL
3193};
3194
3195static void
3196_genlist_renew(Evas_Object *obj, const char *style)
3197{
3198 Elm_Genlist_Item_Class *ic;
3199 int i;
3200
3201 if (!obj) return;
3202 elm_genlist_clear(obj);
3203
3204 ic = elm_genlist_item_class_new();
3205 ic->item_style = style;
3206 ic->func.text_get = gl_text_get;
3207 ic->func.content_get = gl_content_get;
3208 ic->func.state_get = NULL;
3209 ic->func.del = NULL;
3210
3211 for (i = 0; i < 50; i++)
3212 {
3213 elm_genlist_item_append(obj, ic, (void *)(long)i, NULL,
3214 ELM_GENLIST_ITEM_NONE, NULL, NULL);
3215 }
3216 elm_genlist_item_class_free(ic);
3217}
3218
3219static void
3220_item_style_sel_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3221{
3222 Evas_Object *gl = evas_object_data_get(obj, "genlist");
3223 if (gl)
3224 _genlist_renew(gl, elm_object_item_text_get(event_info));
3225}
3226
3227static Evas_Object *
3228_item_styles_list_create(Evas_Object *parent)
3229{
3230 Evas_Object *list;
3231 int i = 0;
3232
3233 list = elm_list_add(parent);
3234 EXPAND(list); FILL(list);
3235
3236 while (_genlist_styles[i])
3237 {
3238 elm_list_item_append(list, _genlist_styles[i], NULL, NULL,
3239 _item_style_sel_cb, _genlist_styles[i]);
3240 i++;
3241 }
3242
3243 return list;
3244}
3245
3246void
3247test_genlist_item_styles(void *data __UNUSED__, Evas_Object *obj __UNUSED__,
3248 void *event_info __UNUSED__)
3249{
3250 Evas_Object *win, *box, *gl, *list, *table;
3251
3252 win = elm_win_util_standard_add("genlist-item-styles", "Gengrid Item Styles");
3253 elm_win_autodel_set(win, EINA_TRUE);
3254 evas_object_resize(win, 600, 600);
3255 evas_object_show(win);
3256
3257 box = elm_box_add(win);
3258 elm_box_horizontal_set(box, EINA_TRUE);
3259 EXPAND(box);
3260 elm_win_resize_object_add(win, box);
3261 evas_object_show(box);
3262
3263 list = _item_styles_list_create(box);
3264 evas_object_show(list);
3265
3266 table = _elm_min_set(list, box, 100, 0);
3267 WEIGHT(table, 0, EVAS_HINT_EXPAND);
3268 FILL(table);
3269 elm_box_pack_end(box, table);
3270 evas_object_show(table);
3271
3272 gl = elm_genlist_add(box);
3273 EXPAND(gl); FILL(gl);
3274 _genlist_renew(gl, "default");
3275 elm_box_pack_end(box, gl);
3276 evas_object_show(gl);
3277
3278 evas_object_data_set(list, "genlist", gl);
3279}
3280
3178#endif 3281#endif