Enlightenment CVS committal

Author  : dj2
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/bin/tests


Modified Files:
        ewl_widget.c 


Log Message:
- add in a DISABLED macro
- add in a widget tests for enable/disable of widgets

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/ewl_widget.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_widget.c        22 May 2006 18:09:00 -0000      1.2
+++ ewl_widget.c        27 May 2006 17:43:59 -0000      1.3
@@ -4,6 +4,8 @@
 #include <string.h>
 #include <stdlib.h>
 
+static int create_test(Ewl_Container *box);
+static void ewl_widget_cb_toggle(Ewl_Widget *w, void *ev, void *data);
 static int appearance_test_set_get(char *buf, int len);
 
 static Ewl_Unit_Test widget_unit_tests[] = {
@@ -17,8 +19,67 @@
        test->name = "Widget";
        test->tip = "The base widget type.";
        test->filename = "ewl_widget.c";
-       test->type = EWL_TEST_TYPE_UNIT;
+       test->type = EWL_TEST_TYPE_MISC;
+       test->func = create_test;
        test->unit_tests = widget_unit_tests;
+}
+
+static int
+create_test(Ewl_Container *box)
+{
+       Ewl_Widget *vbox, *b2, *o;
+
+       vbox = ewl_vbox_new();
+       ewl_container_child_append(box, vbox);
+       ewl_widget_show(vbox);
+
+       b2 = ewl_hbox_new();
+       ewl_container_child_append(EWL_CONTAINER(vbox), b2);
+       ewl_widget_show(b2);
+
+       o = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(o), "first button");
+       ewl_widget_name_set(o, "first_widget");
+       ewl_container_child_append(EWL_CONTAINER(b2), o);
+       ewl_widget_show(o);
+
+       o = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(o), "second button");
+       ewl_widget_name_set(o, "second_widget");
+       ewl_container_child_append(EWL_CONTAINER(b2), o);
+       ewl_widget_disable(o);
+       ewl_widget_show(o);
+
+       b2 = ewl_hbox_new();
+       ewl_container_child_append(EWL_CONTAINER(vbox), b2);
+       ewl_widget_show(b2);
+
+       o = ewl_button_new();
+       ewl_button_label_set(EWL_BUTTON(o), "Toggle");
+       ewl_callback_append(o, EWL_CALLBACK_CLICKED, ewl_widget_cb_toggle, 
NULL);
+       ewl_container_child_append(EWL_CONTAINER(b2), o);
+       ewl_widget_show(o);
+}
+
+static void
+ewl_widget_cb_toggle(Ewl_Widget *w __UNUSED__, void *ev __UNUSED__, 
+                                               void *data __UNUSED__)
+{
+       Ewl_Widget *o, *o2;
+
+       o = ewl_widget_name_find("first_widget");
+       o2 = ewl_widget_name_find("second_widget");
+
+       if (DISABLED(o)) 
+       {
+               ewl_widget_enable(o);
+               ewl_widget_disable(o);
+       }
+       else 
+       {
+               ewl_widget_disable(o);
+               ewl_widget_enable(o2);
+       }
 }
 
 static int




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to