コード例 #1
0
ファイル: CSSTests.c プロジェクト: apache/incubator-corinthia
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);
}
コード例 #2
0
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;
}