almost finished implementing core api

This commit is contained in:
Thomas Fussell 2014-05-13 14:40:28 -04:00
parent 14cb4e88a4
commit 55246437ea
4 changed files with 455 additions and 271 deletions

View File

@ -3,6 +3,7 @@
#include <iostream>
#include <cxxtest/TestSuite.h>
#include "pugixml.hpp"
#include "../xlnt.h"
class WorksheetTestSuite : public CxxTest::TestSuite
@ -14,321 +15,329 @@ public:
void test_new_worksheet()
{
ws = Worksheet(wb);
TS_ASSERT_EQUALS(wb, ws._parent);
xlnt::worksheet ws = wb.create_sheet();
TS_ASSERT_EQUALS(&wb, &ws.get_parent());
}
void test_new_sheet_name()
{
wb.worksheets = [];
ws = Worksheet(wb, title = "");
TS_ASSERT_EQUALS(repr(ws), "<Worksheet "Sheet1">");
xlnt::workbook wb;
wb.remove_sheet(wb.get_active_sheet());
xlnt::worksheet ws = wb.create_sheet();
TS_ASSERT_EQUALS(ws.to_string(), "<Worksheet \"Sheet1\">");
}
void test_get_cell()
{
ws = Worksheet(wb);
cell = ws.cell("A1");
xlnt::worksheet ws(wb);
auto cell = ws.cell("A1");
TS_ASSERT_EQUALS(cell.get_coordinate(), "A1");
}
void test_set_bad_title()
{
std::string title(50, 'X');
xlnt::workbook wb;
wb.create_sheet(title);
}
void test_set_bad_title_character()
{
assert_raises(SheetTitleException, Worksheet, wb, "[");
assert_raises(SheetTitleException, Worksheet, wb, "]");
assert_raises(SheetTitleException, Worksheet, wb, "*");
assert_raises(SheetTitleException, Worksheet, wb, ":");
assert_raises(SheetTitleException, Worksheet, wb, "?");
assert_raises(SheetTitleException, Worksheet, wb, "/");
assert_raises(SheetTitleException, Worksheet, wb, "\\");
TS_ASSERT_THROWS(wb.create_sheet("["), xlnt::bad_sheet_title);
TS_ASSERT_THROWS(wb.create_sheet("]"), xlnt::bad_sheet_title);
TS_ASSERT_THROWS(wb.create_sheet("*"), xlnt::bad_sheet_title);
TS_ASSERT_THROWS(wb.create_sheet(":"), xlnt::bad_sheet_title);
TS_ASSERT_THROWS(wb.create_sheet("?"), xlnt::bad_sheet_title);
TS_ASSERT_THROWS(wb.create_sheet("/"), xlnt::bad_sheet_title);
TS_ASSERT_THROWS(wb.create_sheet("\\"), xlnt::bad_sheet_title);
}
void test_worksheet_dimension()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
TS_ASSERT_EQUALS("A1:A1", ws.calculate_dimension());
ws.cell("B12").value = "AAA";
ws.cell("B12") = "AAA";
TS_ASSERT_EQUALS("A1:B12", ws.calculate_dimension());
}
void test_worksheet_range()
{
ws = Worksheet(wb);
xlrange = ws.range("A1:C4");
assert isinstance(xlrange, tuple);
TS_ASSERT_EQUALS(4, len(xlrange));
TS_ASSERT_EQUALS(3, len(xlrange[0]));
xlnt::worksheet ws(wb);
auto xlrange = ws.range("A1:C4");
TS_ASSERT_EQUALS(4, xlrange.size());
TS_ASSERT_EQUALS(3, xlrange[0].size());
}
void test_worksheet_named_range()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
wb.create_named_range("test_range", ws, "C5");
xlrange = ws.range("test_range");
assert isinstance(xlrange, Cell);
TS_ASSERT_EQUALS(5, xlrange.row);
auto xlrange = ws.range("test_range");
TS_ASSERT_EQUALS(1, xlrange.size());
TS_ASSERT_EQUALS(1, xlrange[0].size());
TS_ASSERT_EQUALS(5, xlrange[0][0].get_row());
}
void test_bad_named_range()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.range("bad_range");
}
void test_named_range_wrong_sheet()
{
ws1 = Worksheet(wb);
ws2 = Worksheet(wb);
xlnt::worksheet ws1(wb);
xlnt::worksheet ws2(wb);
wb.create_named_range("wrong_sheet_range", ws1, "C5");
ws2.range("wrong_sheet_range");
}
void test_cell_offset()
{
ws = Worksheet(wb);
TS_ASSERT_EQUALS("C17", ws.cell("B15").offset(2, 1).get_coordinate());
xlnt::worksheet ws(wb);
TS_ASSERT_EQUALS("C17", ws.cell("B15").get_offset(2, 1).get_coordinate());
}
void test_range_offset()
{
ws = Worksheet(wb);
xlrange = ws.range("A1:C4", 1, 3);
assert isinstance(xlrange, tuple);
TS_ASSERT_EQUALS(4, len(xlrange));
TS_ASSERT_EQUALS(3, len(xlrange[0]));
xlnt::worksheet ws(wb);
auto xlrange = ws.range("A1:C4", 1, 3);
TS_ASSERT_EQUALS(4, xlrange.size());
TS_ASSERT_EQUALS(3, xlrange[0].size());
TS_ASSERT_EQUALS("D2", xlrange[0][0].get_coordinate());
}
void test_cell_alternate_coordinates()
{
ws = Worksheet(wb);
cell = ws.cell(row = 8, column = 4);
xlnt::worksheet ws(wb);
auto cell = ws.cell(8, 4);
TS_ASSERT_EQUALS("E9", cell.get_coordinate());
}
void test_cell_insufficient_coordinates()
{
ws = Worksheet(wb);
cell = ws.cell(row = 8);
}
void test_cell_range_name()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
wb.create_named_range("test_range_single", ws, "B12");
assert_raises(CellCoordinatesException, ws.cell, "test_range_single");
c_range_name = ws.range("test_range_single");
c_range_coord = ws.range("B12");
c_cell = ws.cell("B12");
TS_ASSERT_THROWS(ws.cell("test_range_single"), xlnt::bad_cell_coordinates);
auto c_range_name = ws.range("test_range_single");
auto c_range_coord = ws.range("B12");
auto c_cell = ws.cell("B12");
TS_ASSERT_EQUALS(c_range_coord, c_range_name);
TS_ASSERT_EQUALS(c_range_coord, c_cell);
}
void test_garbage_collect()
{
ws = Worksheet(wb);
ws.cell("A1").value = "";
ws.cell("B2").value = "0";
ws.cell("C4").value = 0;
xlnt::worksheet ws(wb);
ws.cell("A1") = "";
ws.cell("B2") = "0";
ws.cell("C4") = 0;
ws.garbage_collect();
for i, cell in enumerate(ws.get_cell_collection())
std::set<xlnt::cell> comparison_cells = {ws.cell("B2"), ws.cell("C4")};
for(auto cell : ws.get_cell_collection())
{
TS_ASSERT_EQUALS(cell, [ws.cell("B2"), ws.cell("C4")][i]);
auto match = std::find(comparison_cells.begin(), comparison_cells.end(), cell);
TS_ASSERT_DIFFERS(match, comparison_cells.end());
comparison_cells.erase(match);
}
}
void test_hyperlink_relationships()
{
ws = Worksheet(wb);
TS_ASSERT_EQUALS(len(ws.relationships), 0);
xlnt::worksheet ws(wb);
ws.cell("A1").hyperlink = "http:test.com";
TS_ASSERT_EQUALS(len(ws.relationships), 1);
TS_ASSERT_EQUALS("rId1", ws.cell("A1").hyperlink_rel_id);
TS_ASSERT_EQUALS("rId1", ws.relationships[0].id);
TS_ASSERT_EQUALS("http:test.com", ws.relationships[0].target);
TS_ASSERT_EQUALS("External", ws.relationships[0].target_mode);
TS_ASSERT_EQUALS(ws.get_relationships().size(), 0);
ws.cell("A2").hyperlink = "http:test2.com";
TS_ASSERT_EQUALS(len(ws.relationships), 2);
TS_ASSERT_EQUALS("rId2", ws.cell("A2").hyperlink_rel_id);
TS_ASSERT_EQUALS("rId2", ws.relationships[1].id);
TS_ASSERT_EQUALS("http:test2.com", ws.relationships[1].target);
TS_ASSERT_EQUALS("External", ws.relationships[1].target_mode);
ws.cell("A1").set_hyperlink("http:test.com");
TS_ASSERT_EQUALS(ws.get_relationships().size(), 1);
TS_ASSERT_EQUALS("rId1", ws.cell("A1").get_hyperlink_rel_id());
TS_ASSERT_EQUALS("rId1", ws.get_relationships()[0].get_id());
TS_ASSERT_EQUALS("http:test.com", ws.get_relationships()[0].get_target_uri());
TS_ASSERT_EQUALS("External", ws.get_relationships()[0].get_target_mode());
ws.cell("A2").set_hyperlink("http:test2.com");
TS_ASSERT_EQUALS(ws.get_relationships().size(), 2);
TS_ASSERT_EQUALS("rId2", ws.cell("A2").get_hyperlink_rel_id());
TS_ASSERT_EQUALS("rId2", ws.get_relationships()[1].get_id());
TS_ASSERT_EQUALS("http:test2.com", ws.get_relationships()[1].get_target_uri());
TS_ASSERT_EQUALS("External", ws.get_relationships()[1].get_target_mode());
}
void test_bad_relationship_type()
{
rel = Relationship("bad_type");
xlnt::relationship rel("bad_type");
}
void test_append_list()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.append(["This is A1", "This is B1"]);
ws.append(std::vector<std::string> {"This is A1", "This is B1"});
TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
TS_ASSERT_EQUALS("This is B1", ws.cell("B1").value);
TS_ASSERT_EQUALS("This is A1", ws.cell("A1"));
TS_ASSERT_EQUALS("This is B1", ws.cell("B1"));
}
void test_append_dict_letter()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.append({"A" : "This is A1", "C" : "This is C1"});
ws.append(std::unordered_map<std::string, std::string> {{"A", "This is A1"}, {"C", "This is C1"}});
TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
TS_ASSERT_EQUALS("This is C1", ws.cell("C1").value);
TS_ASSERT_EQUALS("This is A1", ws.cell("A1"));
TS_ASSERT_EQUALS("This is C1", ws.cell("C1"));
}
void test_append_dict_index()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.append({0 : "This is A1", 2 : "This is C1"});
ws.append(std::unordered_map<int, std::string> {{0, "This is A1"}, {2, "This is C1"}});
TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
TS_ASSERT_EQUALS("This is C1", ws.cell("C1").value);
}
void test_bad_append()
{
ws = Worksheet(wb);
ws.append("test");
TS_ASSERT_EQUALS("This is A1", ws.cell("A1"));
TS_ASSERT_EQUALS("This is C1", ws.cell("C1"));
}
void test_append_2d_list()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.append(["This is A1", "This is B1"]);
ws.append(["This is A2", "This is B2"]);
ws.append(std::vector<std::string> {"This is A1", "This is B1"});
ws.append(std::vector<std::string> {"This is A2", "This is B2"});
vals = ws.range("A1:B2");
auto vals = ws.range("A1:B2");
TS_ASSERT_EQUALS((("This is A1", "This is B1"),
("This is A2", "This is B2"), ), flatten(vals));
TS_ASSERT_EQUALS(vals[0][0], "This is A1");
TS_ASSERT_EQUALS(vals[0][1], "This is B1");
TS_ASSERT_EQUALS(vals[1][0], "This is A2");
TS_ASSERT_EQUALS(vals[1][1], "This is A2");
}
void test_rows()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.cell("A1").value = "first";
ws.cell("C9").value = "last";
ws.cell("A1") = "first";
ws.cell("C9") = "last";
rows = ws.rows;
auto rows = ws.rows();
TS_ASSERT_EQUALS(len(rows), 9);
TS_ASSERT_EQUALS(rows.size(), 9);
TS_ASSERT_EQUALS(rows[0][0].value, "first");
TS_ASSERT_EQUALS(rows[-1][-1].value, "last");
TS_ASSERT_EQUALS(rows[0][0], "first");
TS_ASSERT_EQUALS(rows[8][2], "last");
}
void test_cols()
{
ws = Worksheet(wb);
xlnt::worksheet ws(wb);
ws.cell("A1").value = "first";
ws.cell("C9").value = "last";
ws.cell("A1") = "first";
ws.cell("C9") = "last";
cols = ws.columns;
auto cols = ws.columns();
TS_ASSERT_EQUALS(len(cols), 3);
TS_ASSERT_EQUALS(cols.size(), 3);
TS_ASSERT_EQUALS(cols[0][0].value, "first");
TS_ASSERT_EQUALS(cols[-1][-1].value, "last");
TS_ASSERT_EQUALS(cols[0][0], "first");
TS_ASSERT_EQUALS(cols[8][2], "last");
}
void test_auto_filter()
{
ws = Worksheet(wb);
ws.auto_filter = ws.range("a1:f1");
assert ws.auto_filter == "A1:F1";
xlnt::worksheet ws(wb);
ws.auto_filter = "";
/*ws.set_auto_filter(ws.range("a1:f1"));
TS_ASSERT_EQUALS(ws.get_auto_filter(), "A1:F1");
ws.set_auto_filter("");
assert ws.auto_filter is None;
ws.auto_filter = "c1:g9";
assert ws.auto_filter == "C1:G9";
assert ws.auto_filter == "C1:G9";*/
}
void test_page_margins()
{
ws = Worksheet(wb);
ws.page_margins.left = 2.0;
ws.page_margins.right = 2.0;
ws.page_margins.top = 2.0;
ws.page_margins.bottom = 2.0;
ws.page_margins.header = 1.5;
ws.page_margins.footer = 1.5;
xml_string = write_worksheet(ws, None, None);
assert "<pageMargins left="2.00" right="2.00" top="2.00" bottom="2.00" header="1.50" footer="1.50"></pageMargins>" in xml_string;
xlnt::worksheet ws(wb);
ws = Worksheet(wb);
xml_string = write_worksheet(ws, None, None);
assert "<pageMargins" not in xml_string;
/*ws.get_page_margins().set_left(2.0);
ws.get_page_margins().set_right(2.0);
ws.get_page_margins().set_top(2.0);
ws.get_page_margins().set_bottom(2.0);
ws.get_page_margins().set_header(1.5);
ws.get_page_margins().set_footer(1.5);*/
auto xml_string = xlnt::writer::write_worksheet(ws);
//assert "<pageMargins left="2.00" right="2.00" top="2.00" bottom="2.00" header="1.50" footer="1.50"></pageMargins>" in xml_string;
xlnt::worksheet ws2(wb);
xml_string = xlnt::writer::write_worksheet(ws2);
//assert "<pageMargins" not in xml_string;
}
void test_merge()
{
ws = Worksheet(wb);
string_table = {"":"", "Cell A1" : "Cell A1", "Cell B1" : "Cell B1"};
xlnt::worksheet ws(wb);
ws.cell("A1").value = "Cell A1";
ws.cell("B1").value = "Cell B1";
xml_string = write_worksheet(ws, string_table, None);
assert "<c r="B1" t="s"><v>Cell B1</v></c>" in xml_string;
std::unordered_map<std::string, std::string> string_table = {{"", ""}, {"Cell A1", "Cell A1"}, {"Cell B1", "Cell B1"}};
ws.cell("A1") = "Cell A1";
ws.cell("B1") = "Cell B1";
auto xml_string = xlnt::writer::write_worksheet(ws);// , string_table);
/*assert "<c r="B1" t="s"><v>Cell B1</v></c>" in xml_string;
ws.merge_cells("A1:B1");
xml_string = write_worksheet(ws, string_table, None);
xml_string = xlnt::writer::write_worksheet(ws, string_table, None);
assert "<c r="B1" t="s"><v>Cell B1</v></c>" not in xml_string;
assert "<mergeCells><mergeCell ref="A1:B1"></mergeCell></mergeCells>" in xml_string;
ws.unmerge_cells("A1:B1");
xml_string = write_worksheet(ws, string_table, None);
assert "<mergeCell ref="A1:B1"></mergeCell>" not in xml_string;
xml_string = xlnt::writer::write_worksheet(ws, string_table, None);
assert "<mergeCell ref="A1:B1"></mergeCell>" not in xml_string;*/
}
void test_freeze()
{
ws = Worksheet(wb);
ws.freeze_panes = ws.cell("b2");
assert ws.freeze_panes == "B2";
xlnt::worksheet ws(wb);
ws.freeze_panes = "";
assert ws.freeze_panes is None;
ws.set_freeze_panes(ws.cell("b2"));
TS_ASSERT_EQUALS(ws.get_freeze_panes().get_address(), "B2");
ws.freeze_panes = "c5";
assert ws.freeze_panes == "C5";
ws.unfreeze_panes();
TS_ASSERT_EQUALS(ws.get_freeze_panes(), nullptr);
ws.freeze_panes = ws.cell("A1");
assert ws.freeze_panes is None;
ws.set_freeze_panes("c5");
TS_ASSERT_EQUALS(ws.get_freeze_panes().get_address(), "C5");
ws.set_freeze_panes(ws.cell("A1"));
TS_ASSERT_EQUALS(ws.get_freeze_panes(), nullptr);
}
void test_printer_settings()
{
ws = Worksheet(wb);
ws.page_setup.orientation = ws.ORIENTATION_LANDSCAPE;
ws.page_setup.paperSize = ws.PAPERSIZE_TABLOID;
ws.page_setup.fitToPage = True;
ws.page_setup.fitToHeight = 0;
ws.page_setup.fitToWidth = 1;
xml_string = write_worksheet(ws, None, None);
assert "<pageSetup orientation="landscape" paperSize="3" fitToHeight="0" fitToWidth="1"></pageSetup>" in xml_string;
assert "<pageSetUpPr fitToPage="1"></pageSetUpPr>" in xml_string;
xlnt::worksheet ws(wb);
ws = Worksheet(wb);
xml_string = write_worksheet(ws, None, None);
assert "<pageSetup" not in xml_string;
assert "<pageSetUpPr" not in xml_string;
ws.get_page_setup().orientation = xlnt::page_setup::Orientation::Landscape;
ws.get_page_setup().paper_size = xlnt::page_setup::PaperSize::Tabloid;
ws.get_page_setup().fit_to_page = true;
ws.get_page_setup().fit_to_height = false;
ws.get_page_setup().fit_to_width = true;
auto xml_string = xlnt::writer::write_worksheet(ws);
//pugi::xml_document doc;
//TS_ASSERT("<pageSetup orientation=\"landscape\" paperSize=\"3\" fitToHeight=\"0\" fitToWidth=\"1\"></pageSetup>" in xml_string);
//TS_ASSERT("<pageSetUpPr fitToPage=\"1\"></pageSetUpPr>" in xml_string);
xlnt::worksheet ws2(wb);
xml_string = xlnt::writer::write_worksheet(ws2);
//TS_ASSERT("<pageSetup" not in xml_string);
//TS_ASSERT("<pageSetUpPr" not in xml_string);
}
private:
xlnt::workbook wb;
};

View File

@ -280,47 +280,47 @@ public:
static DumpTestSuite suite_DumpTestSuite;
static CxxTest::List Tests_DumpTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_DumpTestSuite( "../../source/tests/DumpTestSuite.h", 8, "DumpTestSuite", suite_DumpTestSuite, Tests_DumpTestSuite );
CxxTest::StaticSuiteDescription suiteDescription_DumpTestSuite( "../../source/tests/DumpTestSuite.h", 9, "DumpTestSuite", suite_DumpTestSuite, Tests_DumpTestSuite );
static class TestDescription_suite_DumpTestSuite_test_dump_sheet_title : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_dump_sheet_title() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 25, "test_dump_sheet_title" ) {}
TestDescription_suite_DumpTestSuite_test_dump_sheet_title() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 19, "test_dump_sheet_title" ) {}
void runTest() { suite_DumpTestSuite.test_dump_sheet_title(); }
} testDescription_suite_DumpTestSuite_test_dump_sheet_title;
static class TestDescription_suite_DumpTestSuite_test_dump_sheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_dump_sheet() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 36, "test_dump_sheet" ) {}
TestDescription_suite_DumpTestSuite_test_dump_sheet() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 31, "test_dump_sheet" ) {}
void runTest() { suite_DumpTestSuite.test_dump_sheet(); }
} testDescription_suite_DumpTestSuite_test_dump_sheet;
static class TestDescription_suite_DumpTestSuite_test_table_builder : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_table_builder() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 81, "test_table_builder" ) {}
TestDescription_suite_DumpTestSuite_test_table_builder() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 86, "test_table_builder" ) {}
void runTest() { suite_DumpTestSuite.test_table_builder(); }
} testDescription_suite_DumpTestSuite_test_table_builder;
static class TestDescription_suite_DumpTestSuite_test_open_too_many_files : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_open_too_many_files() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 108, "test_open_too_many_files" ) {}
TestDescription_suite_DumpTestSuite_test_open_too_many_files() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 113, "test_open_too_many_files" ) {}
void runTest() { suite_DumpTestSuite.test_open_too_many_files(); }
} testDescription_suite_DumpTestSuite_test_open_too_many_files;
static class TestDescription_suite_DumpTestSuite_test_create_temp_file : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_create_temp_file() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 121, "test_create_temp_file" ) {}
TestDescription_suite_DumpTestSuite_test_create_temp_file() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 128, "test_create_temp_file" ) {}
void runTest() { suite_DumpTestSuite.test_create_temp_file(); }
} testDescription_suite_DumpTestSuite_test_create_temp_file;
static class TestDescription_suite_DumpTestSuite_test_dump_twice : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_dump_twice() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 131, "test_dump_twice" ) {}
TestDescription_suite_DumpTestSuite_test_dump_twice() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 138, "test_dump_twice" ) {}
void runTest() { suite_DumpTestSuite.test_dump_twice(); }
} testDescription_suite_DumpTestSuite_test_dump_twice;
static class TestDescription_suite_DumpTestSuite_test_append_after_save : public CxxTest::RealTestDescription {
public:
TestDescription_suite_DumpTestSuite_test_append_after_save() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 145, "test_append_after_save" ) {}
TestDescription_suite_DumpTestSuite_test_append_after_save() : CxxTest::RealTestDescription( Tests_DumpTestSuite, suiteDescription_DumpTestSuite, 154, "test_append_after_save" ) {}
void runTest() { suite_DumpTestSuite.test_append_after_save(); }
} testDescription_suite_DumpTestSuite_test_append_after_save;
@ -331,51 +331,45 @@ static IterTestSuite suite_IterTestSuite;
static CxxTest::List Tests_IterTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_IterTestSuite( "../../source/tests/IterTestSuite.h", 8, "IterTestSuite", suite_IterTestSuite, Tests_IterTestSuite );
static class TestDescription_suite_IterTestSuite_test_1 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_1() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 16, "test_1" ) {}
void runTest() { suite_IterTestSuite.test_1(); }
} testDescription_suite_IterTestSuite_test_1;
static class TestDescription_suite_IterTestSuite_test_get_dimensions : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_get_dimensions() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 21, "test_get_dimensions" ) {}
TestDescription_suite_IterTestSuite_test_get_dimensions() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 16, "test_get_dimensions" ) {}
void runTest() { suite_IterTestSuite.test_get_dimensions(); }
} testDescription_suite_IterTestSuite_test_get_dimensions;
static class TestDescription_suite_IterTestSuite_test_read_fast_integrated : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_read_fast_integrated() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 33, "test_read_fast_integrated" ) {}
TestDescription_suite_IterTestSuite_test_read_fast_integrated() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 29, "test_read_fast_integrated" ) {}
void runTest() { suite_IterTestSuite.test_read_fast_integrated(); }
} testDescription_suite_IterTestSuite_test_read_fast_integrated;
static class TestDescription_suite_IterTestSuite_test_get_boundaries_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_get_boundaries_range() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 53, "test_get_boundaries_range" ) {}
TestDescription_suite_IterTestSuite_test_get_boundaries_range() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 49, "test_get_boundaries_range" ) {}
void runTest() { suite_IterTestSuite.test_get_boundaries_range(); }
} testDescription_suite_IterTestSuite_test_get_boundaries_range;
static class TestDescription_suite_IterTestSuite_test_get_boundaries_one : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_get_boundaries_one() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 58, "test_get_boundaries_one" ) {}
TestDescription_suite_IterTestSuite_test_get_boundaries_one() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 54, "test_get_boundaries_one" ) {}
void runTest() { suite_IterTestSuite.test_get_boundaries_one(); }
} testDescription_suite_IterTestSuite_test_get_boundaries_one;
static class TestDescription_suite_IterTestSuite_test_read_single_cell_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_read_single_cell_range() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 63, "test_read_single_cell_range" ) {}
TestDescription_suite_IterTestSuite_test_read_single_cell_range() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 59, "test_read_single_cell_range" ) {}
void runTest() { suite_IterTestSuite.test_read_single_cell_range(); }
} testDescription_suite_IterTestSuite_test_read_single_cell_range;
static class TestDescription_suite_IterTestSuite_test_read_fast_integrated2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_read_fast_integrated2() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 71, "test_read_fast_integrated2" ) {}
TestDescription_suite_IterTestSuite_test_read_fast_integrated2() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 67, "test_read_fast_integrated2" ) {}
void runTest() { suite_IterTestSuite.test_read_fast_integrated2(); }
} testDescription_suite_IterTestSuite_test_read_fast_integrated2;
static class TestDescription_suite_IterTestSuite_test_read_single_cell_date : public CxxTest::RealTestDescription {
public:
TestDescription_suite_IterTestSuite_test_read_single_cell_date() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 89, "test_read_single_cell_date" ) {}
TestDescription_suite_IterTestSuite_test_read_single_cell_date() : CxxTest::RealTestDescription( Tests_IterTestSuite, suiteDescription_IterTestSuite, 85, "test_read_single_cell_date" ) {}
void runTest() { suite_IterTestSuite.test_read_single_cell_date(); }
} testDescription_suite_IterTestSuite_test_read_single_cell_date;
@ -394,7 +388,7 @@ public:
static class TestDescription_suite_MetaTestSuite_test_write_root_rels : public CxxTest::RealTestDescription {
public:
TestDescription_suite_MetaTestSuite_test_write_root_rels() : CxxTest::RealTestDescription( Tests_MetaTestSuite, suiteDescription_MetaTestSuite, 27, "test_write_root_rels" ) {}
TestDescription_suite_MetaTestSuite_test_write_root_rels() : CxxTest::RealTestDescription( Tests_MetaTestSuite, suiteDescription_MetaTestSuite, 26, "test_write_root_rels" ) {}
void runTest() { suite_MetaTestSuite.test_write_root_rels(); }
} testDescription_suite_MetaTestSuite_test_write_root_rels;
@ -773,7 +767,7 @@ public:
static class TestDescription_suite_ReadTestSuite_test_read_empty_file : public CxxTest::RealTestDescription {
public:
TestDescription_suite_ReadTestSuite_test_read_empty_file() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 65, "test_read_empty_file" ) {}
TestDescription_suite_ReadTestSuite_test_read_empty_file() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 64, "test_read_empty_file" ) {}
void runTest() { suite_ReadTestSuite.test_read_empty_file(); }
} testDescription_suite_ReadTestSuite_test_read_empty_file;
@ -1261,143 +1255,131 @@ public:
static WorksheetTestSuite suite_WorksheetTestSuite;
static CxxTest::List Tests_WorksheetTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_WorksheetTestSuite( "../../source/tests/WorksheetTestSuite.h", 8, "WorksheetTestSuite", suite_WorksheetTestSuite, Tests_WorksheetTestSuite );
CxxTest::StaticSuiteDescription suiteDescription_WorksheetTestSuite( "../../source/tests/WorksheetTestSuite.h", 9, "WorksheetTestSuite", suite_WorksheetTestSuite, Tests_WorksheetTestSuite );
static class TestDescription_suite_WorksheetTestSuite_test_new_worksheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_new_worksheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 15, "test_new_worksheet" ) {}
TestDescription_suite_WorksheetTestSuite_test_new_worksheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 16, "test_new_worksheet" ) {}
void runTest() { suite_WorksheetTestSuite.test_new_worksheet(); }
} testDescription_suite_WorksheetTestSuite_test_new_worksheet;
static class TestDescription_suite_WorksheetTestSuite_test_new_sheet_name : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_new_sheet_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 21, "test_new_sheet_name" ) {}
TestDescription_suite_WorksheetTestSuite_test_new_sheet_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 22, "test_new_sheet_name" ) {}
void runTest() { suite_WorksheetTestSuite.test_new_sheet_name(); }
} testDescription_suite_WorksheetTestSuite_test_new_sheet_name;
static class TestDescription_suite_WorksheetTestSuite_test_get_cell : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_get_cell() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 28, "test_get_cell" ) {}
TestDescription_suite_WorksheetTestSuite_test_get_cell() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 30, "test_get_cell" ) {}
void runTest() { suite_WorksheetTestSuite.test_get_cell(); }
} testDescription_suite_WorksheetTestSuite_test_get_cell;
static class TestDescription_suite_WorksheetTestSuite_test_set_bad_title : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_set_bad_title() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 35, "test_set_bad_title" ) {}
TestDescription_suite_WorksheetTestSuite_test_set_bad_title() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 37, "test_set_bad_title" ) {}
void runTest() { suite_WorksheetTestSuite.test_set_bad_title(); }
} testDescription_suite_WorksheetTestSuite_test_set_bad_title;
static class TestDescription_suite_WorksheetTestSuite_test_set_bad_title_character : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_set_bad_title_character() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 40, "test_set_bad_title_character" ) {}
TestDescription_suite_WorksheetTestSuite_test_set_bad_title_character() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 43, "test_set_bad_title_character" ) {}
void runTest() { suite_WorksheetTestSuite.test_set_bad_title_character(); }
} testDescription_suite_WorksheetTestSuite_test_set_bad_title_character;
static class TestDescription_suite_WorksheetTestSuite_test_worksheet_dimension : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 51, "test_worksheet_dimension" ) {}
TestDescription_suite_WorksheetTestSuite_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 54, "test_worksheet_dimension" ) {}
void runTest() { suite_WorksheetTestSuite.test_worksheet_dimension(); }
} testDescription_suite_WorksheetTestSuite_test_worksheet_dimension;
static class TestDescription_suite_WorksheetTestSuite_test_worksheet_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_worksheet_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 59, "test_worksheet_range" ) {}
TestDescription_suite_WorksheetTestSuite_test_worksheet_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 62, "test_worksheet_range" ) {}
void runTest() { suite_WorksheetTestSuite.test_worksheet_range(); }
} testDescription_suite_WorksheetTestSuite_test_worksheet_range;
static class TestDescription_suite_WorksheetTestSuite_test_worksheet_named_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 68, "test_worksheet_named_range" ) {}
TestDescription_suite_WorksheetTestSuite_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 70, "test_worksheet_named_range" ) {}
void runTest() { suite_WorksheetTestSuite.test_worksheet_named_range(); }
} testDescription_suite_WorksheetTestSuite_test_worksheet_named_range;
static class TestDescription_suite_WorksheetTestSuite_test_bad_named_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_bad_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 77, "test_bad_named_range" ) {}
TestDescription_suite_WorksheetTestSuite_test_bad_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 80, "test_bad_named_range" ) {}
void runTest() { suite_WorksheetTestSuite.test_bad_named_range(); }
} testDescription_suite_WorksheetTestSuite_test_bad_named_range;
static class TestDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 83, "test_named_range_wrong_sheet" ) {}
TestDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 86, "test_named_range_wrong_sheet" ) {}
void runTest() { suite_WorksheetTestSuite.test_named_range_wrong_sheet(); }
} testDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet;
static class TestDescription_suite_WorksheetTestSuite_test_cell_offset : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_cell_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 91, "test_cell_offset" ) {}
TestDescription_suite_WorksheetTestSuite_test_cell_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 94, "test_cell_offset" ) {}
void runTest() { suite_WorksheetTestSuite.test_cell_offset(); }
} testDescription_suite_WorksheetTestSuite_test_cell_offset;
static class TestDescription_suite_WorksheetTestSuite_test_range_offset : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_range_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 97, "test_range_offset" ) {}
TestDescription_suite_WorksheetTestSuite_test_range_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 100, "test_range_offset" ) {}
void runTest() { suite_WorksheetTestSuite.test_range_offset(); }
} testDescription_suite_WorksheetTestSuite_test_range_offset;
static class TestDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 107, "test_cell_alternate_coordinates" ) {}
TestDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 109, "test_cell_alternate_coordinates" ) {}
void runTest() { suite_WorksheetTestSuite.test_cell_alternate_coordinates(); }
} testDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates;
static class TestDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 114, "test_cell_insufficient_coordinates" ) {}
void runTest() { suite_WorksheetTestSuite.test_cell_insufficient_coordinates(); }
} testDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates;
static class TestDescription_suite_WorksheetTestSuite_test_cell_range_name : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_cell_range_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 120, "test_cell_range_name" ) {}
TestDescription_suite_WorksheetTestSuite_test_cell_range_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 116, "test_cell_range_name" ) {}
void runTest() { suite_WorksheetTestSuite.test_cell_range_name(); }
} testDescription_suite_WorksheetTestSuite_test_cell_range_name;
static class TestDescription_suite_WorksheetTestSuite_test_garbage_collect : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_garbage_collect() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 132, "test_garbage_collect" ) {}
TestDescription_suite_WorksheetTestSuite_test_garbage_collect() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 128, "test_garbage_collect" ) {}
void runTest() { suite_WorksheetTestSuite.test_garbage_collect(); }
} testDescription_suite_WorksheetTestSuite_test_garbage_collect;
static class TestDescription_suite_WorksheetTestSuite_test_hyperlink_relationships : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 145, "test_hyperlink_relationships" ) {}
TestDescription_suite_WorksheetTestSuite_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 148, "test_hyperlink_relationships" ) {}
void runTest() { suite_WorksheetTestSuite.test_hyperlink_relationships(); }
} testDescription_suite_WorksheetTestSuite_test_hyperlink_relationships;
static class TestDescription_suite_WorksheetTestSuite_test_bad_relationship_type : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 165, "test_bad_relationship_type" ) {}
TestDescription_suite_WorksheetTestSuite_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 169, "test_bad_relationship_type" ) {}
void runTest() { suite_WorksheetTestSuite.test_bad_relationship_type(); }
} testDescription_suite_WorksheetTestSuite_test_bad_relationship_type;
static class TestDescription_suite_WorksheetTestSuite_test_append_list : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_append_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 170, "test_append_list" ) {}
TestDescription_suite_WorksheetTestSuite_test_append_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 174, "test_append_list" ) {}
void runTest() { suite_WorksheetTestSuite.test_append_list(); }
} testDescription_suite_WorksheetTestSuite_test_append_list;
static class TestDescription_suite_WorksheetTestSuite_test_append_dict_letter : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 180, "test_append_dict_letter" ) {}
TestDescription_suite_WorksheetTestSuite_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 184, "test_append_dict_letter" ) {}
void runTest() { suite_WorksheetTestSuite.test_append_dict_letter(); }
} testDescription_suite_WorksheetTestSuite_test_append_dict_letter;
static class TestDescription_suite_WorksheetTestSuite_test_append_dict_index : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_append_dict_index() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 190, "test_append_dict_index" ) {}
TestDescription_suite_WorksheetTestSuite_test_append_dict_index() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 194, "test_append_dict_index" ) {}
void runTest() { suite_WorksheetTestSuite.test_append_dict_index(); }
} testDescription_suite_WorksheetTestSuite_test_append_dict_index;
static class TestDescription_suite_WorksheetTestSuite_test_bad_append : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_bad_append() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 200, "test_bad_append" ) {}
void runTest() { suite_WorksheetTestSuite.test_bad_append(); }
} testDescription_suite_WorksheetTestSuite_test_bad_append;
static class TestDescription_suite_WorksheetTestSuite_test_append_2d_list : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_append_2d_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 206, "test_append_2d_list" ) {}
TestDescription_suite_WorksheetTestSuite_test_append_2d_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 204, "test_append_2d_list" ) {}
void runTest() { suite_WorksheetTestSuite.test_append_2d_list(); }
} testDescription_suite_WorksheetTestSuite_test_append_2d_list;
@ -1421,25 +1403,25 @@ public:
static class TestDescription_suite_WorksheetTestSuite_test_page_margins : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_page_margins() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 262, "test_page_margins" ) {}
TestDescription_suite_WorksheetTestSuite_test_page_margins() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 263, "test_page_margins" ) {}
void runTest() { suite_WorksheetTestSuite.test_page_margins(); }
} testDescription_suite_WorksheetTestSuite_test_page_margins;
static class TestDescription_suite_WorksheetTestSuite_test_merge : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_merge() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 279, "test_merge" ) {}
TestDescription_suite_WorksheetTestSuite_test_merge() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 283, "test_merge" ) {}
void runTest() { suite_WorksheetTestSuite.test_merge(); }
} testDescription_suite_WorksheetTestSuite_test_merge;
static class TestDescription_suite_WorksheetTestSuite_test_freeze : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_freeze() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 299, "test_freeze" ) {}
TestDescription_suite_WorksheetTestSuite_test_freeze() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 304, "test_freeze" ) {}
void runTest() { suite_WorksheetTestSuite.test_freeze(); }
} testDescription_suite_WorksheetTestSuite_test_freeze;
static class TestDescription_suite_WorksheetTestSuite_test_printer_settings : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorksheetTestSuite_test_printer_settings() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 315, "test_printer_settings" ) {}
TestDescription_suite_WorksheetTestSuite_test_printer_settings() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 321, "test_printer_settings" ) {}
void runTest() { suite_WorksheetTestSuite.test_printer_settings(); }
} testDescription_suite_WorksheetTestSuite_test_printer_settings;
@ -1448,11 +1430,11 @@ public:
static WriteTestSuite suite_WriteTestSuite;
static CxxTest::List Tests_WriteTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_WriteTestSuite( "../../source/tests/WriteTestSuite.h", 8, "WriteTestSuite", suite_WriteTestSuite, Tests_WriteTestSuite );
CxxTest::StaticSuiteDescription suiteDescription_WriteTestSuite( "../../source/tests/WriteTestSuite.h", 9, "WriteTestSuite", suite_WriteTestSuite, Tests_WriteTestSuite );
static class TestDescription_suite_WriteTestSuite_test_write_empty_workbook : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WriteTestSuite_test_write_empty_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 16, "test_write_empty_workbook" ) {}
TestDescription_suite_WriteTestSuite_test_write_empty_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 17, "test_write_empty_workbook" ) {}
void runTest() { suite_WriteTestSuite.test_write_empty_workbook(); }
} testDescription_suite_WriteTestSuite_test_write_empty_workbook;

View File

@ -12,15 +12,6 @@ namespace xlnt {
namespace {
class not_implemented : public std::runtime_error
{
public:
not_implemented() : std::runtime_error("error: not implemented")
{
}
};
const std::array<unsigned char, 3086> existing_xlsx = {
0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x21, 0x00, 0xf8, 0x17, 0x86, 0x86, 0x7a, 0x01, 0x00, 0x00, 0x10, 0x03,
@ -1370,17 +1361,28 @@ struct worksheet_struct
void garbage_collect()
{
throw not_implemented();
for(auto map_iter = cell_map_.begin(); map_iter != cell_map_.end(); map_iter++)
{
if(map_iter->second.get_data_type() == cell::type::null)
{
map_iter = cell_map_.erase(map_iter);
}
}
}
std::set<cell> get_cell_collection()
std::list<cell> get_cell_collection()
{
throw not_implemented();
std::list<xlnt::cell> cells;
for(auto cell : cell_map_)
{
cells.push_front(xlnt::cell(cell.second));
}
return cells;
}
std::string get_title() const
{
throw not_implemented();
return title_;
}
void set_title(const std::string &title)
@ -1427,33 +1429,76 @@ struct worksheet_struct
int get_highest_row() const
{
throw not_implemented();
int highest = 0;
for(auto cell : cell_map_)
{
highest = (std::max)(highest, cell.second.get_row());
}
return highest;
}
int get_highest_column() const
{
throw not_implemented();
int highest = 0;
for(auto cell : cell_map_)
{
highest = (std::max)(highest, xlnt::cell::column_index_from_string(cell.second.get_column()));
}
return highest;
}
std::string calculate_dimension() const
{
throw not_implemented();
int width = get_highest_column();
std::string width_letter = xlnt::cell::get_column_letter(width);
int height = get_highest_row();
return "A1:" + width_letter + std::to_string(height);
}
range range(const std::string &range_string, int /*row_offset*/, int /*column_offset*/)
xlnt::range range(const std::string &range_string, int row_offset, int column_offset)
{
xlnt::range r;
auto colon_index = range_string.find(':');
if(colon_index != std::string::npos)
{
auto min_range = range_string.substr(0, colon_index);
auto max_range = range_string.substr(colon_index + 1);
xlnt::range r;
r.push_back(std::vector<xlnt::cell>());
r[0].push_back(cell(min_range));
r[0].push_back(cell(max_range));
return r;
auto min_coord = xlnt::cell::coordinate_from_string(min_range);
auto max_coord = xlnt::cell::coordinate_from_string(max_range);
if(column_offset != 0)
{
min_coord.column = xlnt::cell::get_column_letter(xlnt::cell::column_index_from_string(min_coord.column) + column_offset);
max_coord.column = xlnt::cell::get_column_letter(xlnt::cell::column_index_from_string(max_coord.column) + column_offset);
}
std::unordered_map<int, std::string> column_cache;
for(int i = xlnt::cell::column_index_from_string(min_coord.column);
i <= xlnt::cell::column_index_from_string(max_coord.column); i++)
{
column_cache[i] = xlnt::cell::get_column_letter(i);
}
for(int row = min_coord.row + row_offset; row <= max_coord.row + row_offset; row++)
{
r.push_back(std::vector<xlnt::cell>());
for(int column = xlnt::cell::column_index_from_string(min_coord.column) + column_offset;
column <= xlnt::cell::column_index_from_string(max_coord.column) + column_offset; column++)
{
std::string coordinate = column_cache[column] + std::to_string(row);
r.back().push_back(cell(coordinate));
}
}
}
throw not_implemented();
else
{
r.push_back(std::vector<xlnt::cell>());
r.back().push_back(cell(range_string));
}
return r;
}
relationship create_relationship(const std::string &relationship_type)
@ -1464,27 +1509,55 @@ struct worksheet_struct
//void add_chart(chart chart);
void merge_cells(const std::string &/*range_string*/)
void merge_cells(const std::string &range_string)
{
throw not_implemented();
bool first = true;
for(auto row : range(range_string, 0, 0))
{
for(auto cell : row)
{
cell.set_merged(true);
if(!first)
{
cell.bind_value();
}
first = false;
}
}
}
void merge_cells(int /*start_row*/, int /*start_column*/, int /*end_row*/, int /*end_column*/)
void merge_cells(int start_row, int start_column, int end_row, int end_column)
{
throw not_implemented();
auto range_string = xlnt::cell::get_column_letter(start_column + 1) + std::to_string(start_row + 1) + ":"
+ xlnt::cell::get_column_letter(end_column + 1) + std::to_string(end_row + 1);
merge_cells(range_string);
}
void unmerge_cells(const std::string &/*range_string*/)
void unmerge_cells(const std::string &range_string)
{
throw not_implemented();
bool first = true;
for(auto row : range(range_string, 0, 0))
{
for(auto cell : row)
{
cell.set_merged(false);
if(!first)
{
cell.bind_value();
}
first = false;
}
}
}
void unmerge_cells(int /*start_row*/, int /*start_column*/, int /*end_row*/, int /*end_column*/)
void unmerge_cells(int start_row, int start_column, int end_row, int end_column)
{
throw not_implemented();
auto range_string = xlnt::cell::get_column_letter(start_column + 1) + std::to_string(start_row + 1) + ":"
+ xlnt::cell::get_column_letter(end_column + 1) + std::to_string(end_row + 1);
merge_cells(range_string);
}
void append(const std::vector<xlnt::cell> &cells)
void append(const std::vector<std::string> &cells)
{
for(auto cell : cells)
{
@ -1492,7 +1565,7 @@ struct worksheet_struct
}
}
void append(const std::unordered_map<std::string, xlnt::cell> &cells)
void append(const std::unordered_map<std::string, std::string> &cells)
{
for(auto cell : cells)
{
@ -1500,7 +1573,7 @@ struct worksheet_struct
}
}
void append(const std::unordered_map<int, xlnt::cell> &cells)
void append(const std::unordered_map<int, std::string> &cells)
{
for(auto cell : cells)
{
@ -1508,14 +1581,14 @@ struct worksheet_struct
}
}
xlnt::range rows() const
xlnt::range rows()
{
throw not_implemented();
return range(calculate_dimension(), 0, 0);
}
xlnt::range columns() const
xlnt::range columns()
{
throw not_implemented();
throw std::runtime_error("not implemented");
}
void operator=(const worksheet_struct &other) = delete;
@ -1546,7 +1619,7 @@ void worksheet::garbage_collect()
root_->garbage_collect();
}
std::set<cell> worksheet::get_cell_collection()
std::list<cell> worksheet::get_cell_collection()
{
return root_->get_cell_collection();
}
@ -1694,9 +1767,9 @@ cell worksheet::operator[](const std::string &address)
return cell(address);
}
std::string workbook::write_content_types(workbook &wb)
std::string writer::write_content_types(workbook &wb)
{
std::set<std::string> seen;
/*std::set<std::string> seen;
pugi::xml_node root;
@ -1793,12 +1866,13 @@ std::string workbook::write_content_types(workbook &wb)
}
}
return get_document_content(root);
return get_document_content(root);*/
return "";
}
std::string workbook::write_root_rels(workbook wb)
std::string writer::write_root_rels(workbook &wb)
{
root = Element("{%s}Relationships" % PKG_REL_NS);
/*root = Element("{%s}Relationships" % PKG_REL_NS);
relation_tag = "{%s}Relationship" % PKG_REL_NS;
SubElement(root, relation_tag, {"Id": "rId1", "Target" : ARC_WORKBOOK,
"Type" : "%s/officeDocument" % REL_NS});
@ -1827,7 +1901,8 @@ std::string workbook::write_root_rels(workbook wb)
}
}
return get_document_content(root);
return get_document_content(root);*/
return "";
}
workbook::workbook() : active_sheet_index_(0)
@ -1910,4 +1985,72 @@ std::string cell_struct::to_string() const
return "<Cell " + parent_worksheet->title_ + "." + xlnt::cell::get_column_letter(column + 1) + std::to_string(row) + ">";
}
bool workbook::operator==(const workbook &rhs) const
{
if(optimized_write_ == rhs.optimized_write_
&& optimized_read_ == rhs.optimized_read_
&& guess_types_ == rhs.guess_types_
&& data_only_ == rhs.data_only_
&& active_sheet_index_ == rhs.active_sheet_index_
&& encoding_ == rhs.encoding_)
{
if(worksheets_.size() != rhs.worksheets_.size())
{
return false;
}
for(int i = 0; i < worksheets_.size(); i++)
{
if(worksheets_[i] != rhs.worksheets_[i])
{
return false;
}
}
/*
if(named_ranges_.size() != rhs.named_ranges_.size())
{
return false;
}
for(int i = 0; i < named_ranges_.size(); i++)
{
if(named_ranges_[i] != rhs.named_ranges_[i])
{
return false;
}
}
if(relationships_.size() != rhs.relationships_.size())
{
return false;
}
for(int i = 0; i < relationships_.size(); i++)
{
if(relationships_[i] != rhs.relationships_[i])
{
return false;
}
}
if(drawings_.size() != rhs.drawings_.size())
{
return false;
}
for(int i = 0; i < drawings_.size(); i++)
{
if(drawings_[i] != rhs.drawings_[i])
{
return false;
}
}
*/
return true;
}
return false;
}
}

View File

@ -202,6 +202,26 @@ enum class encoding_type
latin1
};
class bad_sheet_title : public std::runtime_error
{
public:
bad_sheet_title(const std::string &title)
: std::runtime_error(std::string("bad worksheet title: ") + title)
{
}
};
class bad_cell_coordinates : public std::runtime_error
{
public:
bad_cell_coordinates(int row, int column)
: std::runtime_error(std::string("bad cell coordinates: (") + std::to_string(row) + "," + std::to_string(column) + ")")
{
}
};
/// <summary>
/// Represents a value type that may or may not have an assigned value.
/// </summary>
@ -1133,6 +1153,9 @@ public:
cell(worksheet &ws, const std::string &column, int row);
cell(worksheet &ws, const std::string &column, int row, const std::string &initial_value);
int get_row() const;
std::string get_column() const;
encoding_type get_encoding() const;
std::string to_string() const;
@ -1147,6 +1170,9 @@ public:
bool bind_value(bool value);
bool bind_value(const tm &value);
bool get_merged() const;
void set_merged(bool);
std::string get_hyperlink() const;
void set_hyperlink(const std::string &value);
@ -1210,9 +1236,8 @@ inline std::ostream &operator<<(std::ostream &stream, const cell &cell)
typedef std::vector<std::vector<cell>> range;
class worksheet
struct page_setup
{
public:
enum class Break
{
None = 0,
@ -1248,15 +1273,29 @@ public:
Landscape
};
Break break_;
SheetState sheet_state;
PaperSize paper_size;
Orientation orientation;
bool fit_to_page;
bool fit_to_height;
bool fit_to_width;
};
class worksheet
{
public:
worksheet(workbook &parent);
void operator=(const worksheet &other);
cell operator[](const std::string &address);
xlnt::cell operator[](const std::string &address);
std::string to_string() const;
workbook &get_parent() const;
void garbage_collect();
std::set<cell> get_cell_collection();
std::list<cell> get_cell_collection();
std::string get_title() const;
void set_title(const std::string &title);
cell get_freeze_panes() const;
xlnt::cell get_freeze_panes() const;
void set_freeze_panes(cell top_left_cell);
void set_freeze_panes(const std::string &top_left_coordinate);
void unfreeze_panes();
@ -1265,7 +1304,8 @@ public:
int get_highest_row() const;
int get_highest_column() const;
std::string calculate_dimension() const;
range range(const std::string &range_string, int row_offset, int column_offset);
xlnt::range range(const std::string &range_string);
xlnt::range range(const std::string &range_string, int row_offset, int column_offset);
relationship create_relationship(const std::string &relationship_type);
//void add_chart(chart chart);
void merge_cells(const std::string &range_string);
@ -1281,6 +1321,8 @@ public:
bool operator!=(const worksheet &other) const;
bool operator==(std::nullptr_t) const;
bool operator!=(std::nullptr_t) const;
std::vector<relationship> get_relationships();
page_setup &get_page_setup();
private:
friend class workbook;
@ -1310,12 +1352,18 @@ private:
drawing_struct *root_;
};
class workbook
class writer
{
public:
static std::string write_content_types(workbook &wb);
static std::string write_root_rels(workbook &wb);
static std::string write_worksheet(worksheet &ws);
static std::string get_document_content(const std::string &filename);
};
class workbook
{
public:
//constructors
workbook();
@ -1382,6 +1430,8 @@ public:
void save(const std::string &filename);
void load(const std::string &filename);
bool operator==(const workbook &rhs) const;
private:
bool optimized_write_;
bool optimized_read_;