From: Enlightenment C. <no...@cv...> - 2008-07-28 00:48:22
|
Enlightenment CVS committal Author : pfritz Project : e17 Module : libs/ewl Dir : e17/libs/ewl/src/bin/tests/dialog Modified Files: ewl_dialog_test.c Log Message: add more constructure unit tests =================================================================== RCS file: /cvs/e/e17/libs/ewl/src/bin/tests/dialog/ewl_dialog_test.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- ewl_dialog_test.c 7 May 2008 13:38:15 -0000 1.3 +++ ewl_dialog_test.c 28 Jul 2008 00:47:49 -0000 1.4 @@ -10,12 +10,21 @@ #include "ewl_label.h" #include "ewl_text.h" #include <stdio.h> +#include <string.h> static int create_test(Ewl_Container *box); static void dialog_response_cb(Ewl_Widget *w, void *ev, void *data); static void run_dialog(Ewl_Widget *w, void *ev, void *data); static void dialog_delete_cb(Ewl_Widget *w, void *ev, void *data); +/* unit tests */ +static int constructor_test(char *buf, int len); + +static Ewl_Unit_Test dialog_unit_tests[] = { + {"constructor", constructor_test, NULL, -1, 0}, + {NULL, NULL, NULL, -1, 0} + }; + void test_info(Ewl_Test *test) { @@ -24,6 +33,7 @@ test->filename = __FILE__; test->func = create_test; test->type = EWL_TEST_TYPE_ADVANCED; + test->unit_tests = dialog_unit_tests; } static int @@ -184,4 +194,31 @@ ewl_widget_destroy(w); } +static int +constructor_test(char *buf, int len) +{ + Ewl_Widget *c; + int ret = 0; + + c = ewl_dialog_new(); + + if (!EWL_DIALOG_IS(c)) + { + LOG_FAILURE(buf, len, "returned dialog is not of the type" + " " EWL_DIALOG_TYPE); + goto DONE; + } + if (!!strcmp(ewl_widget_appearance_get(c), EWL_DIALOG_TYPE)) + { + LOG_FAILURE(buf, len, "the dialog's appearance differs to " + EWL_DIALOG_TYPE); + goto DONE; + } + + ret = 1; +DONE: + ewl_widget_destroy(c); + + return ret; +} |