mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
fix travis build
This commit is contained in:
parent
e9ebade1af
commit
959ba08e4a
|
@ -8,8 +8,6 @@ namespace xlnt {
|
|||
|
||||
class worksheet;
|
||||
|
||||
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);
|
||||
|
||||
} // namespace xlnt
|
||||
|
|
|
@ -28,7 +28,7 @@ bool is_integral(long double d)
|
|||
|
||||
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");
|
||||
|
||||
|
@ -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("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;
|
||||
|
||||
auto sheet_data_node = root_node.append_child("sheetData");
|
||||
|
|
|
@ -639,7 +639,7 @@ public:
|
|||
{
|
||||
xlnt::worksheet ws(wb_);
|
||||
|
||||
auto xml_string = xlnt::write_worksheet(ws);
|
||||
auto xml_string = xlnt::write_worksheet(ws, {});
|
||||
|
||||
pugi::xml_document doc;
|
||||
doc.load(xml_string.c_str());
|
||||
|
@ -677,7 +677,7 @@ public:
|
|||
ws.get_page_margins().set_header(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;
|
||||
doc.load(xml_string.c_str());
|
||||
|
@ -825,7 +825,7 @@ public:
|
|||
ws.get_page_setup().set_horizontal_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;
|
||||
doc.load(xml_string.c_str());
|
||||
|
@ -905,7 +905,7 @@ public:
|
|||
pugi::xml_document observed_doc;
|
||||
|
||||
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));
|
||||
|
||||
|
@ -928,7 +928,7 @@ public:
|
|||
"</worksheet>";
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
{
|
||||
auto ws = wb_.create_sheet();
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_page_setup().set_sheet_state(xlnt::page_setup::sheet_state::hidden);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_cell("F42").set_value(false);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
ws.get_cell("F1").set_value(10);
|
||||
ws.get_cell("F2").set_value(32);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_cell("F1").set_value(10);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_cell("A1").set_value("test");
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public:
|
|||
auto ws = wb.get_sheet_by_index(0);
|
||||
ws.get_cell("F42").set_value("hello");
|
||||
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));
|
||||
|
||||
content = xlnt::write_workbook(wb);
|
||||
|
@ -171,7 +171,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_cell("F42").set_value("hello");
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_cell("F42").set_value("hello");
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
auto ws = wb_.create_sheet();
|
||||
ws.get_cell("F42").set_value("hello");
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ public:
|
|||
{
|
||||
auto ws = wb_.create_sheet();
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
{
|
||||
auto ws = wb_.create_sheet();
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user