Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/bin/tests/calendar Modified Files: ewl_calendar_test.c Log Message: add some constructor unit tests =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/calendar/ewl_calendar_test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_calendar_test.c 7 May 2008 13:38:14 -0000 1.3 +++ ewl_calendar_test.c 26 Jul 2008 23:04:56 -0000 1.4 @@ -4,10 +4,20 @@ #include "ewl_calendar.h" #include <stdio.h> #include <stdlib.h> +#include <string.h> static int create_test(Ewl_Container *box); static void ewl_calendar_test(Ewl_Widget *w, void *ev, void *data); +/* unit tests */ +static int constructor_test(char *buf, int len); + +static Ewl_Unit_Test calendar_unit_tests[] = { + {"constructor", constructor_test, NULL, -1, 0}, + {NULL, NULL, NULL, -1, 0} + }; + + void test_info(Ewl_Test *test) { @@ -16,6 +26,7 @@ test->filename = __FILE__; test->func = create_test; test->type = EWL_TEST_TYPE_MISC; + test->unit_tests = calendar_unit_tests; } static int @@ -41,5 +52,37 @@ date = ewl_calendar_ascii_time_get(EWL_CALENDAR(data)); printf ("Selected: %s\n", date); free(date); +} + +static int +constructor_test(char *buf, int len) +{ + Ewl_Widget *c; + int ret = 0; + + c = ewl_calendar_new(); + + if (!EWL_CALENDAR_IS(c)) + { + LOG_FAILURE(buf, len, "returned calendar is not of the type" + " calendar"); + goto DONE; + } + if (!!strcmp(ewl_widget_appearance_get(c), EWL_CALENDAR_TYPE)) + { + LOG_FAILURE(buf, len, "calendar has wrong appearance"); + goto DONE; + } + if (!ewl_object_fill_policy_get(EWL_OBJECT(c)) == EWL_FLAG_FILL_FILL) + { + LOG_FAILURE(buf, len, "calendar's fill policy is not set to fill"); + 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