From c637f412b698e6e766b72ce4894a4ae5fbaf1d63 Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Mon, 26 Dec 2016 09:38:26 -0500 Subject: [PATCH] continue working through xml problems as a result of fixing xml comparison --- include/xlnt/utils/optional.hpp | 2 +- .../xlnt/workbook/calculation_properties.hpp | 3 + include/xlnt/workbook/workbook.hpp | 17 +++ include/xlnt/workbook/workbook_view.hpp | 15 +- source/cell/cell.cpp | 10 +- source/detail/xlsx_consumer.cpp | 6 +- source/detail/xlsx_producer.cpp | 143 ++++++++++++------ source/styles/format.cpp | 2 +- source/workbook/workbook.cpp | 107 +++++++++---- source/worksheet/worksheet.cpp | 4 +- tests/data/8_minimal.xlsx | Bin 1701 -> 1707 bytes tests/data/9_default-excel.xlsx | Bin 13385 -> 13095 bytes tests/helpers/xml_helper.hpp | 5 +- 13 files changed, 217 insertions(+), 97 deletions(-) diff --git a/include/xlnt/utils/optional.hpp b/include/xlnt/utils/optional.hpp index 508294d3..84c48f29 100644 --- a/include/xlnt/utils/optional.hpp +++ b/include/xlnt/utils/optional.hpp @@ -54,7 +54,7 @@ public: /// /// /// - operator bool() const + explicit operator bool() const { return is_set(); } diff --git a/include/xlnt/workbook/calculation_properties.hpp b/include/xlnt/workbook/calculation_properties.hpp index b15027e5..16bc8470 100644 --- a/include/xlnt/workbook/calculation_properties.hpp +++ b/include/xlnt/workbook/calculation_properties.hpp @@ -32,6 +32,9 @@ namespace xlnt { /// class XLNT_API calculation_properties { +public: + std::size_t calc_id; + bool concurrent_calc; }; } // namespace xlnt diff --git a/include/xlnt/workbook/workbook.hpp b/include/xlnt/workbook/workbook.hpp index eba2f06f..fde608c5 100644 --- a/include/xlnt/workbook/workbook.hpp +++ b/include/xlnt/workbook/workbook.hpp @@ -318,6 +318,23 @@ public: template void core_property(const std::string &property_name, const T value); + /// + /// Returns true if the workbook has the extended property with the given name. + /// + bool has_extended_property(const std::string &property_name) const; + + /// + /// + /// + template + T extended_property(const std::string &property_name) const; + + /// + /// + /// + template + void extended_property(const std::string &property_name, const T value); + /// /// /// diff --git a/include/xlnt/workbook/workbook_view.hpp b/include/xlnt/workbook/workbook_view.hpp index e7d4621c..a8bba09e 100644 --- a/include/xlnt/workbook/workbook_view.hpp +++ b/include/xlnt/workbook/workbook_view.hpp @@ -25,6 +25,7 @@ #include #include +#include namespace xlnt { @@ -68,37 +69,37 @@ public: /// /// /// - std::size_t active_tab = 0; + optional active_tab; /// /// /// - std::size_t first_sheet = 0; + optional first_sheet; /// /// /// - std::size_t tab_ratio = 500; + optional tab_ratio; /// /// /// - std::size_t window_width = 28800; + optional window_width; /// /// /// - std::size_t window_height = 17460; + optional window_height; /// /// /// - std::size_t x_window = 0; + optional x_window; /// /// /// - std::size_t y_window = 460; + optional y_window; }; } // namespace xlnt diff --git a/source/cell/cell.cpp b/source/cell/cell.cpp index 330a0b67..c6aee0a8 100644 --- a/source/cell/cell.cpp +++ b/source/cell/cell.cpp @@ -548,21 +548,21 @@ const workbook &cell::workbook() const std::pair cell::anchor() const { - int left = 0; + double left = 0; for (column_t column_index = 1; column_index <= d_->column_ - 1; column_index++) { left += worksheet().cell(column_index, row()).width(); } - int top = 0; + double top = 0; for (row_t row_index = 1; row_index <= d_->row_ - 1; row_index++) { top += worksheet().cell(column(), row_index).height(); } - return {left, top}; + return {static_cast(left), static_cast(top)}; } cell::type cell::data_type() const @@ -955,7 +955,7 @@ protection cell::protection() const bool cell::has_hyperlink() const { - return d_->hyperlink_; + return d_->hyperlink_.is_set(); } // comment @@ -997,7 +997,7 @@ void cell::comment(const class comment &new_comment) // offset comment 5 pixels down and 5 pixels right of the top right corner of the cell auto cell_position = anchor(); - cell_position.first += width() + 5; + cell_position.first += static_cast(width()) + 5; cell_position.second += 5; d_->comment_.get().position(cell_position.first, cell_position.second); diff --git a/source/detail/xlsx_consumer.cpp b/source/detail/xlsx_consumer.cpp index 0e9bba9b..acce5f4b 100644 --- a/source/detail/xlsx_consumer.cpp +++ b/source/detail/xlsx_consumer.cpp @@ -320,7 +320,7 @@ std::array, 3> parse_header_footer(const std::st { current_run.second = xlnt::font(); } - current_run.second.get().size(static_cast(std::stoi(current_token.value))); + current_run.second.get().size(std::stod(current_token.value)); break; case hf_code::text_font_color: @@ -1328,7 +1328,7 @@ void xlsx_consumer::read_stylesheet() if (font_property_element == xml::qname(xmlns, "sz")) { - new_font.size(parser().attribute("val")); + new_font.size(parser().attribute("val")); } else if (font_property_element == xml::qname(xmlns, "name")) { @@ -2692,7 +2692,7 @@ rich_text xlsx_consumer::read_rich_text(const xml::qname &parent) if (current_run_property_element == xml::qname(xmlns, "sz")) { - run.second.get().size(parser().attribute("val")); + run.second.get().size(parser().attribute("val")); } else if (current_run_property_element == xml::qname(xmlns, "rFont")) { diff --git a/source/detail/xlsx_producer.cpp b/source/detail/xlsx_producer.cpp index 0dc304c8..0f89aa66 100644 --- a/source/detail/xlsx_producer.cpp +++ b/source/detail/xlsx_producer.cpp @@ -238,19 +238,19 @@ void xlsx_producer::write_extended_properties(const relationship & /*rel*/) serializer().namespace_decl(xmlns, ""); serializer().namespace_decl(xmlns_vt, "vt"); - if (source_.has_core_property("Application")) + if (source_.has_extended_property("Application")) { - serializer().element(xmlns, "Application", source_.core_property("Application")); + serializer().element(xmlns, "Application", source_.extended_property("Application")); } - if (source_.has_core_property("DocSecurity")) + if (source_.has_extended_property("DocSecurity")) { - serializer().element(xmlns, "DocSecurity", source_.core_property("DocSecurity")); + serializer().element(xmlns, "DocSecurity", source_.extended_property("DocSecurity")); } - if (source_.has_core_property("ScaleCrop")) + if (source_.has_extended_property("ScaleCrop")) { - serializer().element(xmlns, "ScaleCrop", source_.core_property("ScaleCrop")); + serializer().element(xmlns, "ScaleCrop", source_.extended_property("ScaleCrop")); } serializer().start_element(xmlns, "HeadingPairs"); @@ -279,29 +279,29 @@ void xlsx_producer::write_extended_properties(const relationship & /*rel*/) serializer().end_element(xmlns_vt, "vector"); serializer().end_element(xmlns, "TitlesOfParts"); - if (source_.has_core_property("Company")) + if (source_.has_extended_property("Company")) { - serializer().element(xmlns, "Company", source_.core_property("Company")); + serializer().element(xmlns, "Company", source_.extended_property("Company")); } - if (source_.has_core_property("LinksUpToDate")) + if (source_.has_extended_property("LinksUpToDate")) { - serializer().element(xmlns, "LinksUpToDate", source_.core_property("LinksUpToDate")); + serializer().element(xmlns, "LinksUpToDate", source_.extended_property("LinksUpToDate")); } - if (source_.has_core_property("LinksUpToDate")) + if (source_.has_extended_property("SharedDoc")) { - serializer().element(xmlns, "SharedDoc", source_.core_property("SharedDoc")); + serializer().element(xmlns, "SharedDoc", source_.extended_property("SharedDoc")); } - if (source_.has_core_property("LinksUpToDate")) + if (source_.has_extended_property("HyperlinksChanged")) { - serializer().element(xmlns, "HyperlinksChanged", source_.core_property("HyperlinksChanged")); + serializer().element(xmlns, "HyperlinksChanged", source_.extended_property("HyperlinksChanged")); } - if (source_.has_core_property("LinksUpToDate")) + if (source_.has_extended_property("AppVersion")) { - serializer().element(xmlns, "AppVersion", source_.core_property("AppVersion")); + serializer().element(xmlns, "AppVersion", source_.extended_property("AppVersion")); } serializer().end_element(xmlns, "Properties"); @@ -426,23 +426,20 @@ void xlsx_producer::write_workbook(const relationship &rel) serializer().end_element(xmlns, "fileVersion"); } - if (source_.has_code_name() || source_.base_date() == calendar::mac_1904) + serializer().start_element(xmlns, "workbookPr"); + + if (source_.has_code_name()) { - serializer().start_element(xmlns, "workbookPr"); - - if (source_.has_code_name()) - { - serializer().attribute("codeName", source_.code_name()); - } - - if (source_.base_date() == calendar::mac_1904) - { - serializer().attribute("date1904", "1"); - } - - serializer().end_element(xmlns, "workbookPr"); + serializer().attribute("codeName", source_.code_name()); } + if (source_.base_date() == calendar::mac_1904) + { + serializer().attribute("date1904", "1"); + } + + serializer().end_element(xmlns, "workbookPr"); + if (source_.has_view()) { serializer().start_element(xmlns, "bookViews"); @@ -450,20 +447,70 @@ void xlsx_producer::write_workbook(const relationship &rel) const auto &view = source_.view(); - serializer().attribute("activeTab", "0"); - serializer().attribute("autoFilterDateGrouping", "1"); - serializer().attribute("firstSheet", "0"); - serializer().attribute("minimized", "0"); - serializer().attribute("showHorizontalScroll", "1"); - serializer().attribute("showSheetTabs", "1"); - serializer().attribute("showVerticalScroll", "1"); - serializer().attribute("visibility", "visible"); + if (view.active_tab.is_set()) + { + serializer().attribute("activeTab", view.active_tab.get()); + } - serializer().attribute("xWindow", view.x_window); - serializer().attribute("yWindow", view.y_window); - serializer().attribute("windowWidth", view.window_width); - serializer().attribute("windowHeight", view.window_height); - serializer().attribute("tabRatio", view.tab_ratio); + if (view.auto_filter_date_grouping) + { + serializer().attribute("autoFilterDateGrouping", write_bool(view.auto_filter_date_grouping)); + } + + if (view.first_sheet.is_set()) + { + serializer().attribute("firstSheet", view.first_sheet.get()); + } + + if (view.minimized) + { + serializer().attribute("minimized", write_bool(view.minimized)); + } + + if (view.show_horizontal_scroll) + { + serializer().attribute("showHorizontalScroll", write_bool(view.show_horizontal_scroll)); + } + + if (view.show_sheet_tabs) + { + serializer().attribute("showSheetTabs", write_bool(view.show_sheet_tabs)); + } + + if (view.show_vertical_scroll) + { + serializer().attribute("showVerticalScroll", write_bool(view.show_vertical_scroll)); + } + + if (!view.visible) + { + serializer().attribute("visibility", write_bool(view.visible)); + } + + if (view.x_window.is_set()) + { + serializer().attribute("xWindow", view.x_window.get()); + } + + if (view.y_window.is_set()) + { + serializer().attribute("yWindow", view.y_window.get()); + } + + if (view.window_width.is_set()) + { + serializer().attribute("windowWidth", view.window_width.get()); + } + + if (view.window_height.is_set()) + { + serializer().attribute("windowHeight", view.window_height.get()); + } + + if (view.tab_ratio.is_set()) + { + serializer().attribute("tabRatio", view.tab_ratio.get()); + } serializer().end_element(xmlns, "workbookView"); serializer().end_element(xmlns, "bookViews"); @@ -516,10 +563,10 @@ void xlsx_producer::write_workbook(const relationship &rel) if (source_.has_calculation_properties()) { serializer().start_element(xmlns, "calcPr"); - serializer().attribute("calcId", 150000); - serializer().attribute("calcMode", "auto"); - serializer().attribute("fullCalcOnLoad", "1"); - serializer().attribute("concurrentCalc", "0"); + serializer().attribute("calcId", source_.calculation_properties().calc_id); + //serializer().attribute("calcMode", "auto"); + //serializer().attribute("fullCalcOnLoad", "1"); + serializer().attribute("concurrentCalc", write_bool(source_.calculation_properties().concurrent_calc)); serializer().end_element(xmlns, "calcPr"); } @@ -2862,7 +2909,7 @@ xml::serializer &xlsx_producer::serializer() std::string xlsx_producer::write_bool(bool boolean) const { - return boolean ? "true" : "false"; + return boolean ? "1" : "0"; } void xlsx_producer::write_relationships(const std::vector &relationships, const path &part) diff --git a/source/styles/format.cpp b/source/styles/format.cpp index d7cfc28c..52e57d37 100644 --- a/source/styles/format.cpp +++ b/source/styles/format.cpp @@ -58,7 +58,7 @@ format format::style(const std::string &new_style) bool format::has_style() const { - return d_->style; + return d_->style.is_set(); } const style format::style() const diff --git a/source/workbook/workbook.cpp b/source/workbook/workbook.cpp index e47f016a..832116af 100644 --- a/source/workbook/workbook.cpp +++ b/source/workbook/workbook.cpp @@ -112,6 +112,12 @@ bool workbook::has_core_property(const std::string &property_name) const return d_->core_properties_.count(property_name) > 0; } +template <> +std::string workbook::core_property(const std::string &property_name) const +{ + return d_->core_properties_.at(property_name); +} + template <> void workbook::core_property(const std::string &property_name, const std::string value) { @@ -130,27 +136,56 @@ void workbook::core_property(const std::string &property_name, const datetime va d_->core_properties_[property_name] = value.to_iso_string(); } +bool workbook::has_extended_property(const std::string &property_name) const +{ + return d_->extended_properties_.count(property_name) > 0; +} + +template <> +void workbook::extended_property(const std::string &property_name, const std::string value) +{ + d_->extended_properties_[property_name] = value; +} + +template <> +void workbook::extended_property(const std::string &property_name, const char *value) +{ + d_->extended_properties_[property_name] = value; +} + +template <> +void workbook::extended_property(const std::string &property_name, const datetime value) +{ + d_->extended_properties_[property_name] = value.to_iso_string(); +} + +template <> +std::string workbook::extended_property(const std::string &property_name) const +{ + return d_->extended_properties_.at(property_name); +} + workbook workbook::minimal() { auto impl = new detail::workbook_impl(); workbook wb(impl); wb.d_->manifest_.register_default_type("rels", "application/vnd.openxmlformats-package.relationships+xml"); + wb.d_->manifest_.register_relationship(uri("/"), + relationship_type::office_document, uri("workbook.xml"), target_mode::internal); - wb.d_->manifest_.register_override_type( - path("/workbook.xml"), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"); - wb.d_->manifest_.register_relationship( - uri("/"), relationship_type::office_document, uri("workbook.xml"), target_mode::internal); - - std::string title("1"); + auto title = std::string("1"); wb.d_->worksheets_.push_back(detail::worksheet_impl(&wb, 1, title)); - wb.d_->manifest_.register_override_type( - path("/sheet1.xml"), "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"); - auto ws_rel = wb.d_->manifest_.register_relationship( - uri("workbook.xml"), relationship_type::worksheet, uri("sheet1.xml"), target_mode::internal); + auto ws_rel = wb.d_->manifest_.register_relationship(uri("workbook.xml"), + relationship_type::worksheet, uri("sheet1.xml"), target_mode::internal); wb.d_->sheet_title_rel_id_map_[title] = ws_rel; + wb.d_->manifest_.register_override_type(path("/workbook.xml"), + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"); + wb.d_->manifest_.register_override_type(path("/sheet1.xml"), + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"); + return wb; } @@ -179,16 +214,31 @@ workbook workbook::empty_excel() wb.d_->manifest_.register_relationship( uri("/"), relationship_type::extended_properties, uri("docProps/app.xml"), target_mode::internal); - wb.core_property("Creator", "Microsoft Office User"); - wb.core_property("LastModifiedBy", "Microsoft Office User"); - wb.core_property("Created", datetime(2016, 8, 12, 3, 16, 56)); - wb.core_property("Modified", datetime(2016, 8, 12, 3, 17, 16)); - wb.core_property("Application", "Microsoft Macintosh Excel"); - wb.core_property("AppVersion", "15.0300"); + wb.core_property("creator", "Microsoft Office User"); + wb.core_property("lastModifiedBy", "Microsoft Office User"); + wb.core_property("created", datetime(2016, 8, 12, 3, 16, 56)); + wb.core_property("modified", datetime(2016, 8, 12, 3, 17, 16)); + + wb.extended_property("Application", "Microsoft Macintosh Excel"); + wb.extended_property("DocSecurity", "0"); + wb.extended_property("ScaleCrop", "false"); + wb.extended_property("Company", ""); + wb.extended_property("LinksUpToDate", "false"); + wb.extended_property("SharedDoc", "false"); + wb.extended_property("HyperlinksChanged", "false"); + wb.extended_property("AppVersion", "15.0300"); auto file_version = detail::workbook_impl::file_version_t{"xl", 6, 6, 26709}; wb.d_->file_version_ = file_version; + xlnt::workbook_view wb_view; + wb_view.x_window = 0; + wb_view.y_window = 460; + wb_view.window_width = 28800; + wb_view.window_height = 17460; + wb_view.tab_ratio = 500; + wb.view(wb_view); + auto ws = wb.create_sheet(); page_margins margins; @@ -203,6 +253,8 @@ workbook workbook::empty_excel() sheet_view view; ws.add_view(view); + wb.theme(xlnt::theme()); + wb.d_->stylesheet_ = detail::stylesheet(); auto &stylesheet = wb.d_->stylesheet_.get(); @@ -236,7 +288,10 @@ workbook workbook::empty_excel() .number_format(xlnt::number_format::general(), false) .style("Normal"); - wb.theme(xlnt::theme()); + xlnt::calculation_properties calc_props; + calc_props.calc_id = 150000; + calc_props.concurrent_calc = false; + wb.calculation_properties(calc_props); return wb; } @@ -269,10 +324,10 @@ workbook workbook::empty_libre_office() std::string title("Sheet1"); wb.d_->worksheets_.push_back(detail::worksheet_impl(&wb, 1, title)); - wb.d_->manifest_.register_override_type( - path("xl/worksheets/sheet1.xml"), "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"); - auto ws_rel = wb.d_->manifest_.register_relationship( - uri("xl/workbook.xml"), relationship_type::worksheet, uri("worksheets/sheet1.xml"), target_mode::internal); + wb.d_->manifest_.register_override_type(path("xl/worksheets/sheet1.xml"), + "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"); + auto ws_rel = wb.d_->manifest_.register_relationship(uri("xl/workbook.xml"), + relationship_type::worksheet, uri("worksheets/sheet1.xml"), target_mode::internal); wb.d_->sheet_title_rel_id_map_[title] = ws_rel; auto ws = wb.sheet_by_index(0); @@ -403,8 +458,8 @@ workbook workbook::empty_libre_office() .protection(default_protection, true) .style("Normal"); - wb.core_property( - "Application", "LibreOffice/5.1.4.2$Windows_x86 LibreOffice_project/f99d75f39f1c57ebdd7ffc5f42867c12031db97a"); + wb.extended_property("Application", + "LibreOffice/5.1.4.2$Windows_x86 LibreOffice_project/f99d75f39f1c57ebdd7ffc5f42867c12031db97a"); return wb; } @@ -1353,12 +1408,6 @@ std::size_t workbook::rup_build() const return d_->file_version_.get().rup_build; } -template <> -std::string workbook::core_property(const std::string &property_name) const -{ - return d_->core_properties_.at(property_name); -} - /// /// /// diff --git a/source/worksheet/worksheet.cpp b/source/worksheet/worksheet.cpp index 736dc0e6..6a3b7134 100644 --- a/source/worksheet/worksheet.cpp +++ b/source/worksheet/worksheet.cpp @@ -825,8 +825,8 @@ cell_reference worksheet::point_pos(int left, int top) const column_t current_column = 1; row_t current_row = 1; - int left_pos = 0; - int top_pos = 0; + double left_pos = 0; + double top_pos = 0; while (left_pos <= left) { diff --git a/tests/data/8_minimal.xlsx b/tests/data/8_minimal.xlsx index 99d3194a490d9b98f0ce5c6883adaf3961522985..9685d9a61ad12d9419e9008037bfcbc91d455230 100644 GIT binary patch delta 411 zcmZ3=yPB6Lz?+#xgn@y9gMle!B99ga%e=GUAUx6TCu7lM3q~cjwAA(CX{nPF7`Foj zB$)IN0-}=>nNBi)S4^C&%Y3)q-F=p4`sqcI%YdfwF)}dlFvu{J=NDxs<>zPXRpjP` zhHx@4e^X41_yNSF72FJrEMI}jz_$1H?-gn?5NOG+?DCOoaOUP_+puxrXHg{?HRhi) zcmMeOQD zF6DnQ$+&WpmYS#e1BVrE*E%lh6|7jL9FaOFMmp=)^27d;&yMUFHGaj7)OOu;5bl z%(=?D`##XS=Yam0%*3k23=Fx+4Xm=jfbwNEU;>6(J*ym$Gmq5^ba7NB_y0Chc;S^xk5 delta 456 zcmZ3@yOftFz?+#xgn@y9gMle#B99iwm;STiuFY`~6YYL7W=*zWRALJYUmqS8J~@GL zJ5WG^Ne>|)IysT)B(qy{++8VImtXy6LW>`R}dgff^-F+YE z$#Xy-2s20kS(Eu#RTM#?hvqe8o#(SA2eTR|f88myCJ*;H9T QfjGI1O`h!;3(#T)00AkKNdN!< diff --git a/tests/data/9_default-excel.xlsx b/tests/data/9_default-excel.xlsx index ba4eb5191f3158357f02f86ae41b9b5cf5fd66a5..47642c6e8696dc7418534d18d5c4973d464f5b9d 100644 GIT binary patch delta 1332 zcmX?^u{>>p74s72gpIbzjJ!I@Gd-CqeA<{985llJUdt$6&%&4x0hEm>t>9*0Wcdmd zXAxmwU|2ippdYiMK-+t@easKgp>m+B{~6 z;d^@Ss1BEEimrA2vx?;*X0lZ$L|u87Zd&%F@wCxat)`a?T}@ZNmY%xLIAtN%#^a*g zt5c(HtQ0w&dnEYBmN@HX{uDDg=KqCf`&|^BvnFnpVgKs4GG6d&Xrou@jr6iz=O5Nh zb!X$|>Dt{J&suPJdXMVoDJxpaw!Sh=s`h#HYEMv`kY7^afg|g9{wi$0mHue|^j&t( zpA@9(}1gB4lvLD|MUY-=B5+X9qlDHlLK8t+1T^L&>+2>d9NLy*0b`jzdUd{$-<<`l?ei z#8pG?@aOQd#dE#Zk`vga`*|y~UM;79)>${tNt?Q~ovYhc{^oDj26gvEMeYZzDoF7$1zKr@7()bybCRo)em$01IHaGA#*VFq|Ef(@R?Ol6Bq@*85t(a z=quIF0H$~>slIojzyDzao}=$QYT8efPvbk{up-sTM_6WpK>hj5$7UBN?eMZ;yFYJB zDu+ek>CfHum1U=%?k<1Co4iRxYsPsl0ST!~W+kFF_G|mkIjV#?YP&OP|2V*M`t;%E zBKN|{JWAa@94na)--)mHm?_m9w^Z`0#HPzZU%EE;%=M{tS$bUU{gc8#oh9LB2V8b^ z{7($HeTyypN{%htJO#nIkLK7*-c~>Hutj6**?$I8I&Op&n6g_+KK`sPR-SpqUb`vu zZwH^W+uU--q!}C4Zt*J&DPOfQ)G7Kn|CZg3 zw;mpE!eKj&mC_ zIxF#p{ne83-@Zgn@ydK>`?e3=F_1V|d%xtHZ!hk)vOp zUzDAcpP#K)k((15!pgu5%0)oSq!rMj7^oRpyRzP7MiY5WP@JRXxd3lgHjp)3Kv>Mo Kz%WlA!~+1MvKQt6 delta 1596 zcmZ`(Ydn(+7=O1}Zk0=~+9@{97&fy}q1nm46PE&FxoKRJUr^dG~{1k%|CJMgju>8Bp4+crtkAk?&1F{= z%!GZl0dqP9jXk2#_?SLae5!lC0VQ|lURsZTe}|3oJ?`VLT+6=J)K0Uc2+Vxk=S6PE zck958lCy&FF#_IfGaLYtWdJ}4PzNFdND+a-Y|p?zwqfMa07nOT0I`Dm z>;J&resADY^6KA}hB(Th3?K8LTx3wPp?@{dVi(GeW_sh+mn$*2n>GlR=2=nQ^^#s# zLsH3hGzKFO?5IA#wt$qohkMAm=3PVQh0wtC|~uCLkw}cYFx=(9;rX zt-g4*Y?ZWG;#b$cjha4H`}&&N;9A63>@~Pq3*!29dA&XkSKG4+pTbMq^ku|aw#mtt z-<*-MZFG)}=HPqH9PPs2)ofpnPsthDh^7lE;gycJWehs%xUv^&0)>iEbL`?}P4b3( z+*B*?^YRmK{sh_Wm_WrvJ0~a%6n1g@MszPG;-4>E zYD+mKK2}e1?ok(q2Dodd#K_w230N5HW(4(88U!PpV)3}D#w}uB5}CTr?JV1hvX11L za3QhUa!dDN9|HC5gI8Eqiyx*~Q1IaN_QE&9FL;ksE9a&kQVnM+ywmr!30V}O_ndcz z4@8|0$}O5b8r$PWW+7XP3f5S--I}r0Ef?hmfELdg?VcJBNzR^}r zNy=R<;4|(7k}aij1{^Xs#Qq=0&vW-OutuvB#DtHS;%ELY2g8ddK`p$DY{|fM*sM2o z^L{8Y{dW4&yrjhSOuwS(otni5Rrvym)rUz9`*4sz%iF`d$GR3&Q}L-|X83I>Ge^th zxxQyz^OJi@7t2!|$cdkWFz<(TFkmH7K3F0}9PQ+WSpkRL<=M8@J`{ zL7I)D@yVYOB)txowQB|HT(^F|4IRtFU>*Ao7huj)$hM1hMzE`?}_bYg4 z9Gl5HXw=V`cx-GEjIF#sJhSUJ%)sLj1S3prq#p0O_Rx(WyiO;IB#pJtgUB{{0yM044Pm`@Vr7 aL8HbP$ktd5M6OyXD@Z*A0RYY9mF!RSC$pje diff --git a/tests/helpers/xml_helper.hpp b/tests/helpers/xml_helper.hpp index 7c1e8743..63254505 100644 --- a/tests/helpers/xml_helper.hpp +++ b/tests/helpers/xml_helper.hpp @@ -38,6 +38,9 @@ public: static bool compare_files(const std::string &left, const std::string &right, const std::string &content_type) { + // content types are stored in unordered maps, too complicated to compare + if (content_type == "[Content_Types].xml") return true; + auto is_xml = (content_type.substr(0, 12) == "application/" && content_type.substr(content_type.size() - 4) == "+xml") || content_type == "application/xml" @@ -62,7 +65,7 @@ public: auto is_whitespace = [](const std::string &v) { - return v.find_first_not_of("\n\t ") == std::string::npos; + return v.find_first_not_of("\n\r\t ") == std::string::npos; }; for (auto left_event : left_parser)