Enlightenment CVS committal

Author  : ningerso
Project : e17
Module  : libs/ewl

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


Modified Files:
        ewl_object.c 


Log Message:
Add basic inset set/get unit test.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/object/ewl_object.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- ewl_object.c        15 Nov 2007 19:14:57 -0000      1.5
+++ ewl_object.c        18 Nov 2007 05:13:11 -0000      1.6
@@ -24,6 +24,7 @@
 static int minimum_size_test_set_request(char *buf, int len);
 static int maximum_size_test_set_request(char *buf, int len);
 static int padding_test_set_get(char *buf, int len);
+static int insets_test_set_get(char *buf, int len);
 static int fill_policy_test_set_get(char *buf, int len);
 static int alignment_test_set_get(char *buf, int len);
 
@@ -35,6 +36,7 @@
                {"minimum size set/request", minimum_size_test_set_request, 
NULL, -1, 0},
                {"maximum size set/request", maximum_size_test_set_request, 
NULL, -1, 0},
                {"padding set/get", padding_test_set_get, NULL, -1, 0},
+               {"insets set/get", insets_test_set_get, NULL, -1, 0},
                {"fill policy set/get", fill_policy_test_set_get, NULL, -1, 0},
                {"alignment set/get", alignment_test_set_get, NULL, -1, 0},
                {NULL, NULL, NULL, -1, 0}
@@ -361,6 +363,36 @@
                        ret = 1;
                else
                        snprintf(buf, len, "incorrect returned padding");
+       }
+
+       ewl_widget_destroy(w);
+
+       return ret;
+}
+
+/*
+ * Test that setting the insets on an object returns the same results on get.
+ */
+static int
+insets_test_set_get(char *buf, int len)
+{
+       Ewl_Widget *w;
+       int l, r, t, b;
+       int ret = 0;
+
+       w = calloc(1, sizeof(Ewl_Widget));
+       ewl_widget_init(w);
+
+       ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+       if (l || r || t || b)
+               snprintf(buf, len, "initial insets not 0");
+       else {
+               ewl_object_insets_set(EWL_OBJECT(w), 1, 2, 3, 4);
+               ewl_object_insets_get(EWL_OBJECT(w), &l, &r, &t, &b);
+               if (l == 1 && r == 2 && t == 3 && b == 4)
+                       ret = 1;
+               else
+                       snprintf(buf, len, "incorrect returned insets");
        }
 
        ewl_widget_destroy(w);



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to