Enlightenment CVS committal

Author  : pfritz
Project : e17
Module  : libs/ewl

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


Modified Files:
        ewl_colorpicker_test.c 


Log Message:
add more constructure unit tests

===================================================================
RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/colorpicker/ewl_colorpicker_test.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- ewl_colorpicker_test.c      7 May 2008 13:38:15 -0000       1.4
+++ ewl_colorpicker_test.c      28 Jul 2008 00:47:49 -0000      1.5
@@ -8,6 +8,14 @@
 static int create_test(Ewl_Container *box);
 static void color_value_changed(Ewl_Widget *w, void *ev, void *data);
 
+/* unit tests */
+static int constructor_test(char *buf, int len);
+
+static Ewl_Unit_Test colorpicker_unit_tests[] = {
+                {"constructor", constructor_test, NULL, -1, 0},
+                {NULL, NULL, NULL, -1, 0}
+        };
+
 void
 test_info(Ewl_Test *test)
 {
@@ -16,6 +24,7 @@
         test->filename = __FILE__;
         test->func = create_test;
         test->type = EWL_TEST_TYPE_MISC;
+        test->unit_tests = colorpicker_unit_tests;
 }
 
 static int
@@ -41,4 +50,39 @@
         printf("value changed to (%u, %u, %u)\n", r, g, b);
 }
 
+static int
+constructor_test(char *buf, int len)
+{
+        Ewl_Widget *c;
+        int ret = 0;
+        unsigned int r, g, b;
+
+        c = ewl_colorpicker_new();
+
+        if (!EWL_COLORPICKER_IS(c))
+        {
+                LOG_FAILURE(buf, len, "returned color picker is not of the 
type"
+                                " " EWL_COLORPICKER_TYPE);
+                goto DONE;
+        }
+        if (!ewl_colorpicker_color_mode_get(EWL_COLORPICKER(c)) 
+                        == EWL_COLOR_MODE_HSV_HUE)
+        {
+                LOG_FAILURE(buf, len, "colorpicker's color mode differs");
+                goto DONE;
+        }
+        ewl_colorpicker_current_rgb_get(EWL_COLORPICKER(c), &r, &g, &b);
+        if (r != 0 || g != 0 || b != 0)
+        {
+                LOG_FAILURE(buf, len, "colorpicker's color is not black");
+                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