From 4b34273f1bc01fd826d405f56404877767bf5d23 Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Tue, 19 Jul 2016 20:27:14 -0400 Subject: [PATCH] test writing styled text --- source/workbook/tests/test_write_workbook.hpp | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/source/workbook/tests/test_write_workbook.hpp b/source/workbook/tests/test_write_workbook.hpp index 78ad6fb7..68775e05 100644 --- a/source/workbook/tests/test_write_workbook.hpp +++ b/source/workbook/tests/test_write_workbook.hpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -184,6 +185,45 @@ public: auto diff = Helper::compare_xml(expected, observed); TS_ASSERT(diff); } + + void test_write_shared_strings_with_runs() + { + xlnt::workbook wb; + auto ws = wb.get_active_sheet(); + auto cell = ws.get_cell("A1"); + xlnt::text_run run; + run.set_color("color"); + run.set_family(12); + run.set_font("font"); + run.set_scheme("scheme"); + run.set_size(13); + run.set_string("string"); + xlnt::text text; + text.add_run(run); + cell.set_value(text); + xlnt::shared_strings_serializer serializer; + pugi::xml_document xml; + serializer.write_shared_strings(wb.get_shared_strings(), xml); + + std::string expected = + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " string" + " " + " " + ""; + + auto diff = Helper::compare_xml(expected, xml); + TS_ASSERT(diff); + } private: xlnt::workbook wb_;