fix travis build

This commit is contained in:
Thomas Fussell 2015-10-26 17:35:47 -04:00
parent e9ebade1af
commit 959ba08e4a
4 changed files with 19 additions and 37 deletions

View File

@ -8,8 +8,6 @@ namespace xlnt {
class worksheet; class worksheet;
std::string write_worksheet(worksheet ws, std::string write_worksheet(worksheet ws, const std::vector<std::string> &string_table);
const std::vector<std::string> &string_table = {},
const std::unordered_map<std::size_t, std::string> &style_id_by_hash = {});
} // namespace xlnt } // namespace xlnt

View File

@ -28,7 +28,7 @@ bool is_integral(long double d)
namespace xlnt { namespace xlnt {
std::string write_worksheet(worksheet ws, const std::vector<std::string> &string_table, const std::unordered_map<std::size_t, std::string> &style_id_by_hash) std::string write_worksheet(worksheet ws, const std::vector<std::string> &string_table)
{ {
ws.get_cell("A1"); ws.get_cell("A1");
@ -107,22 +107,6 @@ std::string write_worksheet(worksheet ws, const std::vector<std::string> &string
sheet_format_pr_node.append_attribute("baseColWidth").set_value(10); sheet_format_pr_node.append_attribute("baseColWidth").set_value(10);
sheet_format_pr_node.append_attribute("defaultRowHeight").set_value(15); sheet_format_pr_node.append_attribute("defaultRowHeight").set_value(15);
std::vector<column_t> styled_columns;
if(!style_id_by_hash.empty())
{
auto cols_node = root_node.append_child("cols");
std::sort(styled_columns.begin(), styled_columns.end());
for(auto column : styled_columns)
{
auto col_node = cols_node.append_child("col");
col_node.append_attribute("min").set_value(column);
col_node.append_attribute("max").set_value(column);
col_node.append_attribute("style").set_value(1);
}
}
std::unordered_map<std::string, std::string> hyperlink_references; std::unordered_map<std::string, std::string> hyperlink_references;
auto sheet_data_node = root_node.append_child("sheetData"); auto sheet_data_node = root_node.append_child("sheetData");

View File

@ -639,7 +639,7 @@ public:
{ {
xlnt::worksheet ws(wb_); xlnt::worksheet ws(wb_);
auto xml_string = xlnt::write_worksheet(ws); auto xml_string = xlnt::write_worksheet(ws, {});
pugi::xml_document doc; pugi::xml_document doc;
doc.load(xml_string.c_str()); doc.load(xml_string.c_str());
@ -677,7 +677,7 @@ public:
ws.get_page_margins().set_header(1.5); ws.get_page_margins().set_header(1.5);
ws.get_page_margins().set_footer(1.5); ws.get_page_margins().set_footer(1.5);
auto xml_string = xlnt::write_worksheet(ws); auto xml_string = xlnt::write_worksheet(ws, {});
pugi::xml_document doc; pugi::xml_document doc;
doc.load(xml_string.c_str()); doc.load(xml_string.c_str());
@ -825,7 +825,7 @@ public:
ws.get_page_setup().set_horizontal_centered(true); ws.get_page_setup().set_horizontal_centered(true);
ws.get_page_setup().set_vertical_centered(true); ws.get_page_setup().set_vertical_centered(true);
auto xml_string = xlnt::write_worksheet(ws); auto xml_string = xlnt::write_worksheet(ws, {});
pugi::xml_document doc; pugi::xml_document doc;
doc.load(xml_string.c_str()); doc.load(xml_string.c_str());
@ -905,7 +905,7 @@ public:
pugi::xml_document observed_doc; pugi::xml_document observed_doc;
expected_doc.load(expected_xml_string.c_str()); expected_doc.load(expected_xml_string.c_str());
observed_doc.load(xlnt::write_worksheet(ws, {}, {}).c_str()); observed_doc.load(xlnt::write_worksheet(ws, {}).c_str());
TS_ASSERT(Helper::compare_xml(expected_doc, observed_doc)); TS_ASSERT(Helper::compare_xml(expected_doc, observed_doc));
@ -928,7 +928,7 @@ public:
"</worksheet>"; "</worksheet>";
expected_doc.load(expected_xml_string.c_str()); expected_doc.load(expected_xml_string.c_str());
observed_doc.load(xlnt::write_worksheet(ws, {}, {}).c_str()); observed_doc.load(xlnt::write_worksheet(ws, {}).c_str());
TS_ASSERT(Helper::compare_xml(expected_doc, observed_doc)); TS_ASSERT(Helper::compare_xml(expected_doc, observed_doc));
} }

View File

@ -65,7 +65,7 @@ public:
{ {
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("F42").set_value("hello"); ws.get_cell("F42").set_value("hello");
auto content = xlnt::write_worksheet(ws, {"hello"}, {}); auto content = xlnt::write_worksheet(ws, {"hello"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1.xml", content));
} }
@ -74,7 +74,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_page_setup().set_sheet_state(xlnt::page_setup::sheet_state::hidden); ws.get_page_setup().set_sheet_state(xlnt::page_setup::sheet_state::hidden);
ws.get_cell("F42").set_value("hello"); ws.get_cell("F42").set_value("hello");
auto content = xlnt::write_worksheet(ws, {"hello"}, {}); auto content = xlnt::write_worksheet(ws, {"hello"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1.xml", content));
} }
@ -83,7 +83,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("F42").set_value(false); ws.get_cell("F42").set_value(false);
ws.get_cell("F43").set_value(true); ws.get_cell("F43").set_value(true);
auto content = xlnt::write_worksheet(ws, {}, {}); auto content = xlnt::write_worksheet(ws, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_bool.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_bool.xml", content));
} }
@ -93,7 +93,7 @@ public:
ws.get_cell("F1").set_value(10); ws.get_cell("F1").set_value(10);
ws.get_cell("F2").set_value(32); ws.get_cell("F2").set_value(32);
ws.get_cell("F3").set_formula("F1+F2"); ws.get_cell("F3").set_formula("F1+F2");
auto content = xlnt::write_worksheet(ws, {}, {}); auto content = xlnt::write_worksheet(ws, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_formula.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_formula.xml", content));
} }
@ -102,7 +102,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("F1").set_value(10); ws.get_cell("F1").set_value(10);
ws.get_row_properties(ws.get_cell("F1").get_row()).height = 30; ws.get_row_properties(ws.get_cell("F1").get_row()).height = 30;
auto content = xlnt::write_worksheet(ws, {}, {}); auto content = xlnt::write_worksheet(ws, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_height.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_height.xml", content));
} }
@ -111,7 +111,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("A1").set_value("test"); ws.get_cell("A1").set_value("test");
ws.get_cell("A1").set_hyperlink("http://test.com"); ws.get_cell("A1").set_hyperlink("http://test.com");
auto content = xlnt::write_worksheet(ws, {"test"}, {}); auto content = xlnt::write_worksheet(ws, {"test"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml", content));
} }
@ -149,7 +149,7 @@ public:
auto ws = wb.get_sheet_by_index(0); auto ws = wb.get_sheet_by_index(0);
ws.get_cell("F42").set_value("hello"); ws.get_cell("F42").set_value("hello");
ws.auto_filter("A1:F1"); ws.auto_filter("A1:F1");
auto content = xlnt::write_worksheet(ws, {"hello"}, {}); auto content = xlnt::write_worksheet(ws, {"hello"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_auto_filter.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_auto_filter.xml", content));
content = xlnt::write_workbook(wb); content = xlnt::write_workbook(wb);
@ -171,7 +171,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("F42").set_value("hello"); ws.get_cell("F42").set_value("hello");
ws.freeze_panes("A4"); ws.freeze_panes("A4");
auto content = xlnt::write_worksheet(ws, {"hello"}, {}); auto content = xlnt::write_worksheet(ws, {"hello"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_horiz.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_horiz.xml", content));
} }
@ -180,7 +180,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("F42").set_value("hello"); ws.get_cell("F42").set_value("hello");
ws.freeze_panes("D1"); ws.freeze_panes("D1");
auto content = xlnt::write_worksheet(ws, {"hello"}, {}); auto content = xlnt::write_worksheet(ws, {"hello"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_vert.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_vert.xml", content));
} }
@ -189,7 +189,7 @@ public:
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("F42").set_value("hello"); ws.get_cell("F42").set_value("hello");
ws.freeze_panes("D4"); ws.freeze_panes("D4");
auto content = xlnt::write_worksheet(ws, {"hello"}, {}); auto content = xlnt::write_worksheet(ws, {"hello"});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_both.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_both.xml", content));
} }
@ -197,7 +197,7 @@ public:
{ {
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("A1").set_value(9781231231230LL); ws.get_cell("A1").set_value(9781231231230LL);
auto content = xlnt::write_worksheet(ws, {}, {}); auto content = xlnt::write_worksheet(ws, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/long_number.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/long_number.xml", content));
} }
@ -205,7 +205,7 @@ public:
{ {
auto ws = wb_.create_sheet(); auto ws = wb_.create_sheet();
ws.get_cell("A1").set_value(1234567890); ws.get_cell("A1").set_value(1234567890);
auto content = xlnt::write_worksheet(ws, {}, {}); auto content = xlnt::write_worksheet(ws, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/short_number.xml", content)); TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/short_number.xml", content));
} }