Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

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


Modified Files:
        ewl_datepicker_test.c 


Log Message:
add more constructure unit tests

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/datepicker/ewl_datepicker_test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_datepicker_test.c       6 May 2008 20:09:03 -0000       1.2
+++ ewl_datepicker_test.c       28 Jul 2008 00:47:49 -0000      1.3
@@ -3,9 +3,18 @@
 #include "ewl_test_private.h"
 #include "ewl_datepicker.h"
 #include <stdio.h>
+#include <string.h>
 
 static int create_test(Ewl_Container *win);
 
+/* unit tests */
+static int constructor_test(char *buf, int len);
+
+static Ewl_Unit_Test datepicker_unit_tests[] = {
+                {"constructor", constructor_test, NULL, -1, 0},
+                {NULL, NULL, NULL, -1, 0}
+        };
+
 void
 test_info(Ewl_Test *test)
 {
@@ -14,6 +23,7 @@
         test->filename = __FILE__;
         test->func = create_test;
         test->type = EWL_TEST_TYPE_MISC;
+        test->unit_tests = datepicker_unit_tests;
 }
 
 static int
@@ -26,5 +36,39 @@
         ewl_widget_show(datepicker);
 
         return 1;
+}
+
+static int
+constructor_test(char *buf, int len)
+{
+        Ewl_Widget *c;
+        int ret = 0;
+
+        c = ewl_datepicker_new();
+
+        if (!EWL_DATEPICKER_IS(c))
+        {
+                LOG_FAILURE(buf, len, "returned widget is not of the type"
+                                " " EWL_DATEPICKER_TYPE);
+                goto DONE;
+        }
+        if (!!strcmp(ewl_widget_appearance_get(c), EWL_DATEPICKER_TYPE))
+        {
+                LOG_FAILURE(buf, len, "datepicker has not the appearance"
+                                " " EWL_DATEPICKER_TYPE);
+                goto DONE;
+        }
+        if (ewl_object_fill_policy_get(EWL_OBJECT(c)) != EWL_FLAG_FILL_NONE)
+        {
+                LOG_FAILURE(buf, len, "returned datepicker has wrong fill "
+                                "policy");
+                goto DONE;
+        }
+
+        ret = 1;
+DONE:
+        ewl_widget_destroy(c);
+
+        return ret;
 }
 



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to