static void test_parse(void) { const char *inputCSS = DFHashTableLookup(utgetdata(),"input.css"); if (inputCSS == NULL) { DFBufferFormat(utgetoutput(),"input.css not defined"); return; } CSSSheet *styleSheet = CSSSheetNew(); CSSSheetUpdateFromCSSText(styleSheet,inputCSS); char *text = CSSSheetCopyText(styleSheet); DFBufferFormat(utgetoutput(),"%s",text); free(text); DFBufferFormat(utgetoutput(), "================================================================================\n"); char *cssText = CSSSheetCopyCSSText(styleSheet); DFBufferFormat(utgetoutput(),"%s",cssText); free(cssText); CSSSheetRelease(styleSheet); }
int testCSS(const char *filename, DFError **error) { char *input = DFStringReadFromFile(filename,error); if (input == NULL) { DFErrorFormat(error,"%s: %s",filename,DFErrorMessage(error)); return 0; } CSSSheet *styleSheet = CSSSheetNew(); CSSSheetUpdateFromCSSText(styleSheet,input); char *text = CSSSheetCopyText(styleSheet); printf("%s",text); free(text); printf("================================================================================\n"); char *cssText = CSSSheetCopyCSSText(styleSheet); printf("%s",cssText); free(cssText); CSSSheetRelease(styleSheet); free(input); return 1; }