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:
Additional unit tests for padding and inset interactions with sizes.

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/object/ewl_object.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- ewl_object.c        18 Nov 2007 05:13:11 -0000      1.6
+++ ewl_object.c        18 Nov 2007 06:05:06 -0000      1.7
@@ -25,6 +25,9 @@
 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 padding_test_set_size_get(char *buf, int len);
+static int insets_test_set_size_get(char *buf, int len);
+static int insets_padding_test_set_size_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);
 
@@ -37,6 +40,9 @@
                {"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},
+               {"padding set/size get", padding_test_set_size_get, NULL, -1, 
0},
+               {"insets set/size get", insets_test_set_size_get, NULL, -1, 0},
+               {"insets padding set/size get", 
insets_padding_test_set_size_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}
@@ -394,6 +400,93 @@
                else
                        snprintf(buf, len, "incorrect returned insets");
        }
+
+       ewl_widget_destroy(w);
+
+       return ret;
+}
+
+/*
+ * Test that setting the padding on an object returns the expected results 
after
+ * a size request.
+ */
+static int
+padding_test_set_size_get(char *buf, int len)
+{
+       Ewl_Widget *w;
+       int width = 0, height = 0;
+       int ret = 0;
+
+       w = calloc(1, sizeof(Ewl_Widget));
+       ewl_widget_init(w);
+
+       ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
+
+       ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+       if (width == (3 + EWL_OBJECT_MIN_SIZE) &&
+                       height == (7 + EWL_OBJECT_MIN_SIZE))
+               ret = 1;
+       else
+               snprintf(buf, len, "incorrect returned size %dx%d", width,
+                               height);
+
+       ewl_widget_destroy(w);
+
+       return ret;
+}
+
+/*
+ * Test that setting the insets on an object returns the expected results after
+ * a size request.
+ */
+static int
+insets_test_set_size_get(char *buf, int len)
+{
+       Ewl_Widget *w;
+       int width = 0, height = 0;
+       int ret = 0;
+
+       w = calloc(1, sizeof(Ewl_Widget));
+       ewl_widget_init(w);
+
+       ewl_object_insets_set(EWL_OBJECT(w), 1, 2, 3, 4);
+
+       ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+       if (width == 4 && height == 8)
+               ret = 1;
+       else
+               snprintf(buf, len, "incorrect returned size %dx%d", width,
+                               height);
+
+       ewl_widget_destroy(w);
+
+       return ret;
+}
+
+/*
+ * Test that setting the insets and padding on an object returns the expected
+ * results after a size request.
+ */
+static int
+insets_padding_test_set_size_get(char *buf, int len)
+{
+       Ewl_Widget *w;
+       int width = 0, height = 0;
+       int ret = 0;
+
+       w = calloc(1, sizeof(Ewl_Widget));
+       ewl_widget_init(w);
+
+       ewl_object_padding_set(EWL_OBJECT(w), 1, 2, 3, 4);
+       ewl_object_insets_set(EWL_OBJECT(w), 4, 3, 2, 1);
+
+       ewl_object_current_size_get(EWL_OBJECT(w), &width, &height);
+       if (width == (10 + EWL_OBJECT_MIN_SIZE) &&
+                       height == (10 + EWL_OBJECT_MIN_SIZE))
+               ret = 1;
+       else
+               snprintf(buf, len, "incorrect returned size %dx%d", width,
+                               height);
 
        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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to