/* * Tests for the lib_xlsx_writer library. * * Copyright 2014-2021, John McNamara, jmcnamara@cpan.org * */ #include "../ctest.h" #include "../helper.h" #include "../../../include/xlsxwriter/relationships.h" // Test assembling a complete Relationships file. CTEST(relationships, relationships01) { char* got; char exp[] = "\n" "" "" "" "" "" "" ""; FILE* testfile = lxw_tmpfile(NULL); lxw_relationships *rels = lxw_relationships_new(); rels->file = testfile; lxw_add_document_relationship(rels, "/worksheet", "worksheets/sheet1.xml"); lxw_add_document_relationship(rels, "/theme", "theme/theme1.xml"); lxw_add_document_relationship(rels, "/styles", "styles.xml"); lxw_add_document_relationship(rels, "/sharedStrings", "sharedStrings.xml"); lxw_add_document_relationship(rels, "/calcChain", "calcChain.xml"); lxw_relationships_assemble_xml_file(rels); RUN_XLSX_STREQ_SHORT(exp, got); lxw_free_relationships(rels); } // Test assembling a complete Relationships file. CTEST(relationships, relationships02) { char* got; char exp[] = "\n" "" "" "" ""; FILE* testfile = lxw_tmpfile(NULL); lxw_relationships *rels = lxw_relationships_new(); rels->file = testfile; lxw_add_worksheet_relationship(rels, "/hyperlink", "www.foo.com", "External"); lxw_add_worksheet_relationship(rels, "/hyperlink", "link00.xlsx", "External"); lxw_relationships_assemble_xml_file(rels); RUN_XLSX_STREQ_SHORT(exp, got); lxw_free_relationships(rels); }