Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

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


Modified Files:
        ewl_box_test.c 


Log Message:
add some constructor unit tests

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/box/ewl_box_test.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_box_test.c      7 May 2008 13:38:14 -0000       1.4
+++ ewl_box_test.c      26 Jul 2008 23:04:56 -0000      1.5
@@ -11,6 +11,15 @@
 static void toggle_child_shrink(Ewl_Widget *w, void *ev, void *data);
 static void toggle_child_fill(Ewl_Widget *w, void *ev, void *data);
 
+/* unit tests */
+static int constructor_test(char *buf, int len);
+
+static Ewl_Unit_Test box_unit_tests[] = {
+                {"constructor", constructor_test, NULL, -1, 0},
+                {NULL, NULL, NULL, -1, 0}
+        };
+
+
 void
 test_info(Ewl_Test *test)
 {
@@ -21,6 +30,7 @@
         test->filename = __FILE__;
         test->func = create_test;
         test->type = EWL_TEST_TYPE_CONTAINER;
+        test->unit_tests = box_unit_tests;
 }
 
 static int
@@ -324,5 +334,36 @@
 
         ewl_button_label_set(EWL_BUTTON(w), l);
         ewl_object_alignment_set(EWL_OBJECT(w), a);
+}
+
+static int
+constructor_test(char *buf, int len)
+{
+        Ewl_Widget *b;
+        int ret = 0;
+
+        b = ewl_box_new();
+
+        if (!EWL_BOX_IS(b))
+        {
+                LOG_FAILURE(buf, len, "returned box is not of the type box");
+                goto DONE;
+        }
+        if (!ewl_box_orientation_get(EWL_BOX(b)) == EWL_ORIENTATION_HORIZONTAL)
+        {
+                LOG_FAILURE(buf, len, "button has a stock type set");
+                goto DONE;
+        }
+        if (ewl_widget_focusable_get(b))
+        {
+                LOG_FAILURE(buf, len, "box is not focusable");
+                goto DONE;
+        }
+
+        ret = 1;
+DONE:
+        ewl_widget_destroy(b);
+
+        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