Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests Modified Files: ewl_io_manager.c Log Message: - nicer test =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/ewl_io_manager.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- ewl_io_manager.c 14 Sep 2006 05:35:38 -0000 1.1 +++ ewl_io_manager.c 14 Sep 2006 05:49:16 -0000 1.2 @@ -1,5 +1,6 @@ #include "Ewl_Test.h" #include <stdio.h> +#include <stdlib.h> #include "ewl_test_private.h" static int create_test(Ewl_Container *box); @@ -7,6 +8,8 @@ static int mime_to_icon_name_test(char *buf, int len); static int uri_mime_type_get_test(char *buf, int len); +static void cb_clicked(Ewl_Widget *w, void *ev, void *data); + static Ewl_Unit_Test io_manager_unit_tests[] = { {"extension to icon name mapping", ext_to_icon_name_test}, {"mime type to icon name mapping", mime_to_icon_name_test}, @@ -28,18 +31,56 @@ static int create_test(Ewl_Container *box) { - Ewl_Widget *t; + Ewl_Widget *o, *o2, *hbox; + + hbox = ewl_hbox_new(); + ewl_container_child_append(box, hbox); + ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_VSHRINK | EWL_FLAG_FILL_HFILL); + ewl_widget_show(hbox); + + o = ewl_entry_new(); + ewl_container_child_append(EWL_CONTAINER(hbox), o); + ewl_widget_show(o); + + o2 = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(o2), "fetch"); + ewl_container_child_append(EWL_CONTAINER(hbox), o2); + ewl_callback_append(o2, EWL_CALLBACK_CLICKED, cb_clicked, o); + ewl_object_fill_policy_set(EWL_OBJECT(o2), EWL_FLAG_FILL_SHRINK); + ewl_widget_show(o2); + + o = ewl_scrollpane_new(); + ewl_scrollpane_hscrollbar_flag_set(EWL_SCROLLPANE(o), + EWL_SCROLLPANE_FLAG_ALWAYS_HIDDEN); + ewl_container_child_append(box, o); + ewl_widget_name_set(o, "scroll"); + ewl_widget_show(o); + + return 1; +} + +static void +cb_clicked(Ewl_Widget *w, void *ev, void *data) +{ + Ewl_Widget *scroll, *t, *entry; + char *s; + + entry = data; - t = ewl_io_manager_uri_read(PACKAGE_DATA_DIR "/examples/ewl_io_manager.c"); + scroll = ewl_widget_name_find("scroll"); + ewl_container_reset(EWL_CONTAINER(scroll)); + + s = ewl_text_text_get(EWL_TEXT(entry)); + t = ewl_io_manager_uri_read(s); if (!t) { - printf("Unable to create text widget from file"); - return 0; + printf("Unable to create text widget from file (%s)", s); + return; } - ewl_container_child_append(box, t); + ewl_container_child_append(EWL_CONTAINER(scroll), t); ewl_widget_show(t); - return 1; + if (s) free(s); } static int ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs