summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorcnook <kimcinoo@gmail.com>2012-04-17 10:59:16 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-04-17 10:59:16 +0000
commit2775c4f06e7057c68caba17669121aab8082e810 (patch)
tree6fa161a3c1e4942146d2a79b3a82cf9b0e09f46f /src/bin
parent1a7499d10fa299a9da13f31fd715eb471b8875ae (diff)
From: cnook <kimcinoo@gmail.com>
Subject: [E-devel] [Patch][elementary_test] test_list I had added test code for the elementary. but I made a pause it because of some reasons and just started again. Today I have attached a patch for the elm_list which does not have test code for the API elm_list_item_prev(); Please review the attached patch and give any feedbacks. I'll be back with other patches. Thanks! SVN revision: 70265
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_list.c173
2 files changed, 171 insertions, 4 deletions
diff --git a/src/bin/test.c b/src/bin/test.c
index ae2b16539..761e56320 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -70,6 +70,7 @@ void test_list2(void *data, Evas_Object *obj, void *event_info);
70void test_list3(void *data, Evas_Object *obj, void *event_info); 70void test_list3(void *data, Evas_Object *obj, void *event_info);
71void test_list4(void *data, Evas_Object *obj, void *event_info); 71void test_list4(void *data, Evas_Object *obj, void *event_info);
72void test_list5(void *data, Evas_Object *obj, void *event_info); 72void test_list5(void *data, Evas_Object *obj, void *event_info);
73void test_list6(void *data, Evas_Object *obj, void *event_info);
73void test_inwin(void *data, Evas_Object *obj, void *event_info); 74void test_inwin(void *data, Evas_Object *obj, void *event_info);
74void test_inwin2(void *data, Evas_Object *obj, void *event_info); 75void test_inwin2(void *data, Evas_Object *obj, void *event_info);
75void test_scaling(void *data, Evas_Object *obj, void *event_info); 76void test_scaling(void *data, Evas_Object *obj, void *event_info);
@@ -532,6 +533,7 @@ add_tests:
532 ADD_TEST(NULL, "Lists", "List 3", test_list3); 533 ADD_TEST(NULL, "Lists", "List 3", test_list3);
533 ADD_TEST(NULL, "Lists", "List 4", test_list4); 534 ADD_TEST(NULL, "Lists", "List 4", test_list4);
534 ADD_TEST(NULL, "Lists", "List 5", test_list5); 535 ADD_TEST(NULL, "Lists", "List 5", test_list5);
536 ADD_TEST(NULL, "Lists", "List 6", test_list6);
535 ADD_TEST(NULL, "Lists", "Genlist", test_genlist); 537 ADD_TEST(NULL, "Lists", "Genlist", test_genlist);
536 ADD_TEST(NULL, "Lists", "Genlist 2", test_genlist2); 538 ADD_TEST(NULL, "Lists", "Genlist 2", test_genlist2);
537 ADD_TEST(NULL, "Lists", "Genlist 3", test_genlist3); 539 ADD_TEST(NULL, "Lists", "Genlist 3", test_genlist3);
diff --git a/src/bin/test_list.c b/src/bin/test_list.c
index fd41a4574..dcbc5e67a 100644
--- a/src/bin/test_list.c
+++ b/src/bin/test_list.c
@@ -281,6 +281,13 @@ _cleanup_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *e
281 free(data); 281 free(data);
282} 282}
283 283
284static void _filter_all_cb(void *data, Evas_Object *obj __UNUSED__,
285 void *event_info __UNUSED__)
286{
287 Evas_Object *popup = (Evas_Object *)data;
288 evas_object_del(popup);
289}
290
284void 291void
285test_list(void *data __UNUSED__, 292test_list(void *data __UNUSED__,
286 Evas_Object *obj __UNUSED__, 293 Evas_Object *obj __UNUSED__,
@@ -319,7 +326,7 @@ test_list(void *data __UNUSED__,
319 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); 326 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
320 elm_icon_file_set(ic, buf, NULL); 327 elm_icon_file_set(ic, buf, NULL);
321 elm_icon_resizable_set(ic, 1, 1); 328 elm_icon_resizable_set(ic, 1, 1);
322 list_it1 = elm_list_item_append(li, "Hello", ic, NULL, NULL, NULL); 329 list_it1 = elm_list_item_append(li, "Hello", ic, NULL, _filter_all_cb, bxx);
323 ic = elm_icon_add(win); 330 ic = elm_icon_add(win);
324 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get()); 331 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
325 elm_icon_resizable_set(ic, 0, 0); 332 elm_icon_resizable_set(ic, 0, 0);
@@ -704,11 +711,99 @@ _bt_clicked(void *data __UNUSED__,
704} 711}
705 712
706static void 713static void
707_it_clicked(void *data __UNUSED__, 714_first_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
708 Evas_Object *obj __UNUSED__, 715 void *event_info __UNUSED__)
709 void *event_info __UNUSED__) 716{
717 char str[128];
718 Evas_Object *li = (Evas_Object *) data;
719 Evas_Object *lb;
720
721 Elm_Object_Item *lit = elm_list_first_item_get(li);
722 if (!lit) return;
723 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
724 elm_list_item_bring_in(lit);
725 elm_list_item_selected_set(lit, EINA_TRUE);
726
727 lb = evas_object_data_get(li, "label");
728 elm_object_text_set(lb, str);
729}
730
731static void
732_prev_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
733 void *event_info __UNUSED__)
734{
735 char str[128];
736 Evas_Object *li = (Evas_Object *) data;
737 Evas_Object *lb;
738
739 Elm_Object_Item *lit = elm_list_selected_item_get(li);
740 if (!lit) return;
741 lit = elm_list_item_prev(lit);
742 if (!lit) return;
743
744 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
745 elm_list_item_bring_in(lit);
746 elm_list_item_selected_set(lit, EINA_TRUE);
747
748 lb = evas_object_data_get(li, "label");
749 elm_object_text_set(lb, str);
750}
751
752static void
753_next_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
754 void *event_info __UNUSED__)
755{
756 char str[128];
757 Evas_Object *li = (Evas_Object *) data;
758 Evas_Object *lb;
759
760 Elm_Object_Item *lit = elm_list_selected_item_get(li);
761 if (!lit) return;
762 lit = elm_list_item_next(lit);
763 if (!lit) return;
764
765 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
766 elm_list_item_bring_in(lit);
767 elm_list_item_selected_set(lit, EINA_TRUE);
768
769 lb = evas_object_data_get(li, "label");
770 elm_object_text_set(lb, str);
771}
772
773static void
774_last_bt_clicked(void *data, Evas_Object *obj __UNUSED__,
775 void *event_info __UNUSED__)
776{
777 char str[128];
778 Evas_Object *li = (Evas_Object *) data;
779 Evas_Object *lb;
780
781 Elm_Object_Item *lit = elm_list_last_item_get(li);
782 if (!lit) return;
783 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
784 elm_list_item_bring_in(lit);
785 elm_list_item_selected_set(lit, EINA_TRUE);
786
787 lb = evas_object_data_get(li, "label");
788 elm_object_text_set(lb, str);
789}
790
791static void
792_it_clicked(void *data, Evas_Object *obj __UNUSED__,
793 void *event_info __UNUSED__)
710{ 794{
711 printf("item was clicked\n"); 795 printf("item was clicked\n");
796 if (!data) return;
797 Evas_Object *li = (Evas_Object *) data;
798 Evas_Object *lb;
799 char str[128];
800
801 Elm_Object_Item *lit = elm_list_selected_item_get(li);
802 if (!lit) return;
803 sprintf(str, "%s is selected", elm_object_item_text_get(lit));
804
805 lb = evas_object_data_get(li, "label");
806 elm_object_text_set(lb, str);
712} 807}
713 808
714void 809void
@@ -1020,4 +1115,74 @@ test_list5(void *data __UNUSED__,
1020 evas_object_show(win); 1115 evas_object_show(win);
1021} 1116}
1022 1117
1118void
1119test_list6(void *data __UNUSED__,
1120 Evas_Object *obj __UNUSED__,
1121 void *event_info __UNUSED__)
1122{
1123 Evas_Object *win, *gd, *bt, *li, *lb;
1124 win = elm_win_util_standard_add("list6", "List 6");
1125 elm_win_autodel_set(win, EINA_TRUE);
1126
1127 gd = elm_grid_add(win);
1128 elm_grid_size_set(gd, 100, 100);
1129 elm_win_resize_object_add(win, gd);
1130 evas_object_size_hint_weight_set(gd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1131
1132 li = elm_list_add(win);
1133 evas_object_size_hint_weight_set(li, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1134 elm_list_mode_set(li, ELM_LIST_COMPRESS);
1135 elm_grid_pack(gd, li, 4, 4, 92, 72);
1136 evas_object_show(li);
1137
1138 elm_list_item_append(li, "Eina", NULL, NULL, _it_clicked, li);
1139 elm_list_item_append(li, "Eet", NULL, NULL, _it_clicked, li);
1140 elm_list_item_append(li, "Evas", NULL, NULL, _it_clicked, li);
1141 elm_list_item_append(li, "Ecore", NULL, NULL, _it_clicked, li);
1142 elm_list_item_append(li, "Embryo", NULL, NULL, _it_clicked, li);
1143 elm_list_item_append(li, "Edje", NULL, NULL, _it_clicked, li);
1144 elm_list_item_append(li, "Efreet", NULL, NULL, _it_clicked, li);
1145 elm_list_item_append(li, "E_dbus", NULL, NULL, _it_clicked, li);
1146 elm_list_item_append(li, "Eeze", NULL, NULL, _it_clicked, li);
1147 elm_list_item_append(li, "Expedite", NULL, NULL, _it_clicked, li);
1148 elm_list_item_append(li, "Emotion", NULL, NULL, _it_clicked, li);
1149 elm_list_item_append(li, "Ethumb", NULL, NULL, _it_clicked, li);
1150 elm_list_item_append(li, "Elementary", NULL, NULL, _it_clicked, li);
1151 elm_list_go(li);
1152
1153 bt = elm_button_add(win);
1154 elm_object_text_set(bt, "First");
1155 evas_object_smart_callback_add(bt, "clicked", _first_bt_clicked, li);
1156 elm_grid_pack(gd, bt, 4, 80, 20, 10);
1157 evas_object_show(bt);
1158
1159 bt = elm_button_add(win);
1160 elm_object_text_set(bt, "Prev");
1161 evas_object_smart_callback_add(bt, "clicked", _prev_bt_clicked, li);
1162 elm_grid_pack(gd, bt, 28, 80, 20, 10);
1163 evas_object_show(bt);
1164
1165 bt = elm_button_add(win);
1166 elm_object_text_set(bt, "Next");
1167 evas_object_smart_callback_add(bt, "clicked", _next_bt_clicked, li);
1168 elm_grid_pack(gd, bt, 52, 80, 20, 10);
1169 evas_object_show(bt);
1170
1171 bt = elm_button_add(win);
1172 elm_object_text_set(bt, "Last");
1173 evas_object_smart_callback_add(bt, "clicked", _last_bt_clicked, li);
1174 elm_grid_pack(gd, bt, 76, 80, 20, 10);
1175 evas_object_show(bt);
1176
1177 lb = elm_label_add(win);
1178 elm_object_text_set(lb, "Nothing is selected");
1179 elm_grid_pack(gd, lb, 4, 90, 92, 10);
1180 evas_object_show(lb);
1181
1182 evas_object_data_set(li, "label", lb);
1183
1184 evas_object_show(gd);
1185 evas_object_resize(win, 480, 480);
1186 evas_object_show(win);
1187}
1023#endif 1188#endif