00001 00012 #define GITK_TESTS_VALID_C 00013 00014 #include "libgitk.h" 00015 00016 00020 static void test_setup(void) { 00021 gitk_log("-- beg -----------------------"); 00022 } 00023 00027 static void test_teardown(void) { 00028 gitk_log("-- end -----------------------\n\n"); 00029 } 00030 00033 static gchar *dialog_desc_not_xml=\ 00034 "GITK is cool"; 00035 00038 static gchar *dialog_desc_not_giml=\ 00039 "<?xml version=\"1.0\" ?>" \ 00040 "<!DOCTYPE slides PUBLIC \"-//Norman Walsh//DTD Slides XML V3.0b2//EN\" \"http://docbook.sourceforge.net/release/slides/3.1.0/schema/dtd/slides.dtd\">" \ 00041 "<slides/>"; 00042 00045 static gchar *dialog_desc_invalid_giml=\ 00046 "<?xml version=\"1.0\" ?>"\ 00047 "<!DOCTYPE giml SYSTEM \"http://gitk.sourceforge.net/giml.dtd\">"\ 00048 "<giml xmlns=\""GITK_NS_URL"\""\ 00049 " xmlns:dc=\"http://purl.org/dc/elements/1.1/\""\ 00050 " xmlns:i18n=\""I18N_NS_URL"\""\ 00051 " >"\ 00052 " <gitk/>"\ 00053 "</giml>"; 00054 00058 START_TEST(test_gitk_valid_not_xml) { 00059 GitkDialogPtr dialog1; 00060 00061 gitk_init(&test_argc,&test_argvptr,PACKAGE,LOCALEDIR); 00062 mark_point(); 00063 if((dialog1=gitk_dialog_new_from_string(dialog_desc_not_xml))) { 00064 fail("this is not a valid dialog"); 00065 gitk_dialog_free(dialog1); 00066 } 00067 gitk_done(); 00068 } 00069 END_TEST 00070 00074 START_TEST(test_gitk_valid_not_giml) { 00075 GitkDialogPtr dialog1; 00076 00077 gitk_init(&test_argc,&test_argvptr,PACKAGE,LOCALEDIR); 00078 mark_point(); 00079 if((dialog1=gitk_dialog_new_from_string(dialog_desc_not_giml))) { 00080 fail("this is not a valid dialog"); 00081 gitk_dialog_free(dialog1); 00082 } 00083 gitk_done(); 00084 } 00085 END_TEST 00086 00090 START_TEST(test_gitk_valid_invalid_giml) { 00091 GitkDialogPtr dialog1; 00092 00093 gitk_init(&test_argc,&test_argvptr,PACKAGE,LOCALEDIR); 00094 mark_point(); 00095 if((dialog1=gitk_dialog_new_from_string(dialog_desc_invalid_giml))) { 00096 fail("this is not a valid dialog"); 00097 gitk_dialog_free(dialog1); 00098 } 00099 gitk_done(); 00100 } 00101 END_TEST 00102 00106 TCase *libgitk_valid_tcase(void) { 00107 TCase *tc = tcase_create("Valid"); 00108 00109 tcase_add_test(tc,test_gitk_valid_not_xml); 00110 tcase_add_test(tc,test_gitk_valid_not_giml); 00111 tcase_add_test(tc,test_gitk_valid_invalid_giml); 00112 tcase_add_unchecked_fixture(tc, test_setup, test_teardown); 00113 return(tc); 00114 }