Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

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


Modified Files:
        ewl_button_test.c 


Log Message:
add some constructor unit tests

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/button/ewl_button_test.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ewl_button_test.c   7 May 2008 13:38:14 -0000       1.8
+++ ewl_button_test.c   26 Jul 2008 23:04:56 -0000      1.9
@@ -11,6 +11,7 @@
 
 static int create_test(Ewl_Container *win);
 
+static int constructor_test(char *buf, int len);
 static int label_test_set_get(char *buf, int len);
 static int image_null_test_get(char *buf, int len);
 static int image_null_test_set_get(char *buf, int len);
@@ -25,6 +26,7 @@
 static int image_fill_policy_test_set_get(char *buf, int len);
 
 static Ewl_Unit_Test button_unit_tests[] = {
+                {"constructor", constructor_test, NULL, -1, 0},
                 {"label set/get", label_test_set_get, NULL, -1, 0},
                 {"image null get", image_null_test_get, NULL, -1, 0},
                 {"image null set/get", image_null_test_set_get, NULL, -1, 0},
@@ -191,6 +193,44 @@
 
         return 1;
 }
+
+static int
+constructor_test(char *buf, int len)
+{
+        Ewl_Widget *button;
+        int ret = 0;
+
+        button = ewl_button_new();
+
+        if (!EWL_BUTTON_IS(button))
+        {
+                LOG_FAILURE(buf, len, "returned button is not of the type"
+                                " button");
+                goto DONE;
+        }
+        if (!!strcmp(ewl_widget_appearance_get(button), EWL_BUTTON_TYPE))
+        {
+                LOG_FAILURE(buf, len, "button has wrong appearance");
+                goto DONE;
+        }
+        if (!ewl_stock_type_get(EWL_STOCK(button)) == EWL_STOCK_NONE)
+        {
+                LOG_FAILURE(buf, len, "button has a stock type set");
+                goto DONE;
+        }
+        if (!ewl_widget_focusable_get(button))
+        {
+                LOG_FAILURE(buf, len, "button is not focusable");
+                goto DONE;
+        }
+
+        ret = 1;
+DONE:
+        ewl_widget_destroy(button);
+
+        return ret;
+}
+
 
 static int
 label_test_set_get(char *buf, int len)



-------------------------------------------------------------------------
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