diff --git a/source/workbook/tests/test_write.hpp b/source/workbook/tests/test_write.hpp index 2e3bf34e..46533a8a 100644 --- a/source/workbook/tests/test_write.hpp +++ b/source/workbook/tests/test_write.hpp @@ -292,6 +292,52 @@ public: TS_SKIP("not implemented"); } + void test_write_page_setup() + { + xlnt::workbook wb; + auto ws = wb.get_active_sheet(); + + auto page_setup = ws.get_page_setup(); + page_setup.set_break(xlnt::page_break::column); + page_setup.set_fit_to_height(true); + page_setup.set_fit_to_page(true); + page_setup.set_fit_to_width(true); + page_setup.set_horizontal_centered(true); + page_setup.set_orientation(xlnt::orientation::landscape); + page_setup.set_paper_size(xlnt::paper_size::a5); + page_setup.set_scale(14.1); + page_setup.set_sheet_state(xlnt::sheet_state::very_hidden); + page_setup.set_vertical_centered(true); + + std::vector bytes; + wb.save(bytes); + + xlnt::zip_file archive; + archive.load(bytes); + auto worksheet_xml_string = archive.read("xl/worksheets/sheet1.xml"); + + pugi::xml_document worksheet_xml; + worksheet_xml.load(worksheet_xml_string.c_str()); + + std::string expected = + "" + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + " " + ""; + + TS_ASSERT(xml_helper::compare_xml(expected, worksheet_xml)); + } + private: temporary_file temp_file; xlnt::workbook wb_;