fix some more things

This commit is contained in:
Thomas Fussell 2014-05-18 21:29:19 -04:00
parent 841a455497
commit dc1a80ebae
12 changed files with 755 additions and 748 deletions

View File

@ -283,7 +283,7 @@ public:
void test_repr() void test_repr()
{ {
xlnt::workbook wb; xlnt::workbook wb;
xlnt::worksheet ws = wb.get_active_sheet(); xlnt::worksheet ws = wb.get_active_sheet();
xlnt::cell cell(ws, "A", 1); xlnt::cell cell(ws, "A", 1);
TS_ASSERT_EQUALS(cell.to_string(), "<Cell Sheet1.A1>"); TS_ASSERT_EQUALS(cell.to_string(), "<Cell Sheet1.A1>");

View File

@ -1,98 +0,0 @@
#pragma once
#include <iostream>
#include <cxxtest/TestSuite.h>
#include "../xlnt.h"
class IterTestSuite : public CxxTest::TestSuite
{
public:
IterTestSuite()
{
}
void test_get_dimensions()
{
/*
auto expected = {"A1:G5", "D1:K30", "D2:D2", "A1:C1"};
std::string workbook_name = DATADIR + "/genuine/empty.xlsx";
xlnt::workbook wb;
wb.load(workbook_name);
for(i, sheetn : enumerate(wb.get_sheet_names()))
{
ws = wb.get_sheet_by_name(name = sheetn);
TS_ASSERT_EQUALS(ws._dimensions, expected[i]);
}*/
}
void test_read_fast_integrated()
{
/*std::string sheet_name = "Sheet1 - Text";
std::vector<std::vector<char *>> expected = {{"This is cell A1 in Sheet 1", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, "This is cell G5"}};
wb = load_workbook(filename = workbook_name, use_iterators = True);
ws = wb.get_sheet_by_name(name = sheet_name);
for(row, expected_row : zip(ws.iter_rows(), expected)
{
row_values = [x.internal_value for x in row];
TS_ASSERT_EQUALS(row_values, expected_row);
}*/
}
void test_get_boundaries_range()
{
//TS_ASSERT_EQUALS(get_range_boundaries("C1:C4"), (3, 1, 3, 4));
}
void test_get_boundaries_one()
{
//TS_ASSERT_EQUALS(get_range_boundaries("C1"), (3, 1, 4, 1));
}
void test_read_single_cell_range()
{
/*wb = load_workbook(filename = workbook_name, use_iterators = True);
ws = wb.get_sheet_by_name(name = sheet_name);
TS_ASSERT_EQUALS("This is cell A1 in Sheet 1", list(ws.iter_rows("A1"))[0][0].internal_value);*/
}
void test_read_fast_integrated2()
{
/*sheet_name = "Sheet2 - Numbers";
expected = [[x + 1] for x in range(30)];
query_range = "D1:E30";
wb = load_workbook(filename = workbook_name, use_iterators = True);
ws = wb.get_sheet_by_name(name = sheet_name);
for(row, expected_row : zip(ws.iter_rows(query_range), expected))
{
row_values = [x.internal_value for x in row];
TS_ASSERT_EQUALS(row_values, expected_row);
}*/
}
void test_read_single_cell_date()
{
//sheet_name = "Sheet4 - Dates";
//wb = load_workbook(filename = workbook_name, use_iterators = True);
//ws = wb.get_sheet_by_name(name = sheet_name);
//TS_ASSERT_EQUALS(datetime.datetime(1973, 5, 20), list(ws.iter_rows("A1"))[0][0].internal_value);
//TS_ASSERT_EQUALS(datetime.datetime(1973, 5, 20, 9, 15, 2), list(ws.iter_rows("C1"))[0][0].internal_value);
}
};

44
source/tests/PathHelper.h Normal file
View File

@ -0,0 +1,44 @@
#pragma once
#ifdef __APPLE__
#include <mach-o/dyld.h>
#elif defined(_WIN32)
#include <Windows.h>
#endif
class PathHelper
{
public:
static std::string GetExecutableDirectory()
{
#ifdef __APPLE__
std::array<char, 1024> path;
uint32_t size = static_cast<uint32_t>(path.size());
if (_NSGetExecutablePath(path.data(), &size) == 0)
{
return std::string(path.begin(), std::find(path.begin(), path.end(), '\0') - 9);
}
throw std::runtime_error("buffer too small, " + std::to_string(path.size()) + ", should be: " + std::to_string(size));
#elif defined(_WIN32)
std::array<TCHAR, MAX_PATH> path;
DWORD result = GetModuleFileName(nullptr, buffer.data(), buffer.size());
if(result == 0 || result == path.size())
{
throw std::runtime_error("GetModuleFileName failed or buffer was too small");
}
return std::string(path.begin(), path.begin() + result);
#else
throw std::runtime_error("not implmented");
#endif
}
static std::string GetDataDirectory()
{
return GetExecutableDirectory() + "../source/tests/test_data";
}
static std::string GetTempDirectory()
{
return "/tmp/xlsx";
}
};

View File

@ -13,11 +13,6 @@ public:
} }
void test_1()
{
}
class TestReaderProps class TestReaderProps
{ {
void setup_class(int cls) void setup_class(int cls)

View File

@ -1,196 +1,196 @@
#pragma once #pragma once
#include <fstream>
#include <iostream> #include <iostream>
#include <cxxtest/TestSuite.h> #include <cxxtest/TestSuite.h>
#include "../xlnt.h" #include "../xlnt.h"
#include "PathHelper.h"
class ReadTestSuite : public CxxTest::TestSuite class ReadTestSuite : public CxxTest::TestSuite
{ {
public: public:
ReadTestSuite() ReadTestSuite()
{ {
xlnt::workbook wb_with_styles;
auto path = PathHelper::GetDataDirectory() + "/genuine/empty-with-styles.xlsx";
wb_with_styles.load(path);
worksheet_with_styles = wb_with_styles.get_sheet_by_name("Sheet1");
auto mac_wb_path = PathHelper::GetDataDirectory() + "/reader/date_1904.xlsx";
mac_wb.load(mac_wb_path);
mac_ws = mac_wb.get_sheet_by_name("Sheet1");
auto win_wb_path = PathHelper::GetDataDirectory() + "/reader/date_1900.xlsx";
win_wb.load(win_wb_path);
win_ws = win_wb.get_sheet_by_name("Sheet1");
} }
void test_read_standalone_worksheet() void test_read_standalone_worksheet()
{ {
/* path = os.path.join(DATADIR, "reader", "sheet2.xml") auto path = PathHelper::GetDataDirectory() + "/reader/sheet2.xml";
ws = None xlnt::workbook wb;
handle = open(path) xlnt::worksheet ws(wb);
try : {
ws = read_worksheet(handle.read(), DummyWb(), std::ifstream handle(path);
"Sheet 2", {1: "hello"}, {1: Style()}) ws = xlnt::reader::read_worksheet(handle, wb, "Sheet 2", {{1, "hello"}});
finally : }
handle.close() TS_ASSERT_DIFFERS(ws, nullptr);
assert isinstance(ws, Worksheet) if(!(ws == nullptr))
TS_ASSERT_EQUALS(ws.cell("G5").value, "hello") {
TS_ASSERT_EQUALS(ws.cell("D30").value, 30) TS_ASSERT_EQUALS(ws.cell("G5"), "hello");
TS_ASSERT_EQUALS(ws.cell("K9").value, 0.09)*/ TS_ASSERT_EQUALS(ws.cell("D30"), 30);
TS_ASSERT_EQUALS(ws.cell("K9"), 0.09);
}
} }
void test_read_standard_workbook() void test_read_standard_workbook()
{ {
/*path = os.path.join(DATADIR, "genuine", "empty.xlsx") auto path = PathHelper::GetDataDirectory() + "/genuine/empty.xlsx";
wb = load_workbook(path) xlnt::workbook wb;
assert isinstance(wb, Workbook)*/ wb.load(path);
} }
void test_read_standard_workbook_from_fileobj() void test_read_standard_workbook_from_fileobj()
{ {
/*path = os.path.join(DATADIR, "genuine", "empty.xlsx") /*
fo = open(path, mode = "rb") auto path = PathHelper::GetDataDirectory() + "/genuine/empty.xlsx";
wb = load_workbook(fo) std::ifstream fo(path);
assert isinstance(wb, Workbook)*/ xlnt::workbook wb;
wb.load(fo);
*/
} }
void test_read_worksheet() void test_read_worksheet()
{ {
/*path = os.path.join(DATADIR, "genuine", "empty.xlsx") auto path = PathHelper::GetDataDirectory() + "/genuine/empty.xlsx";
wb = load_workbook(path) xlnt::workbook wb;
sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers") wb.load(path);
assert isinstance(sheet2, Worksheet) auto sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers");
TS_ASSERT_EQUALS("This is cell G5", sheet2.cell("G5").value) TS_ASSERT_DIFFERS(sheet2, nullptr);
TS_ASSERT_EQUALS(18, sheet2.cell("D18").value)*/ TS_ASSERT_EQUALS("This is cell G5", sheet2.cell("G5"));
TS_ASSERT_EQUALS(18, sheet2.cell("D18"));
} }
void test_read_nostring_workbook() void test_read_nostring_workbook()
{ {
/*genuine_wb = os.path.join(DATADIR, "genuine", "empty-no-string.xlsx") auto genuine_wb = PathHelper::GetDataDirectory() + "/genuine/empty-no-string.xlsx";
wb = load_workbook(genuine_wb) xlnt::workbook wb;
assert isinstance(wb, Workbook)*/ wb.load(genuine_wb);
} }
void test_read_empty_file() void test_read_empty_file()
{ {
/*std::string null_file = os.path.join(DATADIR, "reader", "null_file.xlsx"); auto null_file = PathHelper::GetDataDirectory() + "/reader/null_file.xlsx";
xlnt::workbook wb; xlnt::workbook wb;
TS_ASSERT_THROWS(InvalidFile, wb.load(null_file));*/ TS_ASSERT_THROWS_ANYTHING(wb.load(null_file));
} }
//@raises(InvalidFileException) //@raises(InvalidFileException)
void test_read_empty_archive() void test_read_empty_archive()
{ {
//null_file = os.path.join(DATADIR, "reader", "null_archive.xlsx") auto null_file = PathHelper::GetDataDirectory() + "/reader/null_archive.xlsx";
// wb = load_workbook(null_file) xlnt::workbook wb;
TS_ASSERT_THROWS_ANYTHING(wb.load(null_file));
} }
void test_read_dimension() void test_read_dimension()
{ {
//path = os.path.join(DATADIR, "reader", "sheet2.xml") /*
auto path = PathHelper::GetDataDirectory() + "/reader/sheet2.xml";
// dimension = None std::ifstream handle(path);
// handle = open(path) auto dimension = xlnt::reader::read_dimension(handle);
// try : TS_ASSERT_EQUALS({{"D", 1}, {"K", 30}}, dimension);
// dimension = read_dimension(xml_source = handle.read()) */
// finally :
// handle.close()
// TS_ASSERT_EQUALS(("D", 1, "K", 30), dimension)
} }
void test_calculate_dimension_iter() void test_calculate_dimension_iter()
{ {
//path = os.path.join(DATADIR, "genuine", "empty.xlsx") auto path = PathHelper::GetDataDirectory() + "/genuine/empty.xlsx";
// wb = load_workbook(filename = path, use_iterators = True) xlnt::workbook wb;
// sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers") wb.load(path);
// dimensions = sheet2.calculate_dimension() auto sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers");
// TS_ASSERT_EQUALS("%s%s:%s%s" % ("D", 1, "K", 30), dimensions) auto dimensions = sheet2.calculate_dimension();
TS_ASSERT_EQUALS("D1:K30", dimensions);
} }
void test_get_highest_row_iter() void test_get_highest_row_iter()
{ {
//path = os.path.join(DATADIR, "genuine", "empty.xlsx") auto path = PathHelper::GetDataDirectory() + "/genuine/empty.xlsx";
// wb = load_workbook(filename = path, use_iterators = True) xlnt::workbook wb;
// sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers") wb.load(path);
// max_row = sheet2.get_highest_row() auto sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers");
// TS_ASSERT_EQUALS(30, max_row) auto max_row = sheet2.get_highest_row();
TS_ASSERT_EQUALS(30, max_row);
} }
void test_read_workbook_with_no_properties() void test_read_workbook_with_no_properties()
{ {
//genuine_wb = os.path.join(DATADIR, "genuine", \ auto genuine_wb = PathHelper::GetDataDirectory() + "/genuine/empty_with_no_properties.xlsx";
// "empty_with_no_properties.xlsx") xlnt::workbook wb;
// wb = load_workbook(filename = genuine_wb) wb.load(genuine_wb);
}
void setup_class_with_styles(int cls)
{
//cls.genuine_wb = os.path.join(DATADIR, "genuine", \
// "empty-with-styles.xlsx")
// wb = load_workbook(cls.genuine_wb)
// cls.ws = wb.get_sheet_by_name("Sheet1")
} }
void test_read_general_style() void test_read_general_style()
{ {
//TS_ASSERT_EQUALS(ws.cell("A1").style.number_format.format_code, TS_ASSERT_EQUALS(worksheet_with_styles.cell("A1").get_style().get_number_format().get_format_code(), xlnt::number_format::format::general);
// NumberFormat.FORMAT_GENERAL)
} }
void test_read_date_style() void test_read_date_style()
{ {
//TS_ASSERT_EQUALS(ws.cell("A2").style.number_format.format_code, TS_ASSERT_EQUALS(worksheet_with_styles.cell("A2").get_style().get_number_format().get_format_code(), xlnt::number_format::format::date_xlsx14);
// NumberFormat.FORMAT_DATE_XLSX14)
} }
void test_read_number_style() void test_read_number_style()
{ {
//TS_ASSERT_EQUALS(ws.cell("A3").style.number_format.format_code, TS_ASSERT_EQUALS(worksheet_with_styles.cell("A3").get_style().get_number_format().get_format_code(), xlnt::number_format::format::number00);
// NumberFormat.FORMAT_NUMBER_00)
} }
void test_read_time_style() void test_read_time_style()
{ {
//TS_ASSERT_EQUALS(ws.cell("A4").style.number_format.format_code, TS_ASSERT_EQUALS(worksheet_with_styles.cell("A4").get_style().get_number_format().get_format_code(), xlnt::number_format::format::date_time3);
// NumberFormat.FORMAT_DATE_TIME3)
} }
void test_read_percentage_style() void test_read_percentage_style()
{ {
//TS_ASSERT_EQUALS(ws.cell("A5").style.number_format.format_code, TS_ASSERT_EQUALS(worksheet_with_styles.cell("A5").get_style().get_number_format().get_format_code(), xlnt::number_format::format::percentage00)
// NumberFormat.FORMAT_PERCENTAGE_00)
}
void setup_class_base_date_format(/*cls*/)
{
//mac_wb_path = os.path.join(DATADIR, "reader", "date_1904.xlsx")
// cls.mac_wb = load_workbook(mac_wb_path)
// cls.mac_ws = cls.mac_wb.get_sheet_by_name("Sheet1")
// win_wb_path = os.path.join(DATADIR, "reader", "date_1900.xlsx")
// cls.win_wb = load_workbook(win_wb_path)
// cls.win_ws = cls.win_wb.get_sheet_by_name("Sheet1")
} }
void test_read_win_base_date() void test_read_win_base_date()
{ {
//TS_ASSERT_EQUALS(win_wb.properties.excel_base_date, CALENDAR_WINDOWS_1900) //TS_ASSERT_EQUALS(win_wb.get_properties().get_excel_base_date(), CALENDAR_WINDOWS_1900);
} }
void test_read_mac_base_date() void test_read_mac_base_date()
{ {
//TS_ASSERT_EQUALS(mac_wb.properties.excel_base_date, CALENDAR_MAC_1904) //TS_ASSERT_EQUALS(mac_wb.get_properties().get_excel_base_date(), CALENDAR_MAC_1904);
} }
void test_read_date_style_mac() void test_read_date_style_mac()
{ {
//TS_ASSERT_EQUALS(mac_ws.cell("A1").style.number_format.format_code, TS_ASSERT_EQUALS(mac_ws.cell("A1").get_style().get_number_format().get_format_code(), xlnt::number_format::format::date_xlsx14);
// NumberFormat.FORMAT_DATE_XLSX14)
} }
void test_read_date_style_win() void test_read_date_style_win()
{ {
//TS_ASSERT_EQUALS(win_ws.cell("A1").style.number_format.format_code, TS_ASSERT_EQUALS(win_ws.cell("A1").get_style().get_number_format().get_format_code(), xlnt::number_format::format::date_xlsx14);
// NumberFormat.FORMAT_DATE_XLSX14)
} }
void test_read_date_value() void test_read_date_value()
{ {
//datetuple = (2011, 10, 31) /*
// dt = datetime(datetuple[0], datetuple[1], datetuple[2]) auto datetuple = (2011, 10, 31);
// TS_ASSERT_EQUALS(mac_ws.cell("A1").value, dt) auto dt = datetime(datetuple[0], datetuple[1], datetuple[2]);
// TS_ASSERT_EQUALS(win_ws.cell("A1").value, dt) TS_ASSERT_EQUALS(mac_ws.cell("A1"), dt);
// TS_ASSERT_EQUALS(mac_ws.cell("A1").value, win_ws.cell("A1").value) TS_ASSERT_EQUALS(win_ws.cell("A1"), dt);
TS_ASSERT_EQUALS(mac_ws.cell("A1"), win_ws.cell("A1"));
*/
} }
private:
xlnt::worksheet worksheet_with_styles;
xlnt::workbook mac_wb;
xlnt::worksheet mac_ws;
xlnt::workbook win_wb;
xlnt::worksheet win_ws;
}; };

View File

@ -4,6 +4,7 @@
#include <cxxtest/TestSuite.h> #include <cxxtest/TestSuite.h>
#include "../xlnt.h" #include "../xlnt.h"
#include "PathHelper.h"
class ThemeTestSuite : public CxxTest::TestSuite class ThemeTestSuite : public CxxTest::TestSuite
{ {
@ -15,8 +16,13 @@ public:
void test_write_theme() void test_write_theme()
{ {
//content = write_theme(); auto content = xlnt::writer::write_theme();
//assert_equals_file_content(
// os.path.join(DATADIR, "writer", "expected", "theme1.xml"), content); std::string comparison_file = PathHelper::GetDataDirectory() + "/writer/expected/theme1.xml";
std::ifstream t(comparison_file);
std::stringstream buffer;
buffer << t.rdbuf();
TS_ASSERT_EQUALS(buffer.str(), content);
} }
}; };

View File

@ -1,21 +0,0 @@
#pragma once
#include <iostream>
#include <cxxtest/TestSuite.h>
#include "../xlnt.h"
class UnicodeTestSuite : public CxxTest::TestSuite
{
public:
UnicodeTestSuite()
{
}
void test_read_workbook_with_unicode_character()
{
//unicode_wb = os.path.join(DATADIR, "genuine", "unicode.xlsx");
//wb = load_workbook(filename = unicode_wb);
}
};

View File

@ -15,368 +15,248 @@ public:
void test_get_active_sheet() void test_get_active_sheet()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
auto active_sheet = wb.get_active_sheet(); auto active_sheet = wb.get_active_sheet();
TS_ASSERT_EQUALS(active_sheet, wb.worksheets[0]);*/ TS_ASSERT_EQUALS(active_sheet, wb[0]);
} }
void test_create_sheet() void test_create_sheet()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);*/ TS_ASSERT_EQUALS(new_sheet, wb[0]);
} }
void test_create_sheet_with_name() void test_create_sheet_with_name()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0, title = "LikeThisName"); auto new_sheet = wb.create_sheet(0, "LikeThisName");
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);*/ TS_ASSERT_EQUALS(new_sheet, wb[0]);
} }
void test_add_correct_sheet() void test_add_correct_sheet()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
wb.add_sheet(new_sheet); wb.add_sheet(new_sheet);
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[2]);*/ TS_ASSERT_EQUALS(new_sheet, wb[2]);
} }
void test_create_sheet_readonly() void test_create_sheet_readonly()
{ {
/*xlnt::workbook wb; xlnt::workbook wb(xlnt::optimized::read);
wb._set_optimized_read(); TS_ASSERT_THROWS_ANYTHING(wb.create_sheet());
wb.create_sheet();*/
} }
void test_remove_sheet() void test_remove_sheet()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
wb.remove_sheet(new_sheet); wb.remove_sheet(new_sheet);
assert new_sheet not in wb.worksheets;*/ for(auto worksheet : wb)
{
TS_ASSERT_DIFFERS(new_sheet, worksheet);
}
} }
void test_get_sheet_by_name() void test_get_sheet_by_name()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(); auto new_sheet = wb.create_sheet();
title = "my sheet"; std::string title = "my sheet";
new_sheet.title = title; new_sheet.set_title(title);
found_sheet = wb.get_sheet_by_name(title); auto found_sheet = wb.get_sheet_by_name(title);
TS_ASSERT_EQUALS(new_sheet, found_sheet);*/ TS_ASSERT_EQUALS(new_sheet, found_sheet);
}
void test_getitem()
{
xlnt::workbook wb;
auto new_sheet = wb.create_sheet();
std::string title = "my sheet";
new_sheet.set_title(title);
auto found_sheet = wb.get_sheet_by_name(title);
TS_ASSERT_EQUALS(new_sheet, found_sheet);
TS_ASSERT_THROWS_ANYTHING(wb["NotThere"]);
} }
void test_get_index2() void test_get_index2()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
sheet_index = wb.get_index(new_sheet); auto sheet_index = wb.get_index(new_sheet);
TS_ASSERT_EQUALS(sheet_index, 0);*/ TS_ASSERT_EQUALS(sheet_index, 0);
} }
void test_get_sheet_names() void test_get_sheet_names()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
names = ["Sheet", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5"]; std::vector<std::string> names = {"Sheet", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5"};
for(auto count : range(5)) for(int count = 0; count < names.size(); count++)
{ {
wb.create_sheet(0) wb.create_sheet(names[count]);
actual_names = wb.get_sheet_names() }
TS_ASSERT_EQUALS(sorted(actual_names), sorted(names)) auto actual_names = wb.get_sheet_names();
}*/ std::sort(actual_names.begin(), actual_names.end());
std::sort(names.begin(), names.end());
for(int count = 0; count < names.size(); count++)
{
TS_ASSERT_EQUALS(actual_names[count], names[count]);
}
} }
void test_get_named_ranges2()
{
/*xlnt::workbook wb;
TS_ASSERT_EQUALS(wb.get_named_ranges(), wb._named_ranges);*/
}
void test_get_active_sheet2() void test_get_active_sheet2()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
active_sheet = wb.get_active_sheet(); auto active_sheet = wb.get_active_sheet();
TS_ASSERT_EQUALS(active_sheet, wb.worksheets[0]);*/ TS_ASSERT_EQUALS(active_sheet, wb[0]);
} }
void test_create_sheet2() void test_create_sheet2()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);*/ TS_ASSERT_EQUALS(new_sheet, wb[0]);
} }
void test_create_sheet_with_name2() void test_create_sheet_with_name2()
{ {
/*xlnt::workbook wb; xlnt::workbook wb;
new_sheet = wb.create_sheet(0, title = "LikeThisName"); auto new_sheet = wb.create_sheet(0, "LikeThisName");
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);*/ TS_ASSERT_EQUALS(new_sheet, wb[0]);
} }
void test_add_correct_sheet2() void test_add_correct_sheet2()
{ {
//xlnt::workbook wb; xlnt::workbook wb;
//new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
//wb.add_sheet(new_sheet); wb.add_sheet(new_sheet);
//TS_ASSERT_EQUALS(new_sheet, wb.worksheets[2]); TS_ASSERT_EQUALS(new_sheet, wb[2]);
}
//@raises(AssertionError)
void test_add_incorrect_sheet2()
{
//xlnt::workbook wb;
//TS_ASSERT_THROWS(AssertionError, wb.add_sheet("Test"))
} }
void test_create_sheet_readonly2() void test_create_sheet_readonly2()
{ {
//xlnt::workbook wb; xlnt::workbook wb(xlnt::optimized::read);
//wb._set_optimized_read(); TS_ASSERT_THROWS_ANYTHING(wb.create_sheet());
//TS_ASSERT_THROWS(wb.create_sheet(), ReadOnlyWorkbook);
} }
void test_remove_sheet2() void test_remove_sheet2()
{ {
//xlnt::workbook wb; xlnt::workbook wb;
//new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
//wb.remove_sheet(new_sheet); wb.remove_sheet(new_sheet);
//assert new_sheet not in wb.worksheets; for(auto worksheet : wb)
{
TS_ASSERT_DIFFERS(new_sheet, worksheet);
}
} }
void test_get_sheet_by_name2() void test_get_sheet_by_name2()
{ {
//xlnt::workbook wb; xlnt::workbook wb;
//new_sheet = wb.create_sheet(); auto new_sheet = wb.create_sheet();
//title = "my sheet"; std::string title = "my sheet";
//new_sheet.title = title; new_sheet.set_title(title);
//found_sheet = wb.get_sheet_by_name(title); auto found_sheet = wb.get_sheet_by_name(title);
//TS_ASSERT_EQUALS(new_sheet, found_sheet); TS_ASSERT_EQUALS(new_sheet, found_sheet);
} }
void test_get_index() void test_get_index()
{ {
//xlnt::workbook wb; xlnt::workbook wb;
//new_sheet = wb.create_sheet(0); auto new_sheet = wb.create_sheet(0);
//sheet_index = wb.get_index(new_sheet); auto sheet_index = wb.get_index(new_sheet);
//TS_ASSERT_EQUALS(sheet_index, 0); TS_ASSERT_EQUALS(sheet_index, 0);
}
void test_get_sheet_names2()
{
//xlnt::workbook wb;
//names = ["Sheet", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5"];
//for(auto count in range(5))
//{
// wb.create_sheet(0)
// actual_names = wb.get_sheet_names()
// TS_ASSERT_EQUALS(sorted(actual_names), sorted(names))
//}
}
void test_get_named_ranges()
{
//xlnt::workbook wb;
//TS_ASSERT_EQUALS(wb.get_named_ranges(), wb._named_ranges);
} }
void test_add_named_range() void test_add_named_range()
{ {
//xlnt::workbook wb; xlnt::workbook wb;
//new_sheet = wb.create_sheet(); auto new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]); xlnt::named_range named_range(new_sheet, "A1");
//wb.add_named_range(named_range); wb.add_named_range("test_nr", named_range);
//named_ranges_list = wb.get_named_ranges(); auto named_ranges_list = wb.get_named_ranges();
//assert named_range in named_ranges_list; TS_ASSERT_DIFFERS(std::find(named_ranges_list.begin(), named_ranges_list.end(), named_range), named_ranges_list.end());
} }
void test_get_named_range2() void test_get_named_range2()
{ {
//xlnt::workbook wb; xlnt::workbook wb;
//new_sheet = wb.create_sheet(); auto new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]); xlnt::named_range named_range(new_sheet, "A1");
//wb.add_named_range(named_range); wb.add_named_range("test_nr", named_range);
//found_named_range = wb.get_named_range("test_nr"); auto found_named_range = wb.get_named_range("test_nr", new_sheet);
//TS_ASSERT_EQUALS(named_range, found_named_range); TS_ASSERT_EQUALS(named_range, found_named_range);
}
void test_remove_named_range2()
{
//xlnt::workbook wb;
//new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]);
//wb.add_named_range(named_range);
//wb.remove_named_range(named_range);
//named_ranges_list = wb.get_named_ranges();
//assert named_range not in named_ranges_list;
}
void test_add_local_named_range2()
{
//make_tmpdir();
//xlnt::workbook wb;
//new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]);
//named_range.scope = new_sheet;
//wb.add_named_range(named_range);
//dest_filename = osp.join(TMPDIR, "local_named_range_book.xlsx");
//wb.save(dest_filename);
//clean_tmpdir();
}
void test_write_regular_date()
{
//make_tmpdir();
//today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600);
//book = Workbook();
//sheet = book.get_active_sheet();
//sheet.cell("A1").value = today;
//dest_filename = osp.join(TMPDIR, "date_read_write_issue.xlsx");
//book.save(dest_filename);
//test_book = load_workbook(dest_filename);
//test_sheet = test_book.get_active_sheet();
//TS_ASSERT_EQUALS(test_sheet.cell("A1"), today);
//clean_tmpdir();
}
void test_write_regular_float()
{
//make_tmpdir();
//float float_value = 1.0 / 3.0;
//book = Workbook();
//sheet = book.get_active_sheet();
//sheet.cell("A1").value = float_value;
//dest_filename = osp.join(TMPDIR, "float_read_write_issue.xlsx");
//book.save(dest_filename);
//test_book = load_workbook(dest_filename);
//test_sheet = test_book.get_active_sheet();
//TS_ASSERT_EQUALS(test_sheet.cell("A1").value, float_value);*/
//clean_tmpdir();
}
void test_bad_encoding2()
{
//char pound = 163;
//std::string test_string = ("Compound Value (" + std::string(1, pound) + ")").encode("latin1");
//xlnt::workbook utf_book;
//xlnt::worksheet utf_sheet = utf_book.get_active_sheet();
//TS_ASSERT_THROWS(UnicodeDecode, utf_sheet.cell("A1") = test_string);
}
void test_good_encoding2()
{
//char pound = 163;
//std::string test_string = ("Compound Value (" + std::string(1, pound) + ")").encode("latin1");
//lat_book = Workbook(encoding = "latin1");
//lat_sheet = lat_book.get_active_sheet();
//lat_sheet.cell("A1").value = test_string;
}
void test_add_named_range2()
{
//wb = Workbook();
//new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]);
//wb.add_named_range(named_range);
//named_ranges_list = wb.get_named_ranges();
//assert named_range in named_ranges_list;
}
void test_get_named_range()
{
//wb = Workbook();
//new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]);
//wb.add_named_range(named_range);
//found_named_range = wb.get_named_range("test_nr");
//TS_ASSERT_EQUALS(named_range, found_named_range);
} }
void test_remove_named_range() void test_remove_named_range()
{ {
//wb = Workbook(); xlnt::workbook wb;
//new_sheet = wb.create_sheet(); auto new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]); xlnt::named_range named_range(new_sheet, "A1");
//wb.add_named_range(named_range); wb.add_named_range("test_nr", named_range);
//wb.remove_named_range(named_range); wb.remove_named_range(named_range);
//named_ranges_list = wb.get_named_ranges(); auto named_ranges_list = wb.get_named_ranges();
//assert named_range not in named_ranges_list; TS_ASSERT_EQUALS(std::find(named_ranges_list.begin(), named_ranges_list.end(), named_range), named_ranges_list.end());
} }
void test_add_local_named_range() void test_add_local_named_range()
{ {
//make_tmpdir(); make_tmpdir();
//wb = Workbook(); xlnt::workbook wb;
//new_sheet = wb.create_sheet(); auto new_sheet = wb.create_sheet();
//named_range = NamedRange("test_nr", [(new_sheet, "A1")]); xlnt::named_range named_range(new_sheet, "A1");
//named_range.scope = new_sheet; named_range.set_scope(new_sheet);
//wb.add_named_range(named_range); wb.add_named_range("test_nr", named_range);
//dest_filename = osp.join(TMPDIR, "local_named_range_book.xlsx"); auto dest_filename = PathHelper::GetTempDirectory() + "/local_named_range_book.xlsx";
//wb.save(dest_filename); wb.save(dest_filename);
//clean_tmpdir(); clean_tmpdir();
}
void make_tmpdir()
{
}
void clean_tmpdir()
{
} }
void test_write_regular_date2() void test_write_regular_date()
{ {
//make_tmpdir(); /*make_tmpdir();
//today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600); auto today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600);
//book = Workbook(); xlnt::workbook wb;
//sheet = book.get_active_sheet(); auto sheet = book.get_active_sheet();
//sheet.cell("A1").value = today; sheet.cell("A1") = today;
//dest_filename = osp.join(TMPDIR, "date_read_write_issue.xlsx"); dest_filename = osp.join(TMPDIR, "date_read_write_issue.xlsx");
//book.save(dest_filename); book.save(dest_filename);
//test_book = load_workbook(dest_filename); test_book = load_workbook(dest_filename);
//test_sheet = test_book.get_active_sheet(); test_sheet = test_book.get_active_sheet();
//TS_ASSERT_EQUALS(test_sheet.cell("A1").value, today); TS_ASSERT_EQUALS(test_sheet.cell("A1"), today);
//clean_tmpdir(); clean_tmpdir();*/
} }
void test_write_regular_float2() void test_write_regular_float()
{ {
//make_tmpdir(); make_tmpdir();
//float float_value = 1.0 / 3.0; float float_value = 1.0 / 3.0;
//xlnt::workbook book; xlnt::workbook book;
//xlnt::worksheet sheet = book.get_active_sheet(); auto sheet = book.get_active_sheet();
//sheet.cell("A1") = float_value; sheet.cell("A1") = float_value;
//std::string dest_filename = osp.join(TMPDIR, "float_read_write_issue.xlsx"); auto dest_filename = PathHelper::GetTempDirectory() + "float_read_write_issue.xlsx";
//book.save(dest_filename); book.save(dest_filename);
//xlnt::workbook test_book; xlnt::workbook test_book;
//test_book.load(dest_filename); test_book.load(dest_filename);
//xlnt::worksheet test_sheet = test_book.get_active_sheet(); auto test_sheet = test_book.get_active_sheet();
//TS_ASSERT_EQUALS(test_sheet.cell("A1"), float_value); TS_ASSERT_EQUALS(test_sheet.cell("A1"), float_value);
//clean_tmpdir(); clean_tmpdir();
}
// @raises(UnicodeDecodeError)
void test_bad_encoding()
{
/*pound = chr(163);
test_string = ("Compound Value (" + pound + ")").encode("latin1");
utf_book = Workbook();
utf_sheet = utf_book.get_active_sheet();
utf_sheet.cell("A1").value = test_string;*/
}
void test_good_encoding()
{
//char pound = 163;
//std::string test_string = ("Compound Value (" + std::string(1, pound) + ")").encode("latin1");
//xlnt::workbook lat_book("latin1");
//xlnt::worksheet lat_sheet = lat_book.get_active_sheet();
//lat_sheet.cell("A1") = test_string;
} }
}; };

View File

@ -252,34 +252,49 @@ public:
{ {
xlnt::worksheet ws(wb); xlnt::worksheet ws(wb);
/*ws.set_auto_filter(ws.range("a1:f1")); //ws.set_auto_filter(ws.range("a1:f1"));
TS_ASSERT_EQUALS(ws.get_auto_filter(), "A1:F1"); //TS_ASSERT_EQUALS(ws.get_auto_filter(), "A1:F1");
ws.set_auto_filter(""); ws.unset_auto_filter();
assert ws.auto_filter is None; TS_ASSERT_EQUALS(ws.has_auto_filter(), false);
ws.auto_filter = "c1:g9"; ws.set_auto_filter("c1:g9");
assert ws.auto_filter == "C1:G9";*/ TS_ASSERT_EQUALS(ws.get_auto_filter(), "C1:G9");
} }
void test_page_margins() void test_page_margins()
{ {
xlnt::worksheet ws(wb); xlnt::worksheet ws(wb);
/*ws.get_page_margins().set_left(2.0); ws.get_page_margins().set_left(2.0);
ws.get_page_margins().set_right(2.0); ws.get_page_margins().set_right(2.0);
ws.get_page_margins().set_top(2.0); ws.get_page_margins().set_top(2.0);
ws.get_page_margins().set_bottom(2.0); ws.get_page_margins().set_bottom(2.0);
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::writer::write_worksheet(ws); auto xml_string = xlnt::writer::write_worksheet(ws);
pugi::xml_document doc;
//assert "<pageMargins left="2.00" right="2.00" top="2.00" bottom="2.00" header="1.50" footer="1.50"></pageMargins>" in xml_string; doc.load(xml_string.c_str());
auto page_margins_node = doc.child("worksheet").child("pageMargins");
TS_ASSERT_DIFFERS(page_margins_node.attribute("left"), nullptr);
TS_ASSERT_EQUALS(page_margins_node.attribute("left").as_double(), 2.0);
TS_ASSERT_DIFFERS(page_margins_node.attribute("right"), nullptr);
TS_ASSERT_EQUALS(page_margins_node.attribute("right").as_double(), 2.0);
TS_ASSERT_DIFFERS(page_margins_node.attribute("top"), nullptr);
TS_ASSERT_EQUALS(page_margins_node.attribute("top").as_double(), 2.0);
TS_ASSERT_DIFFERS(page_margins_node.attribute("bottom"), nullptr);
TS_ASSERT_EQUALS(page_margins_node.attribute("bottom").as_double(), 2.0);
TS_ASSERT_DIFFERS(page_margins_node.attribute("header"), nullptr);
TS_ASSERT_EQUALS(page_margins_node.attribute("header").as_double(), 1.5);
TS_ASSERT_DIFFERS(page_margins_node.attribute("footer"), nullptr);
TS_ASSERT_EQUALS(page_margins_node.attribute("footer").as_double(), 1.5);
xlnt::worksheet ws2(wb); xlnt::worksheet ws2(wb);
//xml_string = xlnt::writer::write_worksheet(ws2); xml_string = xlnt::writer::write_worksheet(ws2);
//assert "<pageMargins" not in xml_string; doc.load(xml_string.c_str());
TS_ASSERT_EQUALS(doc.child("worksheet").child("pageMargins"), nullptr);
} }
void test_merge() void test_merge()
@ -290,17 +305,31 @@ public:
ws.cell("A1") = "Cell A1"; ws.cell("A1") = "Cell A1";
ws.cell("B1") = "Cell B1"; ws.cell("B1") = "Cell B1";
//auto xml_string = xlnt::writer::write_worksheet(ws);// , string_table); auto xml_string = xlnt::writer::write_worksheet(ws, string_table);
/*assert "<c r="B1" t="s"><v>Cell B1</v></c>" in xml_string; pugi::xml_document doc;
doc.load(xml_string.c_str());
auto cell_node = doc.child("worksheet").child("c");
TS_ASSERT_DIFFERS(cell_node, nullptr);
TS_ASSERT_DIFFERS(cell_node.attribute("r"), nullptr);
TS_ASSERT_DIFFERS(std::string(cell_node.attribute("r").as_string()), "B1");
TS_ASSERT_DIFFERS(cell_node.attribute("t"), nullptr);
TS_ASSERT_DIFFERS(std::string(cell_node.attribute("t").as_string()), "s");
TS_ASSERT_DIFFERS(cell_node.child("v"), nullptr);
TS_ASSERT_DIFFERS(std::string(cell_node.child("v").text().as_string()), "B1");
ws.merge_cells("A1:B1"); ws.merge_cells("A1:B1");
xml_string = xlnt::writer::write_worksheet(ws, string_table, None); xml_string = xlnt::writer::write_worksheet(ws, string_table);
assert "<c r="B1" t="s"><v>Cell B1</v></c>" not in xml_string; doc.load(xml_string.c_str());
assert "<mergeCells><mergeCell ref="A1:B1"></mergeCell></mergeCells>" in xml_string; cell_node = doc.child("worksheet").child("c");
TS_ASSERT_EQUALS(cell_node, nullptr);
auto merge_node = doc.child("worksheet").child("mergeCells").child("mergeCell");
TS_ASSERT_EQUALS(std::string(merge_node.attribute("ref").as_string()), "A1:B1");
ws.unmerge_cells("A1:B1"); ws.unmerge_cells("A1:B1");
xml_string = xlnt::writer::write_worksheet(ws, string_table, None); xml_string = xlnt::writer::write_worksheet(ws, string_table);
assert "<mergeCell ref="A1:B1"></mergeCell>" not in xml_string;*/ doc.load(xml_string.c_str());
merge_node = doc.child("worksheet").child("mergeCells").child("mergeCell");
TS_ASSERT_EQUALS(merge_node, nullptr);
} }
void test_freeze() void test_freeze()
@ -329,15 +358,27 @@ public:
ws.get_page_setup().fit_to_page = true; ws.get_page_setup().fit_to_page = true;
ws.get_page_setup().fit_to_height = false; ws.get_page_setup().fit_to_height = false;
ws.get_page_setup().fit_to_width = true; ws.get_page_setup().fit_to_width = true;
//auto xml_string = xlnt::writer::write_worksheet(ws); auto xml_string = xlnt::writer::write_worksheet(ws);
//pugi::xml_document doc; pugi::xml_document doc;
//TS_ASSERT("<pageSetup orientation=\"landscape\" paperSize=\"3\" fitToHeight=\"0\" fitToWidth=\"1\"></pageSetup>" in xml_string); doc.load(xml_string.c_str());
//TS_ASSERT("<pageSetUpPr fitToPage=\"1\"></pageSetUpPr>" in xml_string); auto page_setup_node = doc.child("worksheet").child("pageSetup");
TS_ASSERT_DIFFERS(page_setup_node, nullptr);
TS_ASSERT_DIFFERS(page_setup_node.attribute("orientation"), nullptr);
TS_ASSERT_DIFFERS(std::string(page_setup_node.attribute("orientation").as_string()), "landscape");
TS_ASSERT_DIFFERS(page_setup_node.attribute("paperSize"), nullptr);
TS_ASSERT_DIFFERS(page_setup_node.attribute("paperSize").as_int(), 3);
TS_ASSERT_DIFFERS(page_setup_node.attribute("fitToHeight"), nullptr);
TS_ASSERT_DIFFERS(page_setup_node.attribute("fitToHeight").as_int(), 0);
TS_ASSERT_DIFFERS(page_setup_node.attribute("fitToWidth"), nullptr);
TS_ASSERT_DIFFERS(page_setup_node.attribute("fitToWidth").as_int(), 1);
TS_ASSERT_DIFFERS(doc.child("worksheet").child("pageSetUpPr").attribute("fitToPage"), nullptr);
TS_ASSERT_DIFFERS(doc.child("worksheet").child("pageSetUpPr").attribute("fitToPage").as_int(), 1);
xlnt::worksheet ws2(wb); xlnt::worksheet ws2(wb);
//xml_string = xlnt::writer::write_worksheet(ws2); xml_string = xlnt::writer::write_worksheet(ws2);
//TS_ASSERT("<pageSetup" not in xml_string); doc.load(xml_string.c_str());
//TS_ASSERT("<pageSetUpPr" not in xml_string); TS_ASSERT_EQUALS(doc.child("worksheet").child("pageSetup"), nullptr);
TS_ASSERT_EQUALS(doc.child("worksheet").child("pageSetUpPr"), nullptr);
} }
private: private:

View File

@ -318,55 +318,6 @@ public:
void runTest() { suite_DumpTestSuite.test_append_after_save(); } void runTest() { suite_DumpTestSuite.test_append_after_save(); }
} testDescription_suite_DumpTestSuite_test_append_after_save; } testDescription_suite_DumpTestSuite_test_append_after_save;
#include "/Users/thomas/Development/xlnt/source/tests/IterTestSuite.h"
static IterTestSuite suite_IterTestSuite;
static CxxTest::List Tests_IterTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_IterTestSuite( "IterTestSuite.h", 8, "IterTestSuite", suite_IterTestSuite, Tests_IterTestSuite );
static class TestDescription_suite_IterTestSuite_test_get_dimensions : public CxxTest::RealTestDescription {
public:
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, 32, "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, 52, "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, 57, "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, 62, "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, 70, "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, 88, "test_read_single_cell_date" ) {}
void runTest() { suite_IterTestSuite.test_read_single_cell_date(); }
} testDescription_suite_IterTestSuite_test_read_single_cell_date;
#include "/Users/thomas/Development/xlnt/source/tests/NamedRangeTestSuite.h" #include "/Users/thomas/Development/xlnt/source/tests/NamedRangeTestSuite.h"
static NamedRangeTestSuite suite_NamedRangeTestSuite; static NamedRangeTestSuite suite_NamedRangeTestSuite;
@ -624,45 +575,39 @@ static PropsTestSuite suite_PropsTestSuite;
static CxxTest::List Tests_PropsTestSuite = { 0, 0 }; static CxxTest::List Tests_PropsTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_PropsTestSuite( "PropsTestSuite.h", 8, "PropsTestSuite", suite_PropsTestSuite, Tests_PropsTestSuite ); CxxTest::StaticSuiteDescription suiteDescription_PropsTestSuite( "PropsTestSuite.h", 8, "PropsTestSuite", suite_PropsTestSuite, Tests_PropsTestSuite );
static class TestDescription_suite_PropsTestSuite_test_1 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_PropsTestSuite_test_1() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 16, "test_1" ) {}
void runTest() { suite_PropsTestSuite.test_1(); }
} testDescription_suite_PropsTestSuite_test_1;
static class TestDescription_suite_PropsTestSuite_test_read_properties_core : public CxxTest::RealTestDescription { static class TestDescription_suite_PropsTestSuite_test_read_properties_core : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_PropsTestSuite_test_read_properties_core() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 35, "test_read_properties_core" ) {} TestDescription_suite_PropsTestSuite_test_read_properties_core() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 30, "test_read_properties_core" ) {}
void runTest() { suite_PropsTestSuite.test_read_properties_core(); } void runTest() { suite_PropsTestSuite.test_read_properties_core(); }
} testDescription_suite_PropsTestSuite_test_read_properties_core; } testDescription_suite_PropsTestSuite_test_read_properties_core;
static class TestDescription_suite_PropsTestSuite_test_read_sheets_titles : public CxxTest::RealTestDescription { static class TestDescription_suite_PropsTestSuite_test_read_sheets_titles : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_PropsTestSuite_test_read_sheets_titles() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 46, "test_read_sheets_titles" ) {} TestDescription_suite_PropsTestSuite_test_read_sheets_titles() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 41, "test_read_sheets_titles" ) {}
void runTest() { suite_PropsTestSuite.test_read_sheets_titles(); } void runTest() { suite_PropsTestSuite.test_read_sheets_titles(); }
} testDescription_suite_PropsTestSuite_test_read_sheets_titles; } testDescription_suite_PropsTestSuite_test_read_sheets_titles;
static class TestDescription_suite_PropsTestSuite_test_read_properties_core2 : public CxxTest::RealTestDescription { static class TestDescription_suite_PropsTestSuite_test_read_properties_core2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_PropsTestSuite_test_read_properties_core2() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 67, "test_read_properties_core2" ) {} TestDescription_suite_PropsTestSuite_test_read_properties_core2() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 62, "test_read_properties_core2" ) {}
void runTest() { suite_PropsTestSuite.test_read_properties_core2(); } void runTest() { suite_PropsTestSuite.test_read_properties_core2(); }
} testDescription_suite_PropsTestSuite_test_read_properties_core2; } testDescription_suite_PropsTestSuite_test_read_properties_core2;
static class TestDescription_suite_PropsTestSuite_test_read_sheets_titles2 : public CxxTest::RealTestDescription { static class TestDescription_suite_PropsTestSuite_test_read_sheets_titles2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_PropsTestSuite_test_read_sheets_titles2() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 74, "test_read_sheets_titles2" ) {} TestDescription_suite_PropsTestSuite_test_read_sheets_titles2() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 69, "test_read_sheets_titles2" ) {}
void runTest() { suite_PropsTestSuite.test_read_sheets_titles2(); } void runTest() { suite_PropsTestSuite.test_read_sheets_titles2(); }
} testDescription_suite_PropsTestSuite_test_read_sheets_titles2; } testDescription_suite_PropsTestSuite_test_read_sheets_titles2;
static class TestDescription_suite_PropsTestSuite_test_write_properties_core : public CxxTest::RealTestDescription { static class TestDescription_suite_PropsTestSuite_test_write_properties_core : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_PropsTestSuite_test_write_properties_core() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 82, "test_write_properties_core" ) {} TestDescription_suite_PropsTestSuite_test_write_properties_core() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 77, "test_write_properties_core" ) {}
void runTest() { suite_PropsTestSuite.test_write_properties_core(); } void runTest() { suite_PropsTestSuite.test_write_properties_core(); }
} testDescription_suite_PropsTestSuite_test_write_properties_core; } testDescription_suite_PropsTestSuite_test_write_properties_core;
static class TestDescription_suite_PropsTestSuite_test_write_properties_app : public CxxTest::RealTestDescription { static class TestDescription_suite_PropsTestSuite_test_write_properties_app : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_PropsTestSuite_test_write_properties_app() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 94, "test_write_properties_app" ) {} TestDescription_suite_PropsTestSuite_test_write_properties_app() : CxxTest::RealTestDescription( Tests_PropsTestSuite, suiteDescription_PropsTestSuite, 89, "test_write_properties_app" ) {}
void runTest() { suite_PropsTestSuite.test_write_properties_app(); } void runTest() { suite_PropsTestSuite.test_write_properties_app(); }
} testDescription_suite_PropsTestSuite_test_write_properties_app; } testDescription_suite_PropsTestSuite_test_write_properties_app;
@ -671,131 +616,131 @@ public:
static ReadTestSuite suite_ReadTestSuite; static ReadTestSuite suite_ReadTestSuite;
static CxxTest::List Tests_ReadTestSuite = { 0, 0 }; static CxxTest::List Tests_ReadTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_ReadTestSuite( "ReadTestSuite.h", 8, "ReadTestSuite", suite_ReadTestSuite, Tests_ReadTestSuite ); CxxTest::StaticSuiteDescription suiteDescription_ReadTestSuite( "ReadTestSuite.h", 10, "ReadTestSuite", suite_ReadTestSuite, Tests_ReadTestSuite );
static class TestDescription_suite_ReadTestSuite_test_read_standalone_worksheet : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_standalone_worksheet : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_standalone_worksheet() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 16, "test_read_standalone_worksheet" ) {} TestDescription_suite_ReadTestSuite_test_read_standalone_worksheet() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 29, "test_read_standalone_worksheet" ) {}
void runTest() { suite_ReadTestSuite.test_read_standalone_worksheet(); } void runTest() { suite_ReadTestSuite.test_read_standalone_worksheet(); }
} testDescription_suite_ReadTestSuite_test_read_standalone_worksheet; } testDescription_suite_ReadTestSuite_test_read_standalone_worksheet;
static class TestDescription_suite_ReadTestSuite_test_read_standard_workbook : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_standard_workbook : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_standard_workbook() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 32, "test_read_standard_workbook" ) {} TestDescription_suite_ReadTestSuite_test_read_standard_workbook() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 47, "test_read_standard_workbook" ) {}
void runTest() { suite_ReadTestSuite.test_read_standard_workbook(); } void runTest() { suite_ReadTestSuite.test_read_standard_workbook(); }
} testDescription_suite_ReadTestSuite_test_read_standard_workbook; } testDescription_suite_ReadTestSuite_test_read_standard_workbook;
static class TestDescription_suite_ReadTestSuite_test_read_standard_workbook_from_fileobj : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_standard_workbook_from_fileobj : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_standard_workbook_from_fileobj() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 39, "test_read_standard_workbook_from_fileobj" ) {} TestDescription_suite_ReadTestSuite_test_read_standard_workbook_from_fileobj() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 54, "test_read_standard_workbook_from_fileobj" ) {}
void runTest() { suite_ReadTestSuite.test_read_standard_workbook_from_fileobj(); } void runTest() { suite_ReadTestSuite.test_read_standard_workbook_from_fileobj(); }
} testDescription_suite_ReadTestSuite_test_read_standard_workbook_from_fileobj; } testDescription_suite_ReadTestSuite_test_read_standard_workbook_from_fileobj;
static class TestDescription_suite_ReadTestSuite_test_read_worksheet : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_worksheet : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_worksheet() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 47, "test_read_worksheet" ) {} TestDescription_suite_ReadTestSuite_test_read_worksheet() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 64, "test_read_worksheet" ) {}
void runTest() { suite_ReadTestSuite.test_read_worksheet(); } void runTest() { suite_ReadTestSuite.test_read_worksheet(); }
} testDescription_suite_ReadTestSuite_test_read_worksheet; } testDescription_suite_ReadTestSuite_test_read_worksheet;
static class TestDescription_suite_ReadTestSuite_test_read_nostring_workbook : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_nostring_workbook : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_nostring_workbook() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 57, "test_read_nostring_workbook" ) {} TestDescription_suite_ReadTestSuite_test_read_nostring_workbook() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 75, "test_read_nostring_workbook" ) {}
void runTest() { suite_ReadTestSuite.test_read_nostring_workbook(); } void runTest() { suite_ReadTestSuite.test_read_nostring_workbook(); }
} testDescription_suite_ReadTestSuite_test_read_nostring_workbook; } testDescription_suite_ReadTestSuite_test_read_nostring_workbook;
static class TestDescription_suite_ReadTestSuite_test_read_empty_file : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_empty_file : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_empty_file() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 64, "test_read_empty_file" ) {} TestDescription_suite_ReadTestSuite_test_read_empty_file() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 82, "test_read_empty_file" ) {}
void runTest() { suite_ReadTestSuite.test_read_empty_file(); } void runTest() { suite_ReadTestSuite.test_read_empty_file(); }
} testDescription_suite_ReadTestSuite_test_read_empty_file; } testDescription_suite_ReadTestSuite_test_read_empty_file;
static class TestDescription_suite_ReadTestSuite_test_read_empty_archive : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_empty_archive : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_empty_archive() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 72, "test_read_empty_archive" ) {} TestDescription_suite_ReadTestSuite_test_read_empty_archive() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 90, "test_read_empty_archive" ) {}
void runTest() { suite_ReadTestSuite.test_read_empty_archive(); } void runTest() { suite_ReadTestSuite.test_read_empty_archive(); }
} testDescription_suite_ReadTestSuite_test_read_empty_archive; } testDescription_suite_ReadTestSuite_test_read_empty_archive;
static class TestDescription_suite_ReadTestSuite_test_read_dimension : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_dimension : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_dimension() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 78, "test_read_dimension" ) {} TestDescription_suite_ReadTestSuite_test_read_dimension() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 97, "test_read_dimension" ) {}
void runTest() { suite_ReadTestSuite.test_read_dimension(); } void runTest() { suite_ReadTestSuite.test_read_dimension(); }
} testDescription_suite_ReadTestSuite_test_read_dimension; } testDescription_suite_ReadTestSuite_test_read_dimension;
static class TestDescription_suite_ReadTestSuite_test_calculate_dimension_iter : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_calculate_dimension_iter : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_calculate_dimension_iter() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 92, "test_calculate_dimension_iter" ) {} TestDescription_suite_ReadTestSuite_test_calculate_dimension_iter() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 107, "test_calculate_dimension_iter" ) {}
void runTest() { suite_ReadTestSuite.test_calculate_dimension_iter(); } void runTest() { suite_ReadTestSuite.test_calculate_dimension_iter(); }
} testDescription_suite_ReadTestSuite_test_calculate_dimension_iter; } testDescription_suite_ReadTestSuite_test_calculate_dimension_iter;
static class TestDescription_suite_ReadTestSuite_test_get_highest_row_iter : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_get_highest_row_iter : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_get_highest_row_iter() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 101, "test_get_highest_row_iter" ) {} TestDescription_suite_ReadTestSuite_test_get_highest_row_iter() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 117, "test_get_highest_row_iter" ) {}
void runTest() { suite_ReadTestSuite.test_get_highest_row_iter(); } void runTest() { suite_ReadTestSuite.test_get_highest_row_iter(); }
} testDescription_suite_ReadTestSuite_test_get_highest_row_iter; } testDescription_suite_ReadTestSuite_test_get_highest_row_iter;
static class TestDescription_suite_ReadTestSuite_test_read_workbook_with_no_properties : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_workbook_with_no_properties : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_workbook_with_no_properties() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 110, "test_read_workbook_with_no_properties" ) {} TestDescription_suite_ReadTestSuite_test_read_workbook_with_no_properties() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 127, "test_read_workbook_with_no_properties" ) {}
void runTest() { suite_ReadTestSuite.test_read_workbook_with_no_properties(); } void runTest() { suite_ReadTestSuite.test_read_workbook_with_no_properties(); }
} testDescription_suite_ReadTestSuite_test_read_workbook_with_no_properties; } testDescription_suite_ReadTestSuite_test_read_workbook_with_no_properties;
static class TestDescription_suite_ReadTestSuite_test_read_general_style : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_general_style : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_general_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 125, "test_read_general_style" ) {} TestDescription_suite_ReadTestSuite_test_read_general_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 134, "test_read_general_style" ) {}
void runTest() { suite_ReadTestSuite.test_read_general_style(); } void runTest() { suite_ReadTestSuite.test_read_general_style(); }
} testDescription_suite_ReadTestSuite_test_read_general_style; } testDescription_suite_ReadTestSuite_test_read_general_style;
static class TestDescription_suite_ReadTestSuite_test_read_date_style : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_date_style : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_date_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 131, "test_read_date_style" ) {} TestDescription_suite_ReadTestSuite_test_read_date_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 139, "test_read_date_style" ) {}
void runTest() { suite_ReadTestSuite.test_read_date_style(); } void runTest() { suite_ReadTestSuite.test_read_date_style(); }
} testDescription_suite_ReadTestSuite_test_read_date_style; } testDescription_suite_ReadTestSuite_test_read_date_style;
static class TestDescription_suite_ReadTestSuite_test_read_number_style : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_number_style : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_number_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 137, "test_read_number_style" ) {} TestDescription_suite_ReadTestSuite_test_read_number_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 144, "test_read_number_style" ) {}
void runTest() { suite_ReadTestSuite.test_read_number_style(); } void runTest() { suite_ReadTestSuite.test_read_number_style(); }
} testDescription_suite_ReadTestSuite_test_read_number_style; } testDescription_suite_ReadTestSuite_test_read_number_style;
static class TestDescription_suite_ReadTestSuite_test_read_time_style : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_time_style : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_time_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 143, "test_read_time_style" ) {} TestDescription_suite_ReadTestSuite_test_read_time_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 149, "test_read_time_style" ) {}
void runTest() { suite_ReadTestSuite.test_read_time_style(); } void runTest() { suite_ReadTestSuite.test_read_time_style(); }
} testDescription_suite_ReadTestSuite_test_read_time_style; } testDescription_suite_ReadTestSuite_test_read_time_style;
static class TestDescription_suite_ReadTestSuite_test_read_percentage_style : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_percentage_style : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_percentage_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 149, "test_read_percentage_style" ) {} TestDescription_suite_ReadTestSuite_test_read_percentage_style() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 154, "test_read_percentage_style" ) {}
void runTest() { suite_ReadTestSuite.test_read_percentage_style(); } void runTest() { suite_ReadTestSuite.test_read_percentage_style(); }
} testDescription_suite_ReadTestSuite_test_read_percentage_style; } testDescription_suite_ReadTestSuite_test_read_percentage_style;
static class TestDescription_suite_ReadTestSuite_test_read_win_base_date : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_win_base_date : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_win_base_date() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 166, "test_read_win_base_date" ) {} TestDescription_suite_ReadTestSuite_test_read_win_base_date() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 159, "test_read_win_base_date" ) {}
void runTest() { suite_ReadTestSuite.test_read_win_base_date(); } void runTest() { suite_ReadTestSuite.test_read_win_base_date(); }
} testDescription_suite_ReadTestSuite_test_read_win_base_date; } testDescription_suite_ReadTestSuite_test_read_win_base_date;
static class TestDescription_suite_ReadTestSuite_test_read_mac_base_date : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_mac_base_date : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_mac_base_date() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 171, "test_read_mac_base_date" ) {} TestDescription_suite_ReadTestSuite_test_read_mac_base_date() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 164, "test_read_mac_base_date" ) {}
void runTest() { suite_ReadTestSuite.test_read_mac_base_date(); } void runTest() { suite_ReadTestSuite.test_read_mac_base_date(); }
} testDescription_suite_ReadTestSuite_test_read_mac_base_date; } testDescription_suite_ReadTestSuite_test_read_mac_base_date;
static class TestDescription_suite_ReadTestSuite_test_read_date_style_mac : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_date_style_mac : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_date_style_mac() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 176, "test_read_date_style_mac" ) {} TestDescription_suite_ReadTestSuite_test_read_date_style_mac() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 169, "test_read_date_style_mac" ) {}
void runTest() { suite_ReadTestSuite.test_read_date_style_mac(); } void runTest() { suite_ReadTestSuite.test_read_date_style_mac(); }
} testDescription_suite_ReadTestSuite_test_read_date_style_mac; } testDescription_suite_ReadTestSuite_test_read_date_style_mac;
static class TestDescription_suite_ReadTestSuite_test_read_date_style_win : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_date_style_win : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_date_style_win() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 182, "test_read_date_style_win" ) {} TestDescription_suite_ReadTestSuite_test_read_date_style_win() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 174, "test_read_date_style_win" ) {}
void runTest() { suite_ReadTestSuite.test_read_date_style_win(); } void runTest() { suite_ReadTestSuite.test_read_date_style_win(); }
} testDescription_suite_ReadTestSuite_test_read_date_style_win; } testDescription_suite_ReadTestSuite_test_read_date_style_win;
static class TestDescription_suite_ReadTestSuite_test_read_date_value : public CxxTest::RealTestDescription { static class TestDescription_suite_ReadTestSuite_test_read_date_value : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ReadTestSuite_test_read_date_value() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 188, "test_read_date_value" ) {} TestDescription_suite_ReadTestSuite_test_read_date_value() : CxxTest::RealTestDescription( Tests_ReadTestSuite, suiteDescription_ReadTestSuite, 179, "test_read_date_value" ) {}
void runTest() { suite_ReadTestSuite.test_read_date_value(); } void runTest() { suite_ReadTestSuite.test_read_date_value(); }
} testDescription_suite_ReadTestSuite_test_read_date_value; } testDescription_suite_ReadTestSuite_test_read_date_value;
@ -940,19 +885,6 @@ public:
void runTest() { suite_ThemeTestSuite.test_write_theme(); } void runTest() { suite_ThemeTestSuite.test_write_theme(); }
} testDescription_suite_ThemeTestSuite_test_write_theme; } testDescription_suite_ThemeTestSuite_test_write_theme;
#include "/Users/thomas/Development/xlnt/source/tests/UnicodeTestSuite.h"
static UnicodeTestSuite suite_UnicodeTestSuite;
static CxxTest::List Tests_UnicodeTestSuite = { 0, 0 };
CxxTest::StaticSuiteDescription suiteDescription_UnicodeTestSuite( "UnicodeTestSuite.h", 8, "UnicodeTestSuite", suite_UnicodeTestSuite, Tests_UnicodeTestSuite );
static class TestDescription_suite_UnicodeTestSuite_test_read_workbook_with_unicode_character : public CxxTest::RealTestDescription {
public:
TestDescription_suite_UnicodeTestSuite_test_read_workbook_with_unicode_character() : CxxTest::RealTestDescription( Tests_UnicodeTestSuite, suiteDescription_UnicodeTestSuite, 16, "test_read_workbook_with_unicode_character" ) {}
void runTest() { suite_UnicodeTestSuite.test_read_workbook_with_unicode_character(); }
} testDescription_suite_UnicodeTestSuite_test_read_workbook_with_unicode_character;
#include "/Users/thomas/Development/xlnt/source/tests/WorkbookTestSuite.h" #include "/Users/thomas/Development/xlnt/source/tests/WorkbookTestSuite.h"
static WorkbookTestSuite suite_WorkbookTestSuite; static WorkbookTestSuite suite_WorkbookTestSuite;
@ -992,195 +924,117 @@ public:
static class TestDescription_suite_WorkbookTestSuite_test_remove_sheet : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_remove_sheet : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_remove_sheet() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 52, "test_remove_sheet" ) {} TestDescription_suite_WorkbookTestSuite_test_remove_sheet() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 51, "test_remove_sheet" ) {}
void runTest() { suite_WorkbookTestSuite.test_remove_sheet(); } void runTest() { suite_WorkbookTestSuite.test_remove_sheet(); }
} testDescription_suite_WorkbookTestSuite_test_remove_sheet; } testDescription_suite_WorkbookTestSuite_test_remove_sheet;
static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 60, "test_get_sheet_by_name" ) {} TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 62, "test_get_sheet_by_name" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_sheet_by_name(); } void runTest() { suite_WorkbookTestSuite.test_get_sheet_by_name(); }
} testDescription_suite_WorkbookTestSuite_test_get_sheet_by_name; } testDescription_suite_WorkbookTestSuite_test_get_sheet_by_name;
static class TestDescription_suite_WorkbookTestSuite_test_getitem : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_getitem() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 72, "test_getitem" ) {}
void runTest() { suite_WorkbookTestSuite.test_getitem(); }
} testDescription_suite_WorkbookTestSuite_test_getitem;
static class TestDescription_suite_WorkbookTestSuite_test_get_index2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_index2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_index2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 70, "test_get_index2" ) {} TestDescription_suite_WorkbookTestSuite_test_get_index2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 84, "test_get_index2" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_index2(); } void runTest() { suite_WorkbookTestSuite.test_get_index2(); }
} testDescription_suite_WorkbookTestSuite_test_get_index2; } testDescription_suite_WorkbookTestSuite_test_get_index2;
static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_names : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_names : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_sheet_names() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 78, "test_get_sheet_names" ) {} TestDescription_suite_WorkbookTestSuite_test_get_sheet_names() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 92, "test_get_sheet_names" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_sheet_names(); } void runTest() { suite_WorkbookTestSuite.test_get_sheet_names(); }
} testDescription_suite_WorkbookTestSuite_test_get_sheet_names; } testDescription_suite_WorkbookTestSuite_test_get_sheet_names;
static class TestDescription_suite_WorkbookTestSuite_test_get_named_ranges2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_get_named_ranges2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 90, "test_get_named_ranges2" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_named_ranges2(); }
} testDescription_suite_WorkbookTestSuite_test_get_named_ranges2;
static class TestDescription_suite_WorkbookTestSuite_test_get_active_sheet2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_active_sheet2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_active_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 95, "test_get_active_sheet2" ) {} TestDescription_suite_WorkbookTestSuite_test_get_active_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 109, "test_get_active_sheet2" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_active_sheet2(); } void runTest() { suite_WorkbookTestSuite.test_get_active_sheet2(); }
} testDescription_suite_WorkbookTestSuite_test_get_active_sheet2; } testDescription_suite_WorkbookTestSuite_test_get_active_sheet2;
static class TestDescription_suite_WorkbookTestSuite_test_create_sheet2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_create_sheet2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_create_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 102, "test_create_sheet2" ) {} TestDescription_suite_WorkbookTestSuite_test_create_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 116, "test_create_sheet2" ) {}
void runTest() { suite_WorkbookTestSuite.test_create_sheet2(); } void runTest() { suite_WorkbookTestSuite.test_create_sheet2(); }
} testDescription_suite_WorkbookTestSuite_test_create_sheet2; } testDescription_suite_WorkbookTestSuite_test_create_sheet2;
static class TestDescription_suite_WorkbookTestSuite_test_create_sheet_with_name2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_create_sheet_with_name2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_create_sheet_with_name2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 109, "test_create_sheet_with_name2" ) {} TestDescription_suite_WorkbookTestSuite_test_create_sheet_with_name2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 123, "test_create_sheet_with_name2" ) {}
void runTest() { suite_WorkbookTestSuite.test_create_sheet_with_name2(); } void runTest() { suite_WorkbookTestSuite.test_create_sheet_with_name2(); }
} testDescription_suite_WorkbookTestSuite_test_create_sheet_with_name2; } testDescription_suite_WorkbookTestSuite_test_create_sheet_with_name2;
static class TestDescription_suite_WorkbookTestSuite_test_add_correct_sheet2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_add_correct_sheet2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_add_correct_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 116, "test_add_correct_sheet2" ) {} TestDescription_suite_WorkbookTestSuite_test_add_correct_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 130, "test_add_correct_sheet2" ) {}
void runTest() { suite_WorkbookTestSuite.test_add_correct_sheet2(); } void runTest() { suite_WorkbookTestSuite.test_add_correct_sheet2(); }
} testDescription_suite_WorkbookTestSuite_test_add_correct_sheet2; } testDescription_suite_WorkbookTestSuite_test_add_correct_sheet2;
static class TestDescription_suite_WorkbookTestSuite_test_add_incorrect_sheet2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_add_incorrect_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 125, "test_add_incorrect_sheet2" ) {}
void runTest() { suite_WorkbookTestSuite.test_add_incorrect_sheet2(); }
} testDescription_suite_WorkbookTestSuite_test_add_incorrect_sheet2;
static class TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 131, "test_create_sheet_readonly2" ) {} TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 138, "test_create_sheet_readonly2" ) {}
void runTest() { suite_WorkbookTestSuite.test_create_sheet_readonly2(); } void runTest() { suite_WorkbookTestSuite.test_create_sheet_readonly2(); }
} testDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2; } testDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2;
static class TestDescription_suite_WorkbookTestSuite_test_remove_sheet2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_remove_sheet2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_remove_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 138, "test_remove_sheet2" ) {} TestDescription_suite_WorkbookTestSuite_test_remove_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 144, "test_remove_sheet2" ) {}
void runTest() { suite_WorkbookTestSuite.test_remove_sheet2(); } void runTest() { suite_WorkbookTestSuite.test_remove_sheet2(); }
} testDescription_suite_WorkbookTestSuite_test_remove_sheet2; } testDescription_suite_WorkbookTestSuite_test_remove_sheet2;
static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 146, "test_get_sheet_by_name2" ) {} TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 155, "test_get_sheet_by_name2" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_sheet_by_name2(); } void runTest() { suite_WorkbookTestSuite.test_get_sheet_by_name2(); }
} testDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2; } testDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2;
static class TestDescription_suite_WorkbookTestSuite_test_get_index : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_index : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_index() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 156, "test_get_index" ) {} TestDescription_suite_WorkbookTestSuite_test_get_index() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 165, "test_get_index" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_index(); } void runTest() { suite_WorkbookTestSuite.test_get_index(); }
} testDescription_suite_WorkbookTestSuite_test_get_index; } testDescription_suite_WorkbookTestSuite_test_get_index;
static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_names2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_get_sheet_names2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 164, "test_get_sheet_names2" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_sheet_names2(); }
} testDescription_suite_WorkbookTestSuite_test_get_sheet_names2;
static class TestDescription_suite_WorkbookTestSuite_test_get_named_ranges : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_get_named_ranges() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 176, "test_get_named_ranges" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_named_ranges(); }
} testDescription_suite_WorkbookTestSuite_test_get_named_ranges;
static class TestDescription_suite_WorkbookTestSuite_test_add_named_range : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_add_named_range : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_add_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 182, "test_add_named_range" ) {} TestDescription_suite_WorkbookTestSuite_test_add_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 173, "test_add_named_range" ) {}
void runTest() { suite_WorkbookTestSuite.test_add_named_range(); } void runTest() { suite_WorkbookTestSuite.test_add_named_range(); }
} testDescription_suite_WorkbookTestSuite_test_add_named_range; } testDescription_suite_WorkbookTestSuite_test_add_named_range;
static class TestDescription_suite_WorkbookTestSuite_test_get_named_range2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_get_named_range2 : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_get_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 192, "test_get_named_range2" ) {} TestDescription_suite_WorkbookTestSuite_test_get_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 183, "test_get_named_range2" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_named_range2(); } void runTest() { suite_WorkbookTestSuite.test_get_named_range2(); }
} testDescription_suite_WorkbookTestSuite_test_get_named_range2; } testDescription_suite_WorkbookTestSuite_test_get_named_range2;
static class TestDescription_suite_WorkbookTestSuite_test_remove_named_range2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_remove_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 202, "test_remove_named_range2" ) {}
void runTest() { suite_WorkbookTestSuite.test_remove_named_range2(); }
} testDescription_suite_WorkbookTestSuite_test_remove_named_range2;
static class TestDescription_suite_WorkbookTestSuite_test_add_local_named_range2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_add_local_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 213, "test_add_local_named_range2" ) {}
void runTest() { suite_WorkbookTestSuite.test_add_local_named_range2(); }
} testDescription_suite_WorkbookTestSuite_test_add_local_named_range2;
static class TestDescription_suite_WorkbookTestSuite_test_write_regular_date : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_write_regular_date() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 226, "test_write_regular_date" ) {}
void runTest() { suite_WorkbookTestSuite.test_write_regular_date(); }
} testDescription_suite_WorkbookTestSuite_test_write_regular_date;
static class TestDescription_suite_WorkbookTestSuite_test_write_regular_float : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_write_regular_float() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 244, "test_write_regular_float" ) {}
void runTest() { suite_WorkbookTestSuite.test_write_regular_float(); }
} testDescription_suite_WorkbookTestSuite_test_write_regular_float;
static class TestDescription_suite_WorkbookTestSuite_test_bad_encoding2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_bad_encoding2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 261, "test_bad_encoding2" ) {}
void runTest() { suite_WorkbookTestSuite.test_bad_encoding2(); }
} testDescription_suite_WorkbookTestSuite_test_bad_encoding2;
static class TestDescription_suite_WorkbookTestSuite_test_good_encoding2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_good_encoding2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 272, "test_good_encoding2" ) {}
void runTest() { suite_WorkbookTestSuite.test_good_encoding2(); }
} testDescription_suite_WorkbookTestSuite_test_good_encoding2;
static class TestDescription_suite_WorkbookTestSuite_test_add_named_range2 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_add_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 282, "test_add_named_range2" ) {}
void runTest() { suite_WorkbookTestSuite.test_add_named_range2(); }
} testDescription_suite_WorkbookTestSuite_test_add_named_range2;
static class TestDescription_suite_WorkbookTestSuite_test_get_named_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_get_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 292, "test_get_named_range" ) {}
void runTest() { suite_WorkbookTestSuite.test_get_named_range(); }
} testDescription_suite_WorkbookTestSuite_test_get_named_range;
static class TestDescription_suite_WorkbookTestSuite_test_remove_named_range : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_remove_named_range : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_remove_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 302, "test_remove_named_range" ) {} TestDescription_suite_WorkbookTestSuite_test_remove_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 193, "test_remove_named_range" ) {}
void runTest() { suite_WorkbookTestSuite.test_remove_named_range(); } void runTest() { suite_WorkbookTestSuite.test_remove_named_range(); }
} testDescription_suite_WorkbookTestSuite_test_remove_named_range; } testDescription_suite_WorkbookTestSuite_test_remove_named_range;
static class TestDescription_suite_WorkbookTestSuite_test_add_local_named_range : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_add_local_named_range : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_add_local_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 313, "test_add_local_named_range" ) {} TestDescription_suite_WorkbookTestSuite_test_add_local_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 204, "test_add_local_named_range" ) {}
void runTest() { suite_WorkbookTestSuite.test_add_local_named_range(); } void runTest() { suite_WorkbookTestSuite.test_add_local_named_range(); }
} testDescription_suite_WorkbookTestSuite_test_add_local_named_range; } testDescription_suite_WorkbookTestSuite_test_add_local_named_range;
static class TestDescription_suite_WorkbookTestSuite_test_write_regular_date2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_write_regular_date : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_write_regular_date2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 326, "test_write_regular_date2" ) {} TestDescription_suite_WorkbookTestSuite_test_write_regular_date() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 227, "test_write_regular_date" ) {}
void runTest() { suite_WorkbookTestSuite.test_write_regular_date2(); } void runTest() { suite_WorkbookTestSuite.test_write_regular_date(); }
} testDescription_suite_WorkbookTestSuite_test_write_regular_date2; } testDescription_suite_WorkbookTestSuite_test_write_regular_date;
static class TestDescription_suite_WorkbookTestSuite_test_write_regular_float2 : public CxxTest::RealTestDescription { static class TestDescription_suite_WorkbookTestSuite_test_write_regular_float : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorkbookTestSuite_test_write_regular_float2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 344, "test_write_regular_float2" ) {} TestDescription_suite_WorkbookTestSuite_test_write_regular_float() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 245, "test_write_regular_float" ) {}
void runTest() { suite_WorkbookTestSuite.test_write_regular_float2(); } void runTest() { suite_WorkbookTestSuite.test_write_regular_float(); }
} testDescription_suite_WorkbookTestSuite_test_write_regular_float2; } testDescription_suite_WorkbookTestSuite_test_write_regular_float;
static class TestDescription_suite_WorkbookTestSuite_test_bad_encoding : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_bad_encoding() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 363, "test_bad_encoding" ) {}
void runTest() { suite_WorkbookTestSuite.test_bad_encoding(); }
} testDescription_suite_WorkbookTestSuite_test_bad_encoding;
static class TestDescription_suite_WorkbookTestSuite_test_good_encoding : public CxxTest::RealTestDescription {
public:
TestDescription_suite_WorkbookTestSuite_test_good_encoding() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 373, "test_good_encoding" ) {}
void runTest() { suite_WorkbookTestSuite.test_good_encoding(); }
} testDescription_suite_WorkbookTestSuite_test_good_encoding;
#include "/Users/thomas/Development/xlnt/source/tests/WorksheetTestSuite.h" #include "/Users/thomas/Development/xlnt/source/tests/WorksheetTestSuite.h"
@ -1341,19 +1195,19 @@ public:
static class TestDescription_suite_WorksheetTestSuite_test_merge : public CxxTest::RealTestDescription { static class TestDescription_suite_WorksheetTestSuite_test_merge : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorksheetTestSuite_test_merge() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 285, "test_merge" ) {} TestDescription_suite_WorksheetTestSuite_test_merge() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 300, "test_merge" ) {}
void runTest() { suite_WorksheetTestSuite.test_merge(); } void runTest() { suite_WorksheetTestSuite.test_merge(); }
} testDescription_suite_WorksheetTestSuite_test_merge; } testDescription_suite_WorksheetTestSuite_test_merge;
static class TestDescription_suite_WorksheetTestSuite_test_freeze : public CxxTest::RealTestDescription { static class TestDescription_suite_WorksheetTestSuite_test_freeze : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorksheetTestSuite_test_freeze() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 306, "test_freeze" ) {} TestDescription_suite_WorksheetTestSuite_test_freeze() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 335, "test_freeze" ) {}
void runTest() { suite_WorksheetTestSuite.test_freeze(); } void runTest() { suite_WorksheetTestSuite.test_freeze(); }
} testDescription_suite_WorksheetTestSuite_test_freeze; } testDescription_suite_WorksheetTestSuite_test_freeze;
static class TestDescription_suite_WorksheetTestSuite_test_printer_settings : public CxxTest::RealTestDescription { static class TestDescription_suite_WorksheetTestSuite_test_printer_settings : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_WorksheetTestSuite_test_printer_settings() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 323, "test_printer_settings" ) {} TestDescription_suite_WorksheetTestSuite_test_printer_settings() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 352, "test_printer_settings" ) {}
void runTest() { suite_WorksheetTestSuite.test_printer_settings(); } void runTest() { suite_WorksheetTestSuite.test_printer_settings(); }
} testDescription_suite_WorksheetTestSuite_test_printer_settings; } testDescription_suite_WorksheetTestSuite_test_printer_settings;
@ -1499,31 +1353,31 @@ CxxTest::StaticSuiteDescription suiteDescription_ZipFileTestSuite( "ZipFileTestS
static class TestDescription_suite_ZipFileTestSuite_test_existing_package : public CxxTest::RealTestDescription { static class TestDescription_suite_ZipFileTestSuite_test_existing_package : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ZipFileTestSuite_test_existing_package() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 22, "test_existing_package" ) {} TestDescription_suite_ZipFileTestSuite_test_existing_package() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 17, "test_existing_package" ) {}
void runTest() { suite_ZipFileTestSuite.test_existing_package(); } void runTest() { suite_ZipFileTestSuite.test_existing_package(); }
} testDescription_suite_ZipFileTestSuite_test_existing_package; } testDescription_suite_ZipFileTestSuite_test_existing_package;
static class TestDescription_suite_ZipFileTestSuite_test_new_package : public CxxTest::RealTestDescription { static class TestDescription_suite_ZipFileTestSuite_test_new_package : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ZipFileTestSuite_test_new_package() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 28, "test_new_package" ) {} TestDescription_suite_ZipFileTestSuite_test_new_package() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 22, "test_new_package" ) {}
void runTest() { suite_ZipFileTestSuite.test_new_package(); } void runTest() { suite_ZipFileTestSuite.test_new_package(); }
} testDescription_suite_ZipFileTestSuite_test_new_package; } testDescription_suite_ZipFileTestSuite_test_new_package;
static class TestDescription_suite_ZipFileTestSuite_test_read_text : public CxxTest::RealTestDescription { static class TestDescription_suite_ZipFileTestSuite_test_read_text : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ZipFileTestSuite_test_read_text() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 38, "test_read_text" ) {} TestDescription_suite_ZipFileTestSuite_test_read_text() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 30, "test_read_text" ) {}
void runTest() { suite_ZipFileTestSuite.test_read_text(); } void runTest() { suite_ZipFileTestSuite.test_read_text(); }
} testDescription_suite_ZipFileTestSuite_test_read_text; } testDescription_suite_ZipFileTestSuite_test_read_text;
static class TestDescription_suite_ZipFileTestSuite_test_write_text : public CxxTest::RealTestDescription { static class TestDescription_suite_ZipFileTestSuite_test_write_text : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ZipFileTestSuite_test_write_text() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 45, "test_write_text" ) {} TestDescription_suite_ZipFileTestSuite_test_write_text() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 37, "test_write_text" ) {}
void runTest() { suite_ZipFileTestSuite.test_write_text(); } void runTest() { suite_ZipFileTestSuite.test_write_text(); }
} testDescription_suite_ZipFileTestSuite_test_write_text; } testDescription_suite_ZipFileTestSuite_test_write_text;
static class TestDescription_suite_ZipFileTestSuite_test_read_xml : public CxxTest::RealTestDescription { static class TestDescription_suite_ZipFileTestSuite_test_read_xml : public CxxTest::RealTestDescription {
public: public:
TestDescription_suite_ZipFileTestSuite_test_read_xml() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 59, "test_read_xml" ) {} TestDescription_suite_ZipFileTestSuite_test_read_xml() : CxxTest::RealTestDescription( Tests_ZipFileTestSuite, suiteDescription_ZipFileTestSuite, 51, "test_read_xml" ) {}
void runTest() { suite_ZipFileTestSuite.test_read_xml(); } void runTest() { suite_ZipFileTestSuite.test_read_xml(); }
} testDescription_suite_ZipFileTestSuite_test_read_xml; } testDescription_suite_ZipFileTestSuite_test_read_xml;

View File

@ -862,7 +862,17 @@ bool cell::operator==(std::nullptr_t) const
{ {
return root_ == nullptr; return root_ == nullptr;
} }
bool cell::operator==(int comparand) const
{
return root_->type == type::numeric && root_->numeric_value == comparand;
}
bool cell::operator==(double comparand) const
{
return root_->type == type::numeric && root_->numeric_value == comparand;
}
bool cell::operator==(const std::string &comparand) const bool cell::operator==(const std::string &comparand) const
{ {
if(root_->type == type::hyperlink) if(root_->type == type::hyperlink)
@ -886,6 +896,11 @@ bool cell::operator==(const tm &comparand) const
return root_->type == cell::type::date && root_->date_value.tm_hour == comparand.tm_hour; return root_->type == cell::type::date && root_->date_value.tm_hour == comparand.tm_hour;
} }
bool operator==(int comparand, const xlnt::cell &cell)
{
return cell == comparand;
}
bool operator==(const char *comparand, const xlnt::cell &cell) bool operator==(const char *comparand, const xlnt::cell &cell)
{ {
return cell == comparand; return cell == comparand;
@ -964,6 +979,7 @@ cell &cell::operator=(bool value)
return *this; return *this;
} }
cell &cell::operator=(const std::string &value) cell &cell::operator=(const std::string &value)
{ {
root_->type = data_type_for_value(value); root_->type = data_type_for_value(value);
@ -971,8 +987,17 @@ cell &cell::operator=(const std::string &value)
switch(root_->type) switch(root_->type)
{ {
case type::date: case type::date:
{
root_->date_value = std::tm(); root_->date_value = std::tm();
auto split = split_string(value, ':');
root_->date_value.tm_hour = std::stoi(split[0]);
root_->date_value.tm_min = std::stoi(split[1]);
if(split.size() > 2)
{
root_->date_value.tm_sec = std::stoi(split[2]);
}
break; break;
}
case type::formula: case type::formula:
root_->formula_value = value; root_->formula_value = value;
break; break;
@ -1318,7 +1343,14 @@ struct worksheet_struct
std::unordered_map<std::string, xlnt::cell> cell_map_; std::unordered_map<std::string, xlnt::cell> cell_map_;
std::vector<relationship> relationships_; std::vector<relationship> relationships_;
page_setup page_setup_; page_setup page_setup_;
std::string auto_filter_;
margins page_margins_;
}; };
worksheet::worksheet() : root_(nullptr)
{
}
worksheet::worksheet(worksheet_struct *root) : root_(root) worksheet::worksheet(worksheet_struct *root) : root_(root)
{ {
@ -1328,7 +1360,32 @@ worksheet::worksheet(workbook &parent)
{ {
*this = parent.create_sheet(); *this = parent.create_sheet();
} }
margins &worksheet::get_page_margins()
{
return root_->page_margins_;
}
void worksheet::set_auto_filter(const std::string &range_string)
{
root_->auto_filter_ = range_string;
}
std::string worksheet::get_auto_filter() const
{
return root_->auto_filter_;
}
bool worksheet::has_auto_filter() const
{
return root_->auto_filter_ == "";
}
void worksheet::unset_auto_filter()
{
root_->auto_filter_ = "";
}
page_setup &worksheet::get_page_setup() page_setup &worksheet::get_page_setup()
{ {
return root_->page_setup_; return root_->page_setup_;
@ -1746,12 +1803,8 @@ void delete_temporary_file(const std::string &filename)
std::remove(filename.c_str()); std::remove(filename.c_str());
} }
void read_worksheet(worksheet ws, const std::string &content) void read_worksheet(worksheet ws, const pugi::xml_node root_node)
{ {
pugi::xml_document doc;
doc.load(content.c_str());
auto root_node = doc.child("worksheet");
auto dimension_node = root_node.child("dimension"); auto dimension_node = root_node.child("dimension");
std::string dimension = dimension_node.attribute("ref").as_string(); std::string dimension = dimension_node.attribute("ref").as_string();
ws.range(dimension); ws.range(dimension);
@ -1808,8 +1861,8 @@ workbook::workbook(optimized optimized)
{ {
if(!optimized_write_) if(!optimized_write_)
{ {
auto ws = create_sheet(); auto *worksheet = new worksheet_struct(*this, "Sheet1");
ws.set_title("Sheet1"); worksheets_.push_back(worksheet);
} }
} }
@ -1832,7 +1885,7 @@ bool workbook::has_named_range(const std::string &name, xlnt::worksheet ws) cons
{ {
for(auto named_range : named_ranges_) for(auto named_range : named_ranges_)
{ {
if(named_range.first == name && named_range.second.get_parent_worksheet() == ws) if(named_range.first == name && named_range.second.get_scope() == ws)
{ {
return true; return true;
} }
@ -1842,6 +1895,11 @@ bool workbook::has_named_range(const std::string &name, xlnt::worksheet ws) cons
worksheet workbook::create_sheet() worksheet workbook::create_sheet()
{ {
if(optimized_read_)
{
throw std::runtime_error("this is a read-only workbook");
}
std::string title = "Sheet1"; std::string title = "Sheet1";
int index = 1; int index = 1;
while(get_sheet_by_name(title) != nullptr) while(get_sheet_by_name(title) != nullptr)
@ -1852,6 +1910,55 @@ worksheet workbook::create_sheet()
worksheets_.push_back(worksheet); worksheets_.push_back(worksheet);
return get_sheet_by_name(title); return get_sheet_by_name(title);
} }
void workbook::add_sheet(xlnt::worksheet worksheet)
{
if(optimized_read_)
{
throw std::runtime_error("this is a read-only workbook");
}
for(auto ws : *this)
{
if(worksheet == ws)
{
throw std::runtime_error("worksheet already in workbook");
}
}
worksheets_.push_back(worksheet);
}
void workbook::add_sheet(xlnt::worksheet worksheet, std::size_t index)
{
if(optimized_read_)
{
throw std::runtime_error("this is a read-only workbook");
}
for(auto ws : *this)
{
if(worksheet == ws)
{
throw std::runtime_error("worksheet already in workbook");
}
}
worksheets_.push_back(worksheet);
std::swap(worksheets_[index], worksheets_.back());
}
int workbook::get_index(xlnt::worksheet worksheet)
{
int i = 0;
for(auto ws : *this)
{
if(worksheet == ws)
{
return i;
}
i++;
}
throw std::runtime_error("worksheet isn't owned by this workbook");
}
void workbook::create_named_range(const std::string &name, worksheet range_owner, const std::string &range_string) void workbook::create_named_range(const std::string &name, worksheet range_owner, const std::string &range_string)
{ {
@ -1867,17 +1974,94 @@ void workbook::create_named_range(const std::string &name, worksheet range_owner
throw std::runtime_error("worksheet isn't owned by this workbook"); throw std::runtime_error("worksheet isn't owned by this workbook");
} }
void workbook::add_named_range(const std::string &name, named_range named_range)
{
for(auto ws : worksheets_)
{
if(ws == named_range.get_scope())
{
named_ranges_[name] = named_range;
return;
}
}
throw std::runtime_error("worksheet isn't owned by this workbook");
}
std::vector<named_range> workbook::get_named_ranges()
{
std::vector<named_range> named_ranges;
for(auto named_range : named_ranges_)
{
named_ranges.push_back(named_range.second);
}
return named_ranges;
}
void workbook::remove_named_range(named_range named_range)
{
std::string key_match = "";
for(auto r : named_ranges_)
{
if(r.second == named_range)
{
key_match = r.first;
}
}
if(key_match == "")
{
throw std::runtime_error("range not found in worksheet");
}
named_ranges_.erase(key_match);
}
named_range workbook::get_named_range(const std::string &name, worksheet ws) named_range workbook::get_named_range(const std::string &name, worksheet ws)
{ {
for(auto named_range : named_ranges_) for(auto named_range : named_ranges_)
{ {
if(named_range.first == name && named_range.second.get_parent_worksheet() == ws) if(named_range.first == name && named_range.second.get_scope() == ws)
{ {
return named_range.second; return named_range.second;
} }
} }
throw std::runtime_error("doesn't exist"); throw std::runtime_error("doesn't exist");
} }
std::string determine_document_type(const std::unordered_map<std::string, std::pair<std::string, std::string>> &root_relationships,
const std::unordered_map<std::string, std::string> &override_types)
{
auto relationship_match = std::find_if(root_relationships.begin(), root_relationships.end(),
[](const std::pair<std::string, std::pair<std::string, std::string>> &v)
{ return v.second.first == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; });
std::string type;
if(relationship_match != root_relationships.end())
{
std::string office_document_relationship = relationship_match->second.second;
if(office_document_relationship[0] != '/')
{
office_document_relationship = std::string("/") + office_document_relationship;
}
type = override_types.at(office_document_relationship);
}
if(type == "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml")
{
return "excel";
}
else if(type == "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml")
{
return "powerpoint";
}
else if(type == "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")
{
return "word";
}
return "unsupported";
}
void workbook::load(const std::string &filename) void workbook::load(const std::string &filename)
{ {
@ -1885,8 +2069,16 @@ void workbook::load(const std::string &filename)
//auto core_properties = read_core_properties(); //auto core_properties = read_core_properties();
//auto app_properties = read_app_properties(); //auto app_properties = read_app_properties();
auto root_relationships = read_relationships(f.get_file_contents("_rels/.rels")); auto root_relationships = read_relationships(f.get_file_contents("_rels/.rels"));
auto workbook_relationships = read_relationships(f.get_file_contents("xl/_rels/workbook.xml.rels"));
auto content_types = read_content_types(f.get_file_contents("[Content_Types].xml")); auto content_types = read_content_types(f.get_file_contents("[Content_Types].xml"));
auto type = determine_document_type(root_relationships, content_types.second);
if(type != "excel")
{
throw std::runtime_error("unsupported document type: " + filename);
}
auto workbook_relationships = read_relationships(f.get_file_contents("xl/_rels/workbook.xml.rels"));
pugi::xml_document doc; pugi::xml_document doc;
doc.load(f.get_file_contents("xl/workbook.xml").c_str()); doc.load(f.get_file_contents("xl/workbook.xml").c_str());
@ -1905,7 +2097,9 @@ void workbook::load(const std::string &filename)
auto ws = create_sheet(sheet_node.attribute("name").as_string()); auto ws = create_sheet(sheet_node.attribute("name").as_string());
std::string sheet_filename("xl/"); std::string sheet_filename("xl/");
sheet_filename += workbook_relationships[relation_id].second; sheet_filename += workbook_relationships[relation_id].second;
read_worksheet(ws, f.get_file_contents(sheet_filename)); pugi::xml_document doc;
doc.load(f.get_file_contents(sheet_filename).c_str());
read_worksheet(ws, doc.child("worksheet"));
} }
} }
@ -1929,6 +2123,13 @@ worksheet workbook::create_sheet(std::size_t index)
} }
return ws; return ws;
} }
worksheet workbook::create_sheet(std::size_t index, const std::string &title)
{
auto ws = create_sheet(index);
ws.set_title(title);
return ws;
}
worksheet workbook::create_sheet(const std::string &title) worksheet workbook::create_sheet(const std::string &title)
{ {
@ -1938,19 +2139,19 @@ worksheet workbook::create_sheet(const std::string &title)
} }
if(std::find_if(title.begin(), title.end(), if(std::find_if(title.begin(), title.end(),
[](char c) { return !(std::isalpha(c, std::locale::classic()) [](char c) { return c == '*' || c == ':' || c == '/' || c == '\\' || c == '?' || c == '[' || c == ']'; }) != title.end())
|| std::isdigit(c, std::locale::classic())); }) != title.end())
{ {
throw bad_sheet_title(title); throw bad_sheet_title(title);
} }
if(get_sheet_by_name(title) != nullptr) if(get_sheet_by_name(title) != nullptr)
{ {
throw std::runtime_error("sheet exists"); throw std::runtime_error("sheet exists");
} }
auto *worksheet = new worksheet_struct(*this, title); auto *worksheet = new worksheet_struct(*this, title);
worksheets_.push_back(worksheet); worksheets_.push_back(worksheet);
return get_sheet_by_name(title); return xlnt::worksheet(worksheet);
} }
std::vector<worksheet>::iterator workbook::begin() std::vector<worksheet>::iterator workbook::begin()
@ -2177,5 +2378,63 @@ void string_table_builder::add(const std::string &string)
} }
table_.strings_.push_back(string); table_.strings_.push_back(string);
} }
worksheet xlnt::reader::read_worksheet(std::istream &handle, xlnt::workbook &wb, const std::string &title, const std::unordered_map<int, std::string> &)
{
auto ws = wb.create_sheet();
ws.set_title(title);
pugi::xml_document doc;
doc.load(handle);
xlnt::read_worksheet(ws, doc.child("worksheet"));
return ws;
}
std::string xlnt::writer::write_worksheet(xlnt::worksheet ws, const std::unordered_map<std::string, std::string> &string_table)
{
return "";
}
std::string xlnt::writer::write_worksheet(xlnt::worksheet ws)
{
return write_worksheet(ws, std::unordered_map<std::string, std::string>());
}
bool named_range::operator==(const xlnt::named_range &comparand) const
{
return comparand.parent_worksheet_ == parent_worksheet_ && comparand.range_string_ == range_string_;
}
std::string xlnt::writer::write_theme()
{
pugi::xml_document doc;
auto theme_node = doc.append_child("a:theme");
theme_node.append_attribute("xmlns:a").set_value("http://schemas.openxmlformats.org/drawingml/2006/main");
theme_node.append_attribute("name").set_value("Office Theme");
auto theme_elements_node = theme_node.append_child("a:themeElements");
auto clr_scheme_node = theme_elements_node.append_child("a:clrScheme");
clr_scheme_node.append_attribute("name").set_value("Office");
struct scheme_element
{
std::string name;
std::string sub_element_name;
std::string val;
};
std::vector<scheme_element> scheme_elements =
{
{"a:dk1", "a:sysClr", "windowText"}
};
for(auto element : scheme_elements)
{
auto element_node = clr_scheme_node.append_child("a:dk1");
element_node.append_child(element.sub_element_name.c_str()).append_attribute("val").set_value(element.val.c_str());
}
std::stringstream ss;
doc.print(ss);
return ss.str();
}
} }

View File

@ -388,6 +388,20 @@ public:
/// </summary> /// </summary>
static bool exists(const std::string &path); static bool exists(const std::string &path);
}; };
class reader
{
public:
static worksheet read_worksheet(std::istream &handle, workbook &wb, const std::string &title, const std::unordered_map<int, std::string> &);
};
class writer
{
public:
static std::string write_worksheet(worksheet ws);
static std::string write_worksheet(worksheet ws, const std::unordered_map<std::string, std::string> &string_table);
static std::string write_theme();
};
/// <summary> /// <summary>
/// Represents an association between a source Package or part, and a target object which can be a part or external resource. /// Represents an association between a source Package or part, and a target object which can be a part or external resource.
@ -950,10 +964,36 @@ struct page_setup
bool fit_to_height; bool fit_to_height;
bool fit_to_width; bool fit_to_width;
}; };
struct margins
{
public:
double get_top() const { return top_; }
void set_top(double top) { top_ = top; }
double get_left() const { return left_; }
void set_left(double left) { left_ = left; }
double get_bottom() const { return bottom_; }
void set_bottom(double bottom) { bottom_ = bottom; }
double get_right() const { return right_; }
void set_right(double right) { right_ = right; }
double get_header() const { return header_; }
void set_header(double header) { header_ = header; }
double get_footer() const { return footer_; }
void set_footer(double footer) { footer_ = footer; }
private:
double top_;
double left_;
double bottom_;
double right_;
double header_;
double footer_;
};
class worksheet class worksheet
{ {
public: public:
worksheet();
worksheet(workbook &parent); worksheet(workbook &parent);
worksheet(worksheet_struct *root); worksheet(worksheet_struct *root);
@ -993,6 +1033,11 @@ public:
bool operator!=(std::nullptr_t) const; bool operator!=(std::nullptr_t) const;
std::vector<relationship> get_relationships(); std::vector<relationship> get_relationships();
page_setup &get_page_setup(); page_setup &get_page_setup();
margins &get_page_margins();
std::string get_auto_filter() const;
void set_auto_filter(const std::string &range_string);
void unset_auto_filter();
bool has_auto_filter() const;
private: private:
friend class workbook; friend class workbook;
@ -1006,7 +1051,9 @@ public:
named_range() : parent_worksheet_(nullptr), range_string_("") {} named_range() : parent_worksheet_(nullptr), range_string_("") {}
named_range(worksheet ws, const std::string &range_string) : parent_worksheet_(ws), range_string_(range_string) {} named_range(worksheet ws, const std::string &range_string) : parent_worksheet_(ws), range_string_(range_string) {}
std::string get_range_string() const { return range_string_; } std::string get_range_string() const { return range_string_; }
worksheet get_parent_worksheet() { return parent_worksheet_; } worksheet get_scope() const { return parent_worksheet_; }
void set_scope(worksheet scope) { parent_worksheet_ = scope; }
bool operator==(const named_range &comparand) const;
private: private:
worksheet parent_worksheet_; worksheet parent_worksheet_;
@ -1080,7 +1127,7 @@ public:
//named ranges //named ranges
void create_named_range(const std::string &name, worksheet worksheet, const std::string &range_string); void create_named_range(const std::string &name, worksheet worksheet, const std::string &range_string);
std::vector<named_range> get_named_ranges(); std::vector<named_range> get_named_ranges();
void add_named_range(named_range named_range); void add_named_range(const std::string &name, named_range named_range);
bool has_named_range(const std::string &name, worksheet ws) const; bool has_named_range(const std::string &name, worksheet ws) const;
named_range get_named_range(const std::string &name, worksheet ws); named_range get_named_range(const std::string &name, worksheet ws);
void remove_named_range(named_range named_range); void remove_named_range(named_range named_range);