Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/colordialog Modified Files: ewl_colordialog_test.c Log Message: add more constructure unit tests =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/colordialog/ewl_colordialog_test.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- ewl_colordialog_test.c 7 May 2008 13:38:15 -0000 1.4 +++ ewl_colordialog_test.c 28 Jul 2008 00:47:49 -0000 1.5 @@ -4,12 +4,23 @@ #include "ewl_button.h" #include "ewl_colordialog.h" #include <stdlib.h> +#include <string.h> +#include <stdio.h> static int create_test(Ewl_Container *win); static void colordialog_cb_launch(Ewl_Widget *w, void *ev, void *data); static void colordialog_cb_value_changed(Ewl_Widget *w, void *ev, void *data); +/* unit tests */ +static int constructor_test(char *buf, int len); + +static Ewl_Unit_Test colordialog_unit_tests[] = { + {"constructor", constructor_test, NULL, -1, 0}, + {NULL, NULL, NULL, -1, 0} + }; + + void test_info(Ewl_Test *test) { @@ -18,6 +29,7 @@ test->filename = __FILE__; test->func = create_test; test->type = EWL_TEST_TYPE_ADVANCED; + test->unit_tests = colordialog_unit_tests; } static int @@ -80,4 +92,45 @@ ewl_widget_show(o); } +static int +constructor_test(char *buf, int len) +{ + Ewl_Widget *c; + int ret = 0; + + c = ewl_colordialog_new(); + + if (!EWL_COLORDIALOG_IS(c)) + { + LOG_FAILURE(buf, len, "returned color dialog is not of the type" + " " EWL_COLORDIALOG_TYPE); + goto DONE; + } + if (!!strcmp(ewl_window_title_get(EWL_WINDOW(c)), "Ewl Colordialog")) + { + LOG_FAILURE(buf, len, "window title is not Ewl Colordialog"); + goto DONE; + } + if (!!strcmp(ewl_window_name_get(EWL_WINDOW(c)), "Ewl Colordialog")) + { + LOG_FAILURE(buf, len, "window name is not Ewl Colordialog"); + goto DONE; + } + if (!!strcmp(ewl_window_title_get(EWL_WINDOW(c)), "Ewl Colordialog")) + { + LOG_FAILURE(buf, len, "window group is not Ewl Colordialog"); + goto DONE; + } + if (!ewl_colordialog_has_alpha_get(EWL_COLORDIALOG(c))) + { + LOG_FAILURE(buf, len, "colordialog has no alpha channel"); + 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