Enlightenment CVS committal

Author  : ningerso
Project : e17
Module  : libs/ewl

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


Modified Files:
        ewl_widget.c 


Log Message:
Add unit tests for widget inheritance, internal and clipped flags.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/widget/ewl_widget.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ewl_widget.c        8 Nov 2007 21:00:07 -0000       1.9
+++ ewl_widget.c        8 Nov 2007 23:24:53 -0000       1.10
@@ -114,12 +114,16 @@
 
 static int appearance_test_set_get(char *buf, int len);
 static int inheritance_test_set_get(char *buf, int len);
+static int internal_test_set_get(char *buf, int len);
+static int clipped_test_set_get(char *buf, int len);
 static int data_test_set_get(char *buf, int len);
 static int data_test_set_remove(char *buf, int len);
 
 static Ewl_Unit_Test widget_unit_tests[] = {
                {"widget appearance set/get", appearance_test_set_get, -1, 
NULL},
                {"widget inheritance set/get", inheritance_test_set_get, -1, 
NULL},
+               {"widget internal set/get", internal_test_set_get, -1, NULL},
+               {"widget clipped set/get", clipped_test_set_get, -1, NULL},
                {"widget data set/get", data_test_set_get, -1, NULL},
                {"widget data set/remove", data_test_set_remove, -1, NULL},
                {NULL, NULL, -1, NULL}
@@ -267,6 +271,60 @@
                snprintf(buf, len, "inheritance dosen't contain correct type");
        else
                ret = 1;
+
+       return ret;
+}
+
+static int
+internal_test_set_get(char *buf, int len)
+{
+       Ewl_Widget *w;
+       int ret = 0;
+
+       w = calloc(1, sizeof(Ewl_Widget));
+       ewl_widget_init(w);
+
+       if (!ewl_widget_internal_is(w)) {
+               ewl_widget_internal_set(w, TRUE);
+               if (ewl_widget_internal_is(w)) {
+                       ewl_widget_internal_set(w, FALSE);
+                       if (ewl_widget_internal_is(w))
+                               snprintf(buf, len, "internal flag not FALSE");
+                       else
+                               ret = 1;
+               }
+               else
+                       snprintf(buf, len, "internal flag not TRUE");
+       }
+       else
+               snprintf(buf, len, "internal set after widget_init");
+
+       return ret;
+}
+
+static int
+clipped_test_set_get(char *buf, int len)
+{
+       Ewl_Widget *w;
+       int ret = 0;
+
+       w = calloc(1, sizeof(Ewl_Widget));
+       ewl_widget_init(w);
+
+       if (ewl_widget_clipped_is(w)) {
+               ewl_widget_clipped_set(w, FALSE);
+               if (ewl_widget_clipped_is(w)) {
+                       ewl_widget_clipped_set(w, TRUE);
+                       if (!ewl_widget_clipped_is(w))
+                               snprintf(buf, len, "clipped flag not TRUE");
+                       else
+                               ret = 1;
+               }
+               else
+                       snprintf(buf, len, "clipped flag not FALSE");
+       }
+       else
+               snprintf(buf, len, "clipped not set after widget_init");
 
        return ret;
 }



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to