// Test the _write_font() function. CTEST(styles, write_font03) { char* got; char exp[] = "<font><i/><sz val=\"11\"/><color theme=\"1\"/><name val=\"Calibri\"/><family val=\"2\"/><scheme val=\"minor\"/></font>"; FILE* testfile = lxw_tmpfile(NULL); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); format_set_italic(format); styles->file = testfile; _write_font(styles, format, LXW_FALSE); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); lxw_format_free(format); }
// Test the _write_font() function. CTEST(styles, write_font16) { char* got; char exp[] = "<font><u val=\"doubleAccounting\"/><sz val=\"11\"/><color theme=\"1\"/><name val=\"Calibri\"/><family val=\"2\"/><scheme val=\"minor\"/></font>"; FILE* testfile = lxw_tmpfile(NULL); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); format_set_underline(format, LXW_UNDERLINE_DOUBLE_ACCOUNTING); styles->file = testfile; _write_font(styles, format, LXW_FALSE); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); lxw_format_free(format); }
// Test the _write_font() function. CTEST(styles, write_font06) { char* got; char exp[] = "<font><vertAlign val=\"superscript\"/><sz val=\"11\"/><color theme=\"1\"/><name val=\"Calibri\"/><family val=\"2\"/><scheme val=\"minor\"/></font>"; FILE* testfile = lxw_tmpfile(NULL); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); format_set_font_script(format, LXW_FONT_SUPERSCRIPT); styles->file = testfile; _write_font(styles, format, LXW_FALSE); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); lxw_format_free(format); }
// Test the _write_cell_xfs() function. CTEST(styles, write_cell_xfs) { char* got; char exp[] = "<cellXfs count=\"1\"><xf numFmtId=\"0\" fontId=\"0\" fillId=\"0\" borderId=\"0\" xfId=\"0\"/></cellXfs>"; FILE* testfile = tmpfile(); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); STAILQ_INSERT_TAIL(styles->xf_formats, format, list_pointers); styles->file = testfile; styles->xf_count = 1; _write_cell_xfs(styles); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); }
// Test the _write_font() function. CTEST(styles, write_fonts01) { char* got; char exp[] = "<fonts count=\"1\"><font><sz val=\"11\"/><color theme=\"1\"/><name val=\"Calibri\"/><family val=\"2\"/><scheme val=\"minor\"/></font></fonts>"; FILE* testfile = lxw_tmpfile(NULL); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); format->has_font = 1; STAILQ_INSERT_TAIL(styles->xf_formats, format, list_pointers); styles->file = testfile; styles->font_count = 1; _write_fonts(styles); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); }
// Test the _write_borders() function. CTEST(styles, write_borders) { char* got; char exp[] = "<borders count=\"1\"><border><left/><right/><top/><bottom/><diagonal/></border></borders>"; FILE* testfile = tmpfile(); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); format->has_border = 1; STAILQ_INSERT_TAIL(styles->xf_formats, format, list_pointers); styles->file = testfile; styles->border_count = 1; _write_borders(styles); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); }
// Test the _write_font() function. CTEST(styles, write_font17) { char* got; char exp[] = "<font><u/><sz val=\"11\"/><color theme=\"10\"/><name val=\"Calibri\"/><family val=\"2\"/></font>"; FILE* testfile = lxw_tmpfile(NULL); lxw_styles *styles = lxw_styles_new(); lxw_format *format = lxw_format_new(); format_set_underline(format, LXW_UNDERLINE_SINGLE); format_set_theme(format, 10); format->hyperlink = 1; styles->file = testfile; _write_font(styles, format, LXW_FALSE); RUN_XLSX_STREQ(exp, got); lxw_styles_free(styles); lxw_format_free(format); }