mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
enable more tests
This commit is contained in:
parent
d80ba60b31
commit
99d609ce3a
|
@ -90,7 +90,7 @@ public:
|
|||
void test_initial_value()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1, "17.5");
|
||||
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
|
@ -99,7 +99,7 @@ public:
|
|||
void test_null()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::null, cell.get_data_type());
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
void test_numeric()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1, "17.5");
|
||||
|
||||
cell = 42;
|
||||
|
@ -140,7 +140,7 @@ public:
|
|||
void test_string()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
cell = "hello";
|
||||
|
@ -150,7 +150,7 @@ public:
|
|||
void test_single_dot()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
cell = ".";
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::string, cell.get_data_type());
|
||||
|
@ -159,7 +159,7 @@ public:
|
|||
void test_formula()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
cell = "=42";
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::formula, cell.get_data_type());
|
||||
|
@ -168,7 +168,7 @@ public:
|
|||
void test_boolean()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
cell = true;
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::boolean, cell.get_data_type());
|
||||
|
@ -179,86 +179,80 @@ public:
|
|||
void test_leading_zero()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
cell = "0800";
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::string, cell.get_data_type());
|
||||
}
|
||||
|
||||
void check_error()
|
||||
void test_error_codes()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::error, cell.get_data_type());
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
//for(error_string in cell.ERROR_CODES.keys())
|
||||
//{
|
||||
// cell.value = error_string;
|
||||
// yield check_error;
|
||||
//}
|
||||
for(auto error : xlnt::cell::ErrorCodes)
|
||||
{
|
||||
cell = error.first;
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::error, cell.get_data_type());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void test_data_type_check()
|
||||
{
|
||||
//xlnt::workbook wb;
|
||||
//xlnt::worksheet ws(wb);
|
||||
//xlnt::cell cell(ws, "A", 1);
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
//cell.bind_value(xlnt::cell::$);
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::null, cell.get_data_type());
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::null, cell.get_data_type());
|
||||
|
||||
//cell.bind_value(".0e000");
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
cell.bind_value(".0e000");
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
|
||||
//cell.bind_value("-0.e-0");
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
cell.bind_value("-0.e-0");
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
|
||||
//cell.bind_value("1E");
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::string, cell.get_data_type());
|
||||
cell.bind_value("1E");
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::string, cell.get_data_type());
|
||||
}
|
||||
|
||||
void test_set_bad_type()
|
||||
{
|
||||
//xlnt::workbook wb;
|
||||
//xlnt::worksheet ws(wb);
|
||||
//xlnt::cell cell(ws, "A", 1);
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
//cell.set_value_explicit(1, "q");
|
||||
cell.set_explicit_value("1", xlnt::cell::type::formula);
|
||||
}
|
||||
|
||||
|
||||
void test_time()
|
||||
{
|
||||
//auto check_time = [](raw_value, coerced_value)
|
||||
//{
|
||||
// cell.value = raw_value
|
||||
// TS_ASSERT_EQUALS(cell.value, coerced_value)
|
||||
// TS_ASSERT_EQUALS(cell.TYPE_NUMERIC, cell.data_type)
|
||||
//};
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
//xlnt::workbook wb;
|
||||
//xlnt::worksheet ws(wb);
|
||||
//xlnt::cell cell(ws, "A", 1);
|
||||
cell = "03:40:16";
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
tm expected1;
|
||||
expected1.tm_hour = 3;
|
||||
expected1.tm_min = 40;
|
||||
expected1.tm_sec = 16;
|
||||
TS_ASSERT(cell == expected1);
|
||||
|
||||
//cell = "03:40:16";
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
//tm expected;
|
||||
//expected.tm_hour = 3;
|
||||
//expected.tm_min = 40;
|
||||
//expected.tm_sec = 16;
|
||||
//TS_ASSERT_EQUALS(cell, expected);
|
||||
|
||||
//cell = "03:40";
|
||||
//TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
//tm expected;
|
||||
//expected.tm_hour = 3;
|
||||
//expected.tm_min = 40;
|
||||
//TS_ASSERT_EQUALS(cell, expected);
|
||||
cell = "03:40";
|
||||
TS_ASSERT_EQUALS(xlnt::cell::type::numeric, cell.get_data_type());
|
||||
tm expected2;
|
||||
expected2.tm_hour = 3;
|
||||
expected2.tm_min = 40;
|
||||
TS_ASSERT(cell == expected1);
|
||||
}
|
||||
|
||||
void test_date_format_on_non_date()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
time_t t = time(0);
|
||||
|
@ -279,7 +273,7 @@ public:
|
|||
today.tm_sec = 20;
|
||||
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
cell = today;
|
||||
|
@ -289,7 +283,7 @@ public:
|
|||
void test_repr()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
TS_ASSERT_EQUALS(cell.to_string(), "<Cell Sheet1.A1>");
|
||||
|
@ -298,7 +292,7 @@ public:
|
|||
void test_is_date()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active();
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
time_t t = time(0);
|
||||
|
@ -314,13 +308,13 @@ public:
|
|||
|
||||
void test_is_not_date_color_format()
|
||||
{
|
||||
//xlnt::workbook wb;
|
||||
//xlnt::worksheet ws(wb);
|
||||
//xlnt::cell cell(ws, "A", 1);
|
||||
xlnt::workbook wb;
|
||||
xlnt::worksheet ws = wb.get_active_sheet();
|
||||
xlnt::cell cell(ws, "A", 1);
|
||||
|
||||
//cell = -13.5;
|
||||
//cell.get_style().get_number_format().set_format_code("0.00_);[Red]\(0.00\)");
|
||||
cell = -13.5;
|
||||
cell.get_style().get_number_format().set_format_code("0.00_);[Red]\(0.00\)");
|
||||
|
||||
//TS_ASSERT_EQUALS(cell.is_date(), false);
|
||||
TS_ASSERT_EQUALS(cell.is_date(), false);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,27 +15,27 @@ public:
|
|||
|
||||
void _get_test_filename()
|
||||
{
|
||||
/*test_file = NamedTemporaryFile(mode = "w", prefix = "openpyxl.", suffix = ".xlsx", delete = False);
|
||||
NamedTemporaryFile test_file("w", "xlnt.", ".xlsx", false);
|
||||
test_file.close();
|
||||
return test_file.name;*/
|
||||
return test_file.name;
|
||||
}
|
||||
|
||||
//_COL_CONVERSION_CACHE = dict((get_column_letter(i), i) for i in range(1, 18279));
|
||||
_COL_CONVERSION_CACHE = dict((get_column_letter(i), i) for i in range(1, 18279));
|
||||
|
||||
void test_dump_sheet_title()
|
||||
{
|
||||
/*test_filename = _get_test_filename();
|
||||
test_filename = _get_test_filename();
|
||||
wb = Workbook(optimized_write = True);
|
||||
ws = wb.create_sheet(title = "Test1");
|
||||
wb.save(test_filename);
|
||||
wb2 = load_workbook(test_filename, True);
|
||||
ws = wb2.get_sheet_by_name("Test1");
|
||||
TS_ASSERT_EQUALS("Test1", ws.title);*/
|
||||
TS_ASSERT_EQUALS("Test1", ws.title);
|
||||
}
|
||||
|
||||
void test_dump_sheet()
|
||||
{
|
||||
/*test_filename = _get_test_filename();
|
||||
test_filename = _get_test_filename();
|
||||
wb = Workbook(optimized_write = True);
|
||||
ws = wb.create_sheet();
|
||||
letters = [get_column_letter(x + 1) for x in range(20)];
|
||||
|
@ -43,116 +43,116 @@ public:
|
|||
for(auto row : range(20))
|
||||
{
|
||||
expected_rows.append(["%s%d" % (letter, row + 1) for letter in letters]);
|
||||
for row in range(20)
|
||||
for(auto row in range(20))
|
||||
{
|
||||
expected_rows.append([(row + 1) for letter in letters]);
|
||||
for row in range(10)
|
||||
for(auto row in range(10))
|
||||
{
|
||||
expected_rows.append([datetime(2010, ((x % 12) + 1), row + 1) for x in range(len(letters))]);
|
||||
for row in range(20)
|
||||
for(auto row in range(20))
|
||||
{
|
||||
expected_rows.append(["=%s%d" % (letter, row + 1) for letter in letters]);
|
||||
for row in expected_rows
|
||||
for(auto row in expected_rows)
|
||||
{
|
||||
ws.append(row);
|
||||
}
|
||||
|
||||
wb.save(test_filename);
|
||||
wb2 = load_workbook(test_filename, True)
|
||||
wb2 = load_workbook(test_filename, True);
|
||||
}
|
||||
|
||||
ws = wb2.worksheets[0]
|
||||
ws = wb2.worksheets[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ex_row, ws_row in zip(expected_rows[:-20], ws.iter_rows())
|
||||
for(auto ex_row, ws_row : zip(expected_rows[:-20], ws.iter_rows()))
|
||||
{
|
||||
for ex_cell, ws_cell in zip(ex_row, ws_row)
|
||||
for(auto ex_cell, ws_cell : zip(ex_row, ws_row))
|
||||
{
|
||||
TS_ASSERT_EQUALS(ex_cell, ws_cell.internal_value)
|
||||
TS_ASSERT_EQUALS(ex_cell, ws_cell.internal_value);
|
||||
|
||||
os.remove(test_filename)
|
||||
os.remove(test_filename);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void test_table_builder()
|
||||
{
|
||||
//sb = StringTableBuilder()
|
||||
sb = StringTableBuilder();
|
||||
|
||||
// result = {"a":0, "b" : 1, "c" : 2, "d" : 3}
|
||||
result = {"a":0, "b" : 1, "c" : 2, "d" : 3};
|
||||
|
||||
// for letter in sorted(result.keys())
|
||||
// {
|
||||
// for x in range(5)
|
||||
// {
|
||||
// sb.add(letter)
|
||||
for(auto letter in sorted(result.keys()))
|
||||
{
|
||||
for x in range(5)
|
||||
{
|
||||
sb.add(letter)
|
||||
|
||||
// table = dict(sb.get_table())
|
||||
table = dict(sb.get_table())
|
||||
|
||||
// try
|
||||
// {
|
||||
// result_items = result.items()
|
||||
// }
|
||||
try
|
||||
{
|
||||
result_items = result.items()
|
||||
}
|
||||
|
||||
// for key, idx in result_items
|
||||
// {
|
||||
// TS_ASSERT_EQUALS(idx, table[key])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
for key, idx in result_items
|
||||
{
|
||||
TS_ASSERT_EQUALS(idx, table[key])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void test_open_too_many_files()
|
||||
{
|
||||
//test_filename = _get_test_filename();
|
||||
//wb = Workbook(optimized_write = True);
|
||||
test_filename = _get_test_filename();
|
||||
wb = Workbook(optimized_write = True);
|
||||
|
||||
//for i in range(200) // over 200 worksheets should raise an OSError("too many open files")
|
||||
//{
|
||||
// wb.create_sheet();
|
||||
// wb.save(test_filename);
|
||||
// os.remove(test_filename);
|
||||
//}
|
||||
for i in range(200) over 200 worksheets should raise an OSError("too many open files")
|
||||
{
|
||||
wb.create_sheet();
|
||||
wb.save(test_filename);
|
||||
os.remove(test_filename);
|
||||
}
|
||||
}
|
||||
|
||||
void test_create_temp_file()
|
||||
{
|
||||
//f = dump_worksheet.create_temporary_file();
|
||||
f = dump_worksheet.create_temporary_file();
|
||||
|
||||
//if(!osp.isfile(f))
|
||||
//{
|
||||
// raise Exception("The file %s does not exist" % f)
|
||||
//}
|
||||
if(!osp.isfile(f))
|
||||
{
|
||||
raise Exception("The file %s does not exist" % f)
|
||||
}
|
||||
}
|
||||
|
||||
void test_dump_twice()
|
||||
{
|
||||
//test_filename = _get_test_filename();
|
||||
test_filename = _get_test_filename();
|
||||
|
||||
//wb = Workbook(optimized_write = True);
|
||||
//ws = wb.create_sheet();
|
||||
//ws.append(["hello"]);
|
||||
wb = Workbook(optimized_write = True);
|
||||
ws = wb.create_sheet();
|
||||
ws.append(["hello"]);
|
||||
|
||||
//wb.save(test_filename);
|
||||
//os.remove(test_filename);
|
||||
wb.save(test_filename);
|
||||
os.remove(test_filename);
|
||||
|
||||
//wb.save(test_filename);
|
||||
wb.save(test_filename);
|
||||
}
|
||||
|
||||
void test_append_after_save()
|
||||
{
|
||||
//test_filename = _get_test_filename();
|
||||
test_filename = _get_test_filename();
|
||||
|
||||
//wb = Workbook(optimized_write = True);
|
||||
//ws = wb.create_sheet();
|
||||
//ws.append(["hello"]);
|
||||
wb = Workbook(optimized_write = True);
|
||||
ws = wb.create_sheet();
|
||||
ws.append(["hello"]);
|
||||
|
||||
//wb.save(test_filename);
|
||||
//os.remove(test_filename);
|
||||
wb.save(test_filename);
|
||||
os.remove(test_filename);
|
||||
|
||||
//ws.append(["hello"]);
|
||||
ws.append(["hello"]);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <cxxtest/TestSuite.h>
|
||||
|
||||
#include "../xlnt.h"
|
||||
|
||||
class IntegrationTestSuite : public CxxTest::TestSuite
|
||||
{
|
||||
public:
|
||||
IntegrationTestSuite()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void test_1()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
auto ws = wb.get_active();
|
||||
auto ws1 = wb.create_sheet();
|
||||
auto ws2 = wb.create_sheet(0);
|
||||
ws.set_title("New Title");
|
||||
auto ws3 = wb["New Title"];
|
||||
auto ws4 = wb.get_sheet_by_name("New Title");
|
||||
TS_ASSERT_EQUALS(ws, ws3);
|
||||
TS_ASSERT_EQUALS(ws, ws4);
|
||||
TS_ASSERT_EQUALS(ws3, ws4);
|
||||
auto sheet_names = wb.get_sheet_names();
|
||||
for(auto sheet : wb)
|
||||
{
|
||||
std::cout << sheet.get_title() << std::endl;
|
||||
}
|
||||
|
||||
//auto cell_range = ws["A1:C2"];
|
||||
|
||||
/* auto c = ws["A4"];
|
||||
ws["A4"] = 4;
|
||||
auto d = ws.cell(4, 2);
|
||||
c = "hello, world";
|
||||
std::cout << c << std::endl;
|
||||
d = 3.14;
|
||||
std::cout << d << std::endl;
|
||||
|
||||
wb.save("balances.xlsx");*/
|
||||
}
|
||||
};
|
|
@ -20,80 +20,80 @@ public:
|
|||
|
||||
void test_get_dimensions()
|
||||
{
|
||||
//expected = ["A1:G5", "D1:K30", "D2:D2", "A1:C1"];
|
||||
expected = ["A1:G5", "D1:K30", "D2:D2", "A1:C1"];
|
||||
|
||||
//wb = _open_wb();
|
||||
//for i, sheetn in enumerate(wb.get_sheet_names())
|
||||
//{
|
||||
// ws = wb.get_sheet_by_name(name = sheetn);
|
||||
// TS_ASSERT_EQUALS(ws._dimensions, expected[i]);
|
||||
//}
|
||||
wb = _open_wb();
|
||||
for i, sheetn in 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()
|
||||
{
|
||||
//sheet_name = "Sheet1 - Text"
|
||||
sheet_name = "Sheet1 - Text"
|
||||
|
||||
// expected = [["This is cell A1 in Sheet 1", None, None, None, None, None, None],
|
||||
// [None, None, None, None, None, None, None],
|
||||
// [None, None, None, None, None, None, None],
|
||||
// [None, None, None, None, None, None, None],
|
||||
// [None, None, None, None, None, None, "This is cell G5"], ]
|
||||
expected = [["This is cell A1 in Sheet 1", None, None, None, None, None, None],
|
||||
[None, None, None, None, None, None, None],
|
||||
[None, None, None, None, None, None, None],
|
||||
[None, None, None, None, None, None, None],
|
||||
[None, None, None, None, None, None, "This is cell G5"], ]
|
||||
|
||||
// wb = load_workbook(filename = workbook_name, use_iterators = True)
|
||||
// ws = wb.get_sheet_by_name(name = sheet_name)
|
||||
wb = load_workbook(filename = workbook_name, use_iterators = True)
|
||||
ws = wb.get_sheet_by_name(name = sheet_name)
|
||||
|
||||
// for row, expected_row in zip(ws.iter_rows(), expected) :
|
||||
for row, expected_row in zip(ws.iter_rows(), expected) :
|
||||
|
||||
// row_values = [x.internal_value for x in row]
|
||||
row_values = [x.internal_value for x in row]
|
||||
|
||||
// TS_ASSERT_EQUALS(row_values, expected_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))
|
||||
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))
|
||||
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)
|
||||
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)
|
||||
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"
|
||||
sheet_name = "Sheet2 - Numbers"
|
||||
|
||||
// expected = [[x + 1] for x in range(30)]
|
||||
expected = [[x + 1] for x in range(30)]
|
||||
|
||||
// query_range = "D1:E30"
|
||||
query_range = "D1:E30"
|
||||
|
||||
// wb = load_workbook(filename = workbook_name, use_iterators = True)
|
||||
// ws = wb.get_sheet_by_name(name = sheet_name)
|
||||
wb = load_workbook(filename = workbook_name, use_iterators = True)
|
||||
ws = wb.get_sheet_by_name(name = sheet_name)
|
||||
|
||||
// for row, expected_row in zip(ws.iter_rows(query_range), expected) :
|
||||
for row, expected_row in zip(ws.iter_rows(query_range), expected) :
|
||||
|
||||
// row_values = [x.internal_value for x in row]
|
||||
row_values = [x.internal_value for x in row]
|
||||
|
||||
// TS_ASSERT_EQUALS(row_values, expected_row)
|
||||
TS_ASSERT_EQUALS(row_values, expected_row)
|
||||
}
|
||||
|
||||
void test_read_single_cell_date()
|
||||
{
|
||||
//sheet_name = "Sheet4 - Dates"
|
||||
sheet_name = "Sheet4 - Dates"
|
||||
|
||||
// wb = load_workbook(filename = workbook_name, use_iterators = True)
|
||||
// ws = wb.get_sheet_by_name(name = sheet_name)
|
||||
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)
|
||||
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)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,20 +15,20 @@ public:
|
|||
|
||||
void test_write_content_types()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//wb.create_sheet();
|
||||
//wb.create_sheet();
|
||||
//content = write_content_types(wb);
|
||||
//reference_file = os.path.join(DATADIR, "writer", "expected",
|
||||
// "[Content_Types].xml");
|
||||
//assert_equals_file_content(reference_file, content);
|
||||
wb = Workbook();
|
||||
wb.create_sheet();
|
||||
wb.create_sheet();
|
||||
content = write_content_types(wb);
|
||||
reference_file = os.path.join(DATADIR, "writer", "expected",
|
||||
"[Content_Types].xml");
|
||||
assert_equals_file_content(reference_file, content);
|
||||
}
|
||||
|
||||
void test_write_root_rels()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//content = write_root_rels(wb);
|
||||
//reference_file = os.path.join(DATADIR, "writer", "expected", ".rels");
|
||||
//assert_equals_file_content(reference_file, content);
|
||||
wb = Workbook();
|
||||
content = write_root_rels(wb);
|
||||
reference_file = os.path.join(DATADIR, "writer", "expected", ".rels");
|
||||
assert_equals_file_content(reference_file, content);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,153 +13,153 @@ public:
|
|||
|
||||
}
|
||||
|
||||
//void setup_class(cls)
|
||||
//{
|
||||
// //cls.workbook = Workbook()
|
||||
// // cls.worksheet = Worksheet(cls.workbook, "Test")
|
||||
// // cls.sd = SharedDate()
|
||||
//}
|
||||
void setup_class(cls)
|
||||
{
|
||||
cls.workbook = Workbook()
|
||||
cls.worksheet = Worksheet(cls.workbook, "Test")
|
||||
cls.sd = SharedDate()
|
||||
}
|
||||
|
||||
void test_convert_date_to_julian()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(40167, sd.to_julian(2009, 12, 20))
|
||||
TS_ASSERT_EQUALS(40167, sd.to_julian(2009, 12, 20))
|
||||
}
|
||||
|
||||
void test_convert_date_from_julian()
|
||||
{
|
||||
}
|
||||
|
||||
//void test_date_equal(julian, datetime)
|
||||
//{
|
||||
// //TS_ASSERT_EQUALS(sd.from_julian(julian), datetime);
|
||||
void test_date_equal(julian, datetime)
|
||||
{
|
||||
TS_ASSERT_EQUALS(sd.from_julian(julian), datetime);
|
||||
|
||||
// //date_pairs = (
|
||||
// // (40167, datetime(2009, 12, 20)),
|
||||
// // (21980, datetime(1960, 3, 5)),
|
||||
// // );
|
||||
date_pairs = (
|
||||
(40167, datetime(2009, 12, 20)),
|
||||
(21980, datetime(1960, 3, 5)),
|
||||
);
|
||||
|
||||
// //for count, dt in date_pairs
|
||||
// //{
|
||||
// // yield test_date_equal, count, dt;
|
||||
// //}
|
||||
//}
|
||||
for count, dt in date_pairs
|
||||
{
|
||||
yield test_date_equal, count, dt;
|
||||
}
|
||||
}
|
||||
|
||||
void test_convert_datetime_to_julian()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(40167, sd.datetime_to_julian(datetime(2009, 12, 20)))
|
||||
// TS_ASSERT_EQUALS(40196.5939815, sd.datetime_to_julian(datetime(2010, 1, 18, 14, 15, 20, 1600)))
|
||||
TS_ASSERT_EQUALS(40167, sd.datetime_to_julian(datetime(2009, 12, 20)))
|
||||
TS_ASSERT_EQUALS(40196.5939815, sd.datetime_to_julian(datetime(2010, 1, 18, 14, 15, 20, 1600)))
|
||||
}
|
||||
|
||||
void test_insert_float()
|
||||
{
|
||||
//worksheet.cell("A1").value = 3.14
|
||||
// TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
worksheet.cell("A1").value = 3.14
|
||||
TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
}
|
||||
|
||||
void test_insert_percentage()
|
||||
{
|
||||
//worksheet.cell("A1").value = "3.14%"
|
||||
// TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
// assert_almost_equal(0.0314, worksheet.cell("A1").value)
|
||||
worksheet.cell("A1").value = "3.14%"
|
||||
TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
assert_almost_equal(0.0314, worksheet.cell("A1").value)
|
||||
}
|
||||
|
||||
void test_insert_datetime()
|
||||
{
|
||||
//worksheet.cell("A1").value = date.today()
|
||||
// TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
worksheet.cell("A1").value = date.today()
|
||||
TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
}
|
||||
|
||||
void test_insert_date()
|
||||
{
|
||||
//worksheet.cell("A1").value = datetime.now()
|
||||
// TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
worksheet.cell("A1").value = datetime.now()
|
||||
TS_ASSERT_EQUALS(Cell.TYPE_NUMERIC, worksheet.cell("A1")._data_type)
|
||||
}
|
||||
|
||||
void test_internal_date()
|
||||
{
|
||||
//dt = datetime(2010, 7, 13, 6, 37, 41)
|
||||
// worksheet.cell("A3").value = dt
|
||||
// TS_ASSERT_EQUALS(40372.27616898148, worksheet.cell("A3")._value)
|
||||
dt = datetime(2010, 7, 13, 6, 37, 41)
|
||||
worksheet.cell("A3").value = dt
|
||||
TS_ASSERT_EQUALS(40372.27616898148, worksheet.cell("A3")._value)
|
||||
}
|
||||
|
||||
void test_datetime_interpretation()
|
||||
{
|
||||
//dt = datetime(2010, 7, 13, 6, 37, 41)
|
||||
// worksheet.cell("A3").value = dt
|
||||
// TS_ASSERT_EQUALS(dt, worksheet.cell("A3").value)
|
||||
dt = datetime(2010, 7, 13, 6, 37, 41)
|
||||
worksheet.cell("A3").value = dt
|
||||
TS_ASSERT_EQUALS(dt, worksheet.cell("A3").value)
|
||||
}
|
||||
|
||||
void test_date_interpretation()
|
||||
{
|
||||
//dt = date(2010, 7, 13)
|
||||
// worksheet.cell("A3").value = dt
|
||||
// TS_ASSERT_EQUALS(datetime(2010, 7, 13, 0, 0), worksheet.cell("A3").value)
|
||||
dt = date(2010, 7, 13)
|
||||
worksheet.cell("A3").value = dt
|
||||
TS_ASSERT_EQUALS(datetime(2010, 7, 13, 0, 0), worksheet.cell("A3").value)
|
||||
}
|
||||
|
||||
void test_number_format_style()
|
||||
{
|
||||
//worksheet.cell("A1").value = "12.6%"
|
||||
// TS_ASSERT_EQUALS(NumberFormat.FORMAT_PERCENTAGE, \
|
||||
// worksheet.cell("A1").style.number_format.format_code)
|
||||
worksheet.cell("A1").value = "12.6%"
|
||||
TS_ASSERT_EQUALS(NumberFormat.FORMAT_PERCENTAGE, \
|
||||
worksheet.cell("A1").style.number_format.format_code)
|
||||
}
|
||||
|
||||
void test_date_format_on_non_date()
|
||||
{
|
||||
//cell = worksheet.cell("A1");
|
||||
cell = worksheet.cell("A1");
|
||||
}
|
||||
|
||||
//void check_date_pair(count, date_string)
|
||||
//{
|
||||
// //cell.value = strptime(date_string, "%Y-%m-%d");
|
||||
// //TS_ASSERT_EQUALS(count, cell._value);
|
||||
void check_date_pair(count, date_string)
|
||||
{
|
||||
cell.value = strptime(date_string, "%Y-%m-%d");
|
||||
TS_ASSERT_EQUALS(count, cell._value);
|
||||
|
||||
// //date_pairs = (
|
||||
// // (15, "1900-01-15"),
|
||||
// // (59, "1900-02-28"),
|
||||
// // (61, "1900-03-01"),
|
||||
// // (367, "1901-01-01"),
|
||||
// // (2958465, "9999-12-31"), );
|
||||
// //for count, date_string in date_pairs
|
||||
// //{
|
||||
// // yield check_date_pair, count, date_string;
|
||||
// //}
|
||||
//}
|
||||
date_pairs = (
|
||||
(15, "1900-01-15"),
|
||||
(59, "1900-02-28"),
|
||||
(61, "1900-03-01"),
|
||||
(367, "1901-01-01"),
|
||||
(2958465, "9999-12-31"), );
|
||||
for count, date_string in date_pairs
|
||||
{
|
||||
yield check_date_pair, count, date_string;
|
||||
}
|
||||
}
|
||||
|
||||
void test_1900_leap_year()
|
||||
{
|
||||
//assert_raises(ValueError, sd.from_julian, 60)
|
||||
// assert_raises(ValueError, sd.to_julian, 1900, 2, 29)
|
||||
assert_raises(ValueError, sd.from_julian, 60)
|
||||
assert_raises(ValueError, sd.to_julian, 1900, 2, 29)
|
||||
}
|
||||
|
||||
void test_bad_date()
|
||||
{
|
||||
//void check_bad_date(year, month, day)
|
||||
//{
|
||||
// assert_raises(ValueError, sd.to_julian, year, month, day)
|
||||
//}
|
||||
void check_bad_date(year, month, day)
|
||||
{
|
||||
assert_raises(ValueError, sd.to_julian, year, month, day)
|
||||
}
|
||||
|
||||
//bad_dates = ((1776, 7, 4), (1899, 12, 31), )
|
||||
// for year, month, day in bad_dates
|
||||
// {
|
||||
// yield check_bad_date, year, month, day
|
||||
// }
|
||||
bad_dates = ((1776, 7, 4), (1899, 12, 31), )
|
||||
for year, month, day in bad_dates
|
||||
{
|
||||
yield check_bad_date, year, month, day
|
||||
}
|
||||
}
|
||||
|
||||
void test_bad_julian_date()
|
||||
{
|
||||
//assert_raises(ValueError, sd.from_julian, -1)
|
||||
assert_raises(ValueError, sd.from_julian, -1)
|
||||
}
|
||||
|
||||
void test_mac_date()
|
||||
{
|
||||
//sd.excel_base_date = CALENDAR_MAC_1904
|
||||
sd.excel_base_date = CALENDAR_MAC_1904
|
||||
|
||||
// datetuple = (2011, 10, 31)
|
||||
datetuple = (2011, 10, 31)
|
||||
|
||||
// dt = date(datetuple[0], datetuple[1], datetuple[2])
|
||||
// julian = sd.to_julian(datetuple[0], datetuple[1], datetuple[2])
|
||||
// reverse = sd.from_julian(julian).date()
|
||||
// TS_ASSERT_EQUALS(dt, reverse)
|
||||
// sd.excel_base_date = CALENDAR_WINDOWS_1900
|
||||
dt = date(datetuple[0], datetuple[1], datetuple[2])
|
||||
julian = sd.to_julian(datetuple[0], datetuple[1], datetuple[2])
|
||||
reverse = sd.from_julian(julian).date()
|
||||
TS_ASSERT_EQUALS(dt, reverse)
|
||||
sd.excel_base_date = CALENDAR_WINDOWS_1900
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,13 +10,35 @@ class PackageTestSuite : public CxxTest::TestSuite
|
|||
public:
|
||||
PackageTestSuite()
|
||||
{
|
||||
xlnt::file::copy("source/tests/test_data/packaging/test.zip", "source/tests/test_data/packaging/a.zip", true);
|
||||
template_zip = "../../source/tests/test_data/packaging/test.zip";
|
||||
test_zip = "../../source/tests/test_data/packaging/a.zip";
|
||||
existing_xlsx = "../../source/tests/test_data/packaging/existing.xlsx";
|
||||
new_xlsx = "../../source/tests/test_data/packaging/new.xlsx";
|
||||
|
||||
xlnt::file::copy(template_zip, test_zip, true);
|
||||
}
|
||||
|
||||
void test_existing_package()
|
||||
{
|
||||
//xlnt::package package;
|
||||
//package.open(existing_xlsx, xlnt::file_mode::Open, xlnt::file_access::Read);
|
||||
}
|
||||
|
||||
void test_new_package()
|
||||
{
|
||||
xlnt::package package;
|
||||
package.open(new_xlsx, xlnt::file_mode::Create, xlnt::file_access::ReadWrite);
|
||||
|
||||
//auto part_1 = package.create_part("workbook.xml", "type");
|
||||
//TS_ASSERT_DIFFERS(part_1, nullptr);
|
||||
|
||||
//part_1.write("test");
|
||||
}
|
||||
|
||||
void test_read_text()
|
||||
{
|
||||
auto package = xlnt::package::open("source/tests/test_data/packaging/a.zip", xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
TS_ASSERT_DIFFERS(package, nullptr);
|
||||
xlnt::package package;
|
||||
package.open(test_zip, xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
|
||||
auto part_1 = package.get_part("a.txt");
|
||||
TS_ASSERT_DIFFERS(part_1, nullptr);
|
||||
|
@ -28,8 +50,8 @@ public:
|
|||
void test_write_text()
|
||||
{
|
||||
{
|
||||
auto package = xlnt::package::open("source/tests/test_data/packaging/a.zip", xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
TS_ASSERT_DIFFERS(package, nullptr);
|
||||
xlnt::package package;
|
||||
package.open(test_zip, xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
|
||||
auto part_1 = package.get_part("a.txt");
|
||||
TS_ASSERT_DIFFERS(part_1, nullptr);
|
||||
|
@ -38,8 +60,8 @@ public:
|
|||
}
|
||||
|
||||
{
|
||||
auto package = xlnt::package::open("source/tests/test_data/packaging/a.zip", xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
TS_ASSERT_DIFFERS(package, nullptr);
|
||||
xlnt::package package;
|
||||
package.open(test_zip, xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
|
||||
auto part_1 = package.get_part("a.txt");
|
||||
TS_ASSERT_DIFFERS(part_1, nullptr);
|
||||
|
@ -52,8 +74,8 @@ public:
|
|||
|
||||
void test_read_xml()
|
||||
{
|
||||
auto package = xlnt::package::open("source/tests/test_data/packaging/a.zip", xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
TS_ASSERT_DIFFERS(package, nullptr);
|
||||
xlnt::package package;
|
||||
package.open(test_zip, xlnt::file_mode::Open, xlnt::file_access::ReadWrite);
|
||||
|
||||
auto part_2 = package.get_part("a.xml");
|
||||
TS_ASSERT_DIFFERS(part_2, nullptr);
|
||||
|
@ -77,4 +99,10 @@ public:
|
|||
|
||||
TS_ASSERT_EQUALS(std::string(element_element.text().as_string()), "Text")
|
||||
}
|
||||
|
||||
private:
|
||||
std::string template_zip;
|
||||
std::string test_zip;
|
||||
std::string existing_xlsx;
|
||||
std::string new_xlsx;
|
||||
};
|
||||
|
|
|
@ -15,13 +15,13 @@ public:
|
|||
|
||||
void test_hasher()
|
||||
{
|
||||
//TS_ASSERT_EQUALS("CBEB", hash_password("test"));
|
||||
TS_ASSERT_EQUALS("CBEB", hash_password("test"));
|
||||
}
|
||||
|
||||
void test_sheet_protection()
|
||||
{
|
||||
//protection = SheetProtection();
|
||||
//protection.password = "test";
|
||||
//TS_ASSERT_EQUALS("CBEB", protection.password);
|
||||
protection = SheetProtection();
|
||||
protection.password = "test";
|
||||
TS_ASSERT_EQUALS("CBEB", protection.password);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -18,99 +18,99 @@ public:
|
|||
|
||||
}
|
||||
|
||||
//class TestReaderProps
|
||||
//{
|
||||
// void setup_class(cls)
|
||||
// {
|
||||
// cls.genuine_filename = os.path.join(DATADIR, "genuine", "empty.xlsx");
|
||||
// cls.archive = ZipFile(cls.genuine_filename, "r", ZIP_DEFLATED);
|
||||
// }
|
||||
class TestReaderProps
|
||||
{
|
||||
void setup_class(cls)
|
||||
{
|
||||
cls.genuine_filename = os.path.join(DATADIR, "genuine", "empty.xlsx");
|
||||
cls.archive = ZipFile(cls.genuine_filename, "r", ZIP_DEFLATED);
|
||||
}
|
||||
|
||||
// void teardown_class(cls)
|
||||
// {
|
||||
// cls.archive.close();
|
||||
// }
|
||||
//};
|
||||
void teardown_class(cls)
|
||||
{
|
||||
cls.archive.close();
|
||||
}
|
||||
};
|
||||
|
||||
void test_read_properties_core()
|
||||
{
|
||||
//content = archive.read(ARC_CORE)
|
||||
// prop = read_properties_core(content)
|
||||
// TS_ASSERT_EQUALS(prop.creator, "*.*")
|
||||
// eacute = chr(233)
|
||||
// TS_ASSERT_EQUALS(prop.last_modified_by, "Aur" + eacute + "lien Camp" + eacute + "as")
|
||||
// TS_ASSERT_EQUALS(prop.created, datetime(2010, 4, 9, 20, 43, 12))
|
||||
// TS_ASSERT_EQUALS(prop.modified, datetime(2011, 2, 9, 13, 49, 32))
|
||||
content = archive.read(ARC_CORE)
|
||||
prop = read_properties_core(content)
|
||||
TS_ASSERT_EQUALS(prop.creator, "*.*")
|
||||
eacute = chr(233)
|
||||
TS_ASSERT_EQUALS(prop.last_modified_by, "Aur" + eacute + "lien Camp" + eacute + "as")
|
||||
TS_ASSERT_EQUALS(prop.created, datetime(2010, 4, 9, 20, 43, 12))
|
||||
TS_ASSERT_EQUALS(prop.modified, datetime(2011, 2, 9, 13, 49, 32))
|
||||
}
|
||||
|
||||
void test_read_sheets_titles()
|
||||
{
|
||||
//content = archive.read(ARC_WORKBOOK);
|
||||
//sheet_titles = read_sheets_titles(content);
|
||||
//TS_ASSERT_EQUALS(sheet_titles, \
|
||||
// ["Sheet1 - Text", "Sheet2 - Numbers", "Sheet3 - Formulas", "Sheet4 - Dates"]);
|
||||
content = archive.read(ARC_WORKBOOK);
|
||||
sheet_titles = read_sheets_titles(content);
|
||||
TS_ASSERT_EQUALS(sheet_titles, \
|
||||
["Sheet1 - Text", "Sheet2 - Numbers", "Sheet3 - Formulas", "Sheet4 - Dates"]);
|
||||
}
|
||||
|
||||
// Just tests that the correct date / time format is returned from LibreOffice saved version
|
||||
Just tests that the correct date / time format is returned from LibreOffice saved version
|
||||
|
||||
//void setup_class(cls)
|
||||
//{
|
||||
// cls.genuine_filename = os.path.join(DATADIR, "genuine", "empty_libre.xlsx")
|
||||
// cls.archive = ZipFile(cls.genuine_filename, "r", ZIP_DEFLATED)
|
||||
//}
|
||||
void setup_class(cls)
|
||||
{
|
||||
cls.genuine_filename = os.path.join(DATADIR, "genuine", "empty_libre.xlsx")
|
||||
cls.archive = ZipFile(cls.genuine_filename, "r", ZIP_DEFLATED)
|
||||
}
|
||||
|
||||
//void teardown_class(cls)
|
||||
//{
|
||||
// cls.archive.close()
|
||||
//}
|
||||
void teardown_class(cls)
|
||||
{
|
||||
cls.archive.close()
|
||||
}
|
||||
|
||||
void test_read_properties_core2()
|
||||
{
|
||||
//content = archive.read(ARC_CORE)
|
||||
// prop = read_properties_core(content)
|
||||
// TS_ASSERT_EQUALS(prop.excel_base_date, CALENDAR_WINDOWS_1900)
|
||||
content = archive.read(ARC_CORE)
|
||||
prop = read_properties_core(content)
|
||||
TS_ASSERT_EQUALS(prop.excel_base_date, CALENDAR_WINDOWS_1900)
|
||||
}
|
||||
|
||||
void test_read_sheets_titles2()
|
||||
{
|
||||
//content = archive.read(ARC_WORKBOOK)
|
||||
// sheet_titles = read_sheets_titles(content)
|
||||
// TS_ASSERT_EQUALS(sheet_titles, \
|
||||
// ["Sheet1 - Text", "Sheet2 - Numbers", "Sheet3 - Formulas", "Sheet4 - Dates"])
|
||||
content = archive.read(ARC_WORKBOOK)
|
||||
sheet_titles = read_sheets_titles(content)
|
||||
TS_ASSERT_EQUALS(sheet_titles, \
|
||||
["Sheet1 - Text", "Sheet2 - Numbers", "Sheet3 - Formulas", "Sheet4 - Dates"])
|
||||
}
|
||||
|
||||
//void setup_class(cls)
|
||||
//{
|
||||
// make_tmpdir()
|
||||
// cls.tmp_filename = os.path.join(TMPDIR, "test.xlsx")
|
||||
// cls.prop = DocumentProperties()
|
||||
//}
|
||||
void setup_class(cls)
|
||||
{
|
||||
make_tmpdir()
|
||||
cls.tmp_filename = os.path.join(TMPDIR, "test.xlsx")
|
||||
cls.prop = DocumentProperties()
|
||||
}
|
||||
|
||||
//void teardown_class(cls)
|
||||
//{
|
||||
// clean_tmpdir()
|
||||
//}
|
||||
void teardown_class(cls)
|
||||
{
|
||||
clean_tmpdir()
|
||||
}
|
||||
|
||||
void test_write_properties_core()
|
||||
{
|
||||
//prop.creator = "TEST_USER"
|
||||
// prop.last_modified_by = "SOMEBODY"
|
||||
// prop.created = datetime(2010, 4, 1, 20, 30, 00)
|
||||
// prop.modified = datetime(2010, 4, 5, 14, 5, 30)
|
||||
// content = write_properties_core(prop)
|
||||
// assert_equals_file_content(
|
||||
// os.path.join(DATADIR, "writer", "expected", "core.xml"),
|
||||
// content)
|
||||
prop.creator = "TEST_USER"
|
||||
prop.last_modified_by = "SOMEBODY"
|
||||
prop.created = datetime(2010, 4, 1, 20, 30, 00)
|
||||
prop.modified = datetime(2010, 4, 5, 14, 5, 30)
|
||||
content = write_properties_core(prop)
|
||||
assert_equals_file_content(
|
||||
os.path.join(DATADIR, "writer", "expected", "core.xml"),
|
||||
content)
|
||||
}
|
||||
|
||||
void test_write_properties_app()
|
||||
{
|
||||
//wb = Workbook()
|
||||
// wb.create_sheet()
|
||||
// wb.create_sheet()
|
||||
// content = write_properties_app(wb)
|
||||
// assert_equals_file_content(
|
||||
// os.path.join(DATADIR, "writer", "expected", "app.xml"),
|
||||
// content)
|
||||
wb = Workbook()
|
||||
wb.create_sheet()
|
||||
wb.create_sheet()
|
||||
content = write_properties_app(wb)
|
||||
assert_equals_file_content(
|
||||
os.path.join(DATADIR, "writer", "expected", "app.xml"),
|
||||
content)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,182 +15,182 @@ public:
|
|||
|
||||
void test_read_standalone_worksheet()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "reader", "sheet2.xml")
|
||||
// ws = None
|
||||
// handle = open(path)
|
||||
// try :
|
||||
// ws = read_worksheet(handle.read(), DummyWb(),
|
||||
// "Sheet 2", {1: "hello"}, {1: Style()})
|
||||
// finally :
|
||||
// handle.close()
|
||||
// assert isinstance(ws, Worksheet)
|
||||
// TS_ASSERT_EQUALS(ws.cell("G5").value, "hello")
|
||||
// TS_ASSERT_EQUALS(ws.cell("D30").value, 30)
|
||||
// TS_ASSERT_EQUALS(ws.cell("K9").value, 0.09)
|
||||
path = os.path.join(DATADIR, "reader", "sheet2.xml")
|
||||
ws = None
|
||||
handle = open(path)
|
||||
try :
|
||||
ws = read_worksheet(handle.read(), DummyWb(),
|
||||
"Sheet 2", {1: "hello"}, {1: Style()})
|
||||
finally :
|
||||
handle.close()
|
||||
assert isinstance(ws, Worksheet)
|
||||
TS_ASSERT_EQUALS(ws.cell("G5").value, "hello")
|
||||
TS_ASSERT_EQUALS(ws.cell("D30").value, 30)
|
||||
TS_ASSERT_EQUALS(ws.cell("K9").value, 0.09)
|
||||
}
|
||||
|
||||
void test_read_standard_workbook()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
// wb = load_workbook(path)
|
||||
// assert isinstance(wb, Workbook)
|
||||
path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
wb = load_workbook(path)
|
||||
assert isinstance(wb, Workbook)
|
||||
}
|
||||
|
||||
void test_read_standard_workbook_from_fileobj()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
// fo = open(path, mode = "rb")
|
||||
// wb = load_workbook(fo)
|
||||
// assert isinstance(wb, Workbook)
|
||||
path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
fo = open(path, mode = "rb")
|
||||
wb = load_workbook(fo)
|
||||
assert isinstance(wb, Workbook)
|
||||
}
|
||||
|
||||
void test_read_worksheet()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
// wb = load_workbook(path)
|
||||
// sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers")
|
||||
// assert isinstance(sheet2, Worksheet)
|
||||
// TS_ASSERT_EQUALS("This is cell G5", sheet2.cell("G5").value)
|
||||
// TS_ASSERT_EQUALS(18, sheet2.cell("D18").value)
|
||||
path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
wb = load_workbook(path)
|
||||
sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers")
|
||||
assert isinstance(sheet2, Worksheet)
|
||||
TS_ASSERT_EQUALS("This is cell G5", sheet2.cell("G5").value)
|
||||
TS_ASSERT_EQUALS(18, sheet2.cell("D18").value)
|
||||
}
|
||||
|
||||
void test_read_nostring_workbook()
|
||||
{
|
||||
//genuine_wb = os.path.join(DATADIR, "genuine", "empty-no-string.xlsx")
|
||||
// wb = load_workbook(genuine_wb)
|
||||
// assert isinstance(wb, Workbook)
|
||||
genuine_wb = os.path.join(DATADIR, "genuine", "empty-no-string.xlsx")
|
||||
wb = load_workbook(genuine_wb)
|
||||
assert isinstance(wb, Workbook)
|
||||
}
|
||||
|
||||
// @raises(InvalidFileException)
|
||||
void test_read_empty_file()
|
||||
{
|
||||
//null_file = os.path.join(DATADIR, "reader", "null_file.xlsx")
|
||||
// wb = load_workbook(null_file)
|
||||
std::string null_file = os.path.join(DATADIR, "reader", "null_file.xlsx");
|
||||
xlnt::workbook wb;
|
||||
TS_ASSERT_THROWS(InvalidFile, wb.load(null_file));
|
||||
}
|
||||
|
||||
//@raises(InvalidFileException)
|
||||
@raises(InvalidFileException)
|
||||
void test_read_empty_archive()
|
||||
{
|
||||
//null_file = os.path.join(DATADIR, "reader", "null_archive.xlsx")
|
||||
// wb = load_workbook(null_file)
|
||||
null_file = os.path.join(DATADIR, "reader", "null_archive.xlsx")
|
||||
wb = load_workbook(null_file)
|
||||
}
|
||||
|
||||
void test_read_dimension()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "reader", "sheet2.xml")
|
||||
path = os.path.join(DATADIR, "reader", "sheet2.xml")
|
||||
|
||||
// dimension = None
|
||||
// handle = open(path)
|
||||
// try :
|
||||
// dimension = read_dimension(xml_source = handle.read())
|
||||
// finally :
|
||||
// handle.close()
|
||||
dimension = None
|
||||
handle = open(path)
|
||||
try :
|
||||
dimension = read_dimension(xml_source = handle.read())
|
||||
finally :
|
||||
handle.close()
|
||||
|
||||
// TS_ASSERT_EQUALS(("D", 1, "K", 30), dimension)
|
||||
TS_ASSERT_EQUALS(("D", 1, "K", 30), dimension)
|
||||
}
|
||||
|
||||
void test_calculate_dimension_iter()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
// wb = load_workbook(filename = path, use_iterators = True)
|
||||
// sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers")
|
||||
// dimensions = sheet2.calculate_dimension()
|
||||
// TS_ASSERT_EQUALS("%s%s:%s%s" % ("D", 1, "K", 30), dimensions)
|
||||
path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
wb = load_workbook(filename = path, use_iterators = True)
|
||||
sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers")
|
||||
dimensions = sheet2.calculate_dimension()
|
||||
TS_ASSERT_EQUALS("%s%s:%s%s" % ("D", 1, "K", 30), dimensions)
|
||||
}
|
||||
|
||||
void test_get_highest_row_iter()
|
||||
{
|
||||
//path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
// wb = load_workbook(filename = path, use_iterators = True)
|
||||
// sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers")
|
||||
// max_row = sheet2.get_highest_row()
|
||||
// TS_ASSERT_EQUALS(30, max_row)
|
||||
path = os.path.join(DATADIR, "genuine", "empty.xlsx")
|
||||
wb = load_workbook(filename = path, use_iterators = True)
|
||||
sheet2 = wb.get_sheet_by_name("Sheet2 - Numbers")
|
||||
max_row = sheet2.get_highest_row()
|
||||
TS_ASSERT_EQUALS(30, max_row)
|
||||
}
|
||||
|
||||
void test_read_workbook_with_no_properties()
|
||||
{
|
||||
//genuine_wb = os.path.join(DATADIR, "genuine", \
|
||||
// "empty_with_no_properties.xlsx")
|
||||
// wb = load_workbook(filename = genuine_wb)
|
||||
genuine_wb = os.path.join(DATADIR, "genuine", \
|
||||
"empty_with_no_properties.xlsx")
|
||||
wb = load_workbook(filename = genuine_wb)
|
||||
}
|
||||
|
||||
//void setup_class_with_styles(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 setup_class_with_styles(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()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(ws.cell("A1").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_GENERAL)
|
||||
TS_ASSERT_EQUALS(ws.cell("A1").style.number_format.format_code,
|
||||
NumberFormat.FORMAT_GENERAL)
|
||||
}
|
||||
|
||||
void test_read_date_style()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(ws.cell("A2").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_DATE_XLSX14)
|
||||
TS_ASSERT_EQUALS(ws.cell("A2").style.number_format.format_code,
|
||||
NumberFormat.FORMAT_DATE_XLSX14)
|
||||
}
|
||||
|
||||
void test_read_number_style()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(ws.cell("A3").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_NUMBER_00)
|
||||
TS_ASSERT_EQUALS(ws.cell("A3").style.number_format.format_code,
|
||||
NumberFormat.FORMAT_NUMBER_00)
|
||||
}
|
||||
|
||||
void test_read_time_style()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(ws.cell("A4").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_DATE_TIME3)
|
||||
TS_ASSERT_EQUALS(ws.cell("A4").style.number_format.format_code,
|
||||
NumberFormat.FORMAT_DATE_TIME3)
|
||||
}
|
||||
|
||||
void test_read_percentage_style()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(ws.cell("A5").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_PERCENTAGE_00)
|
||||
TS_ASSERT_EQUALS(ws.cell("A5").style.number_format.format_code,
|
||||
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")
|
||||
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")
|
||||
//}
|
||||
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()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(win_wb.properties.excel_base_date, CALENDAR_WINDOWS_1900)
|
||||
TS_ASSERT_EQUALS(win_wb.properties.excel_base_date, CALENDAR_WINDOWS_1900)
|
||||
}
|
||||
|
||||
void test_read_mac_base_date()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(mac_wb.properties.excel_base_date, CALENDAR_MAC_1904)
|
||||
TS_ASSERT_EQUALS(mac_wb.properties.excel_base_date, CALENDAR_MAC_1904)
|
||||
}
|
||||
|
||||
void test_read_date_style_mac()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(mac_ws.cell("A1").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_DATE_XLSX14)
|
||||
TS_ASSERT_EQUALS(mac_ws.cell("A1").style.number_format.format_code,
|
||||
NumberFormat.FORMAT_DATE_XLSX14)
|
||||
}
|
||||
|
||||
void test_read_date_style_win()
|
||||
{
|
||||
//TS_ASSERT_EQUALS(win_ws.cell("A1").style.number_format.format_code,
|
||||
// NumberFormat.FORMAT_DATE_XLSX14)
|
||||
TS_ASSERT_EQUALS(win_ws.cell("A1").style.number_format.format_code,
|
||||
NumberFormat.FORMAT_DATE_XLSX14)
|
||||
}
|
||||
|
||||
void test_read_date_value()
|
||||
{
|
||||
//datetuple = (2011, 10, 31)
|
||||
// dt = datetime(datetuple[0], datetuple[1], datetuple[2])
|
||||
// TS_ASSERT_EQUALS(mac_ws.cell("A1").value, dt)
|
||||
// TS_ASSERT_EQUALS(win_ws.cell("A1").value, dt)
|
||||
// TS_ASSERT_EQUALS(mac_ws.cell("A1").value, win_ws.cell("A1").value)
|
||||
datetuple = (2011, 10, 31)
|
||||
dt = datetime(datetuple[0], datetuple[1], datetuple[2])
|
||||
TS_ASSERT_EQUALS(mac_ws.cell("A1").value, dt)
|
||||
TS_ASSERT_EQUALS(win_ws.cell("A1").value, dt)
|
||||
TS_ASSERT_EQUALS(mac_ws.cell("A1").value, win_ws.cell("A1").value)
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,46 +15,46 @@ public:
|
|||
|
||||
void test_create_string_table()
|
||||
{
|
||||
//wb = Workbook()
|
||||
// ws = wb.create_sheet()
|
||||
// ws.cell("B12").value = "hello"
|
||||
// ws.cell("B13").value = "world"
|
||||
// ws.cell("D28").value = "hello"
|
||||
// table = create_string_table(wb)
|
||||
// TS_ASSERT_EQUALS({"hello": 1, "world" : 0}, table)
|
||||
wb = Workbook()
|
||||
ws = wb.create_sheet()
|
||||
ws.cell("B12").value = "hello"
|
||||
ws.cell("B13").value = "world"
|
||||
ws.cell("D28").value = "hello"
|
||||
table = create_string_table(wb)
|
||||
TS_ASSERT_EQUALS({"hello": 1, "world" : 0}, table)
|
||||
}
|
||||
|
||||
void test_read_string_table()
|
||||
{
|
||||
//handle = open(os.path.join(DATADIR, "reader", "sharedStrings.xml"))
|
||||
// try :
|
||||
// content = handle.read()
|
||||
// string_table = read_string_table(content)
|
||||
// TS_ASSERT_EQUALS({0: "This is cell A1 in Sheet 1", 1 : "This is cell G5"}, string_table)
|
||||
// finally :
|
||||
// handle.close()
|
||||
handle = open(os.path.join(DATADIR, "reader", "sharedStrings.xml"))
|
||||
try :
|
||||
content = handle.read()
|
||||
string_table = read_string_table(content)
|
||||
TS_ASSERT_EQUALS({0: "This is cell A1 in Sheet 1", 1 : "This is cell G5"}, string_table)
|
||||
finally :
|
||||
handle.close()
|
||||
}
|
||||
|
||||
void test_empty_string()
|
||||
{
|
||||
//handle = open(os.path.join(DATADIR, "reader", "sharedStrings-emptystring.xml"))
|
||||
// try :
|
||||
// content = handle.read()
|
||||
// string_table = read_string_table(content)
|
||||
// TS_ASSERT_EQUALS({0: "Testing empty cell", 1 : ""}, string_table)
|
||||
// finally :
|
||||
// handle.close()
|
||||
handle = open(os.path.join(DATADIR, "reader", "sharedStrings-emptystring.xml"))
|
||||
try :
|
||||
content = handle.read()
|
||||
string_table = read_string_table(content)
|
||||
TS_ASSERT_EQUALS({0: "Testing empty cell", 1 : ""}, string_table)
|
||||
finally :
|
||||
handle.close()
|
||||
}
|
||||
|
||||
void test_formatted_string_table()
|
||||
{
|
||||
//handle = open(os.path.join(DATADIR, "reader", "shared-strings-rich.xml"))
|
||||
// try :
|
||||
// content = handle.read()
|
||||
// string_table = read_string_table(content)
|
||||
// TS_ASSERT_EQUALS({0: "Welcome", 1 : "to the best shop in town",
|
||||
// 2 : " let"s play "}, string_table)
|
||||
// finally :
|
||||
// handle.close()
|
||||
handle = open(os.path.join(DATADIR, "reader", "shared-strings-rich.xml"))
|
||||
try :
|
||||
content = handle.read()
|
||||
string_table = read_string_table(content)
|
||||
TS_ASSERT_EQUALS({0: "Welcome", 1 : "to the best shop in town",
|
||||
2 : " let"s play "}, string_table)
|
||||
finally :
|
||||
handle.close()
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,224 +15,224 @@ public:
|
|||
|
||||
void test_get_active_sheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//active_sheet = wb.get_active_sheet();
|
||||
//TS_ASSERT_EQUALS(active_sheet, wb.worksheets[0]);
|
||||
xlnt::workbook wb;
|
||||
auto active_sheet = wb.get_active_sheet();
|
||||
TS_ASSERT_EQUALS(active_sheet, wb.worksheets[0]);
|
||||
}
|
||||
|
||||
void test_create_sheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//new_sheet = wb.create_sheet(0);
|
||||
//TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);
|
||||
}
|
||||
|
||||
void test_create_sheet_with_name()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//new_sheet = wb.create_sheet(0, title = "LikeThisName");
|
||||
//TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0, title = "LikeThisName");
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);
|
||||
}
|
||||
|
||||
void test_add_correct_sheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//new_sheet = wb.create_sheet(0);
|
||||
//wb.add_sheet(new_sheet);
|
||||
//TS_ASSERT_EQUALS(new_sheet, wb.worksheets[2]);
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
wb.add_sheet(new_sheet);
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[2]);
|
||||
}
|
||||
|
||||
void test_add_incorrect_sheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//wb.add_sheet("Test");
|
||||
xlnt::workbook wb;
|
||||
wb.add_sheet("Test");
|
||||
}
|
||||
|
||||
void test_create_sheet_readonly()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//wb._set_optimized_read();
|
||||
//wb.create_sheet();
|
||||
xlnt::workbook wb;
|
||||
wb._set_optimized_read();
|
||||
wb.create_sheet();
|
||||
}
|
||||
|
||||
void test_remove_sheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//new_sheet = wb.create_sheet(0);
|
||||
//wb.remove_sheet(new_sheet);
|
||||
//assert new_sheet not in wb.worksheets;
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
wb.remove_sheet(new_sheet);
|
||||
assert new_sheet not in wb.worksheets;
|
||||
}
|
||||
|
||||
void test_get_sheet_by_name()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//new_sheet = wb.create_sheet();
|
||||
//title = "my sheet";
|
||||
//new_sheet.title = title;
|
||||
//found_sheet = wb.get_sheet_by_name(title);
|
||||
//TS_ASSERT_EQUALS(new_sheet, found_sheet);
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet();
|
||||
title = "my sheet";
|
||||
new_sheet.title = title;
|
||||
found_sheet = wb.get_sheet_by_name(title);
|
||||
TS_ASSERT_EQUALS(new_sheet, found_sheet);
|
||||
}
|
||||
|
||||
void test_get_index2()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//new_sheet = wb.create_sheet(0);
|
||||
//sheet_index = wb.get_index(new_sheet);
|
||||
//TS_ASSERT_EQUALS(sheet_index, 0);
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
sheet_index = wb.get_index(new_sheet);
|
||||
TS_ASSERT_EQUALS(sheet_index, 0);
|
||||
}
|
||||
|
||||
void test_get_sheet_names()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//names = ["Sheet", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5"];
|
||||
//for(auto count : range(5))
|
||||
//{
|
||||
// wb.create_sheet(0)
|
||||
// actual_names = wb.get_sheet_names()
|
||||
// TS_ASSERT_EQUALS(sorted(actual_names), sorted(names))
|
||||
//}
|
||||
xlnt::workbook wb;
|
||||
names = ["Sheet", "Sheet1", "Sheet2", "Sheet3", "Sheet4", "Sheet5"];
|
||||
for(auto count : range(5))
|
||||
{
|
||||
wb.create_sheet(0)
|
||||
actual_names = wb.get_sheet_names()
|
||||
TS_ASSERT_EQUALS(sorted(actual_names), sorted(names))
|
||||
}
|
||||
}
|
||||
|
||||
void test_get_named_ranges2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
TS_ASSERT_EQUALS(wb.get_named_ranges(), wb._named_ranges);*/
|
||||
xlnt::workbook wb;
|
||||
TS_ASSERT_EQUALS(wb.get_named_ranges(), wb._named_ranges);
|
||||
}
|
||||
void test_get_active_sheet2()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//active_sheet = wb.get_active_sheet();
|
||||
//TS_ASSERT_EQUALS(active_sheet, wb.worksheets[0]);
|
||||
xlnt::workbook wb;
|
||||
active_sheet = wb.get_active_sheet();
|
||||
TS_ASSERT_EQUALS(active_sheet, wb.worksheets[0]);
|
||||
}
|
||||
|
||||
void test_create_sheet2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);*/
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);
|
||||
}
|
||||
|
||||
void test_create_sheet_with_name2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0, title = "LikeThisName");
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);*/
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[0]);
|
||||
}
|
||||
|
||||
void test_add_correct_sheet2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
wb.add_sheet(new_sheet);
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[2]);*/
|
||||
TS_ASSERT_EQUALS(new_sheet, wb.worksheets[2]);
|
||||
}
|
||||
|
||||
//@raises(AssertionError)
|
||||
void test_add_incorrect_sheet2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
wb.add_sheet("Test");*/
|
||||
xlnt::workbook wb;
|
||||
TS_ASSERT_THROWS(AssertionError, wb.add_sheet("Test"))
|
||||
}
|
||||
|
||||
//@raises(ReadOnlyWorkbookException)
|
||||
void test_create_sheet_readonly2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
wb._set_optimized_read();
|
||||
wb.create_sheet();*/
|
||||
TS_ASSERT_THROWS(wb.create_sheet(), ReadOnlyWorkbook);
|
||||
}
|
||||
|
||||
void test_remove_sheet2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
wb.remove_sheet(new_sheet);
|
||||
assert new_sheet not in wb.worksheets;*/
|
||||
assert new_sheet not in wb.worksheets;
|
||||
}
|
||||
|
||||
void test_get_sheet_by_name2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet();
|
||||
title = "my sheet";
|
||||
new_sheet.title = title;
|
||||
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()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
new_sheet = wb.create_sheet(0);
|
||||
sheet_index = wb.get_index(new_sheet);
|
||||
TS_ASSERT_EQUALS(sheet_index, 0);*/
|
||||
TS_ASSERT_EQUALS(sheet_index, 0);
|
||||
}
|
||||
|
||||
void test_get_sheet_names2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
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()
|
||||
{
|
||||
/* wb = Workbook();
|
||||
TS_ASSERT_EQUALS(wb.get_named_ranges(), wb._named_ranges);*/
|
||||
xlnt::workbook wb;
|
||||
TS_ASSERT_EQUALS(wb.get_named_ranges(), wb._named_ranges);
|
||||
}
|
||||
|
||||
void test_add_named_range()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
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;*/
|
||||
assert named_range in named_ranges_list;
|
||||
}
|
||||
|
||||
void test_get_named_range2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
xlnt::workbook wb;
|
||||
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);*/
|
||||
TS_ASSERT_EQUALS(named_range, found_named_range);
|
||||
}
|
||||
|
||||
void test_remove_named_range2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
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;*/
|
||||
assert named_range not in named_ranges_list;
|
||||
}
|
||||
|
||||
//@with_setup(setup = make_tmpdir, teardown = clean_tmpdir)
|
||||
void test_add_local_named_range2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
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);*/
|
||||
wb.save(dest_filename);
|
||||
clean_tmpdir();
|
||||
}
|
||||
|
||||
//@with_setup(setup = make_tmpdir, teardown = clean_tmpdir)
|
||||
void test_write_regular_date()
|
||||
{
|
||||
/*today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600);
|
||||
make_tmpdir();
|
||||
today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600);
|
||||
|
||||
book = Workbook();
|
||||
sheet = book.get_active_sheet();
|
||||
|
@ -243,13 +243,14 @@ public:
|
|||
test_book = load_workbook(dest_filename);
|
||||
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();
|
||||
}
|
||||
|
||||
// @with_setup(setup = make_tmpdir, teardown = clean_tmpdir)
|
||||
void test_write_regular_float()
|
||||
{
|
||||
/*float_value = 1.0 / 3.0;
|
||||
make_tmpdir();
|
||||
float float_value = 1.0 / 3.0;
|
||||
book = Workbook();
|
||||
sheet = book.get_active_sheet();
|
||||
sheet.cell("A1").value = float_value;
|
||||
|
@ -260,77 +261,78 @@ public:
|
|||
test_sheet = test_book.get_active_sheet();
|
||||
|
||||
TS_ASSERT_EQUALS(test_sheet.cell("A1").value, float_value);*/
|
||||
clean_tmpdir();
|
||||
}
|
||||
|
||||
//@raises(UnicodeDecodeError)
|
||||
void test_bad_encoding2()
|
||||
{
|
||||
/*pound = chr(163);
|
||||
test_string = ("Compound Value (" + pound + ")").encode("latin1");
|
||||
char pound = 163;
|
||||
std::string test_string = ("Compound Value (" + std::string(1, pound) + ")").encode("latin1");
|
||||
|
||||
utf_book = Workbook();
|
||||
utf_sheet = utf_book.get_active_sheet();
|
||||
utf_sheet.cell("A1").value = test_string;*/
|
||||
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()
|
||||
{
|
||||
/*pound = chr(163);
|
||||
test_string = ("Compound Value (" + pound + ")").encode("latin1");
|
||||
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;*/
|
||||
lat_sheet.cell("A1").value = test_string;
|
||||
}
|
||||
|
||||
void test_add_named_range2()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
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;*/
|
||||
assert named_range in named_ranges_list;
|
||||
}
|
||||
|
||||
void test_get_named_range()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
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);*/
|
||||
TS_ASSERT_EQUALS(named_range, found_named_range);
|
||||
}
|
||||
|
||||
void test_remove_named_range()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
wb = Workbook();
|
||||
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;*/
|
||||
assert named_range not in named_ranges_list;
|
||||
}
|
||||
|
||||
//@with_setup(setup = make_tmpdir, teardown = clean_tmpdir)
|
||||
void test_add_local_named_range()
|
||||
{
|
||||
/*wb = Workbook();
|
||||
make_tmpdir();
|
||||
wb = Workbook();
|
||||
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);*/
|
||||
wb.save(dest_filename);
|
||||
clean_tmpdir();
|
||||
}
|
||||
|
||||
|
||||
// @with_setup(setup = make_tmpdir, teardown = clean_tmpdir)
|
||||
void test_write_regular_date2()
|
||||
{
|
||||
/*today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600);
|
||||
make_tmpdir();
|
||||
today = datetime.datetime(2010, 1, 18, 14, 15, 20, 1600);
|
||||
|
||||
book = Workbook();
|
||||
sheet = book.get_active_sheet();
|
||||
|
@ -341,23 +343,26 @@ public:
|
|||
test_book = load_workbook(dest_filename);
|
||||
test_sheet = test_book.get_active_sheet();
|
||||
|
||||
TS_ASSERT_EQUALS(test_sheet.cell("A1").value, today);*/
|
||||
TS_ASSERT_EQUALS(test_sheet.cell("A1").value, today);
|
||||
clean_tmpdir();
|
||||
}
|
||||
|
||||
// @with_setup(setup = make_tmpdir, teardown = clean_tmpdir)
|
||||
void test_write_regular_float2()
|
||||
{
|
||||
/*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");
|
||||
make_tmpdir();
|
||||
float float_value = 1.0 / 3.0;
|
||||
xlnt::workbook book;
|
||||
xlnt::worksheet sheet = book.get_active_sheet();
|
||||
sheet.cell("A1") = float_value;
|
||||
std::string 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();
|
||||
xlnt::workbook test_book;
|
||||
test_book.load(dest_filename);
|
||||
xlnt::worksheet test_sheet = test_book.get_active_sheet();
|
||||
|
||||
TS_ASSERT_EQUALS(test_sheet.cell("A1").value, float_value);*/
|
||||
TS_ASSERT_EQUALS(test_sheet.cell("A1"), float_value);
|
||||
clean_tmpdir();
|
||||
}
|
||||
|
||||
// @raises(UnicodeDecodeError)
|
||||
|
@ -373,11 +378,11 @@ public:
|
|||
|
||||
void test_good_encoding()
|
||||
{
|
||||
/*pound = chr(163);
|
||||
test_string = ("Compound Value (" + pound + ")").encode("latin1");
|
||||
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;*/
|
||||
xlnt::workbook lat_book("latin1");
|
||||
xlnt::worksheet lat_sheet = lat_book.get_active_sheet();
|
||||
lat_sheet.cell("A1") = test_string;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -10,326 +10,323 @@ class WorksheetTestSuite : public CxxTest::TestSuite
|
|||
public:
|
||||
WorksheetTestSuite()
|
||||
{
|
||||
}/*
|
||||
cls.wb = Workbook()
|
||||
}
|
||||
*/
|
||||
|
||||
void test_new_worksheet()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//TS_ASSERT_EQUALS(wb, ws._parent);
|
||||
ws = Worksheet(wb);
|
||||
TS_ASSERT_EQUALS(wb, ws._parent);
|
||||
}
|
||||
|
||||
void test_new_sheet_name()
|
||||
{
|
||||
//wb.worksheets = [];
|
||||
//ws = Worksheet(wb, title = "");
|
||||
//TS_ASSERT_EQUALS(repr(ws), "<Worksheet "Sheet1">");
|
||||
wb.worksheets = [];
|
||||
ws = Worksheet(wb, title = "");
|
||||
TS_ASSERT_EQUALS(repr(ws), "<Worksheet "Sheet1">");
|
||||
}
|
||||
|
||||
void test_get_cell()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//cell = ws.cell("A1");
|
||||
//TS_ASSERT_EQUALS(cell.get_coordinate(), "A1");
|
||||
ws = Worksheet(wb);
|
||||
cell = ws.cell("A1");
|
||||
TS_ASSERT_EQUALS(cell.get_coordinate(), "A1");
|
||||
}
|
||||
|
||||
void test_set_bad_title()
|
||||
{
|
||||
//Worksheet(wb, "X" * 50);
|
||||
Worksheet(wb, "X" * 50);
|
||||
}
|
||||
|
||||
void test_set_bad_title_character()
|
||||
{
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, "[");
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, "]");
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, "*");
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, ":");
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, "?");
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, "/");
|
||||
//assert_raises(SheetTitleException, Worksheet, wb, "\\");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, "[");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, "]");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, "*");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, ":");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, "?");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, "/");
|
||||
assert_raises(SheetTitleException, Worksheet, wb, "\\");
|
||||
}
|
||||
|
||||
void test_worksheet_dimension()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//TS_ASSERT_EQUALS("A1:A1", ws.calculate_dimension());
|
||||
//ws.cell("B12").value = "AAA";
|
||||
//TS_ASSERT_EQUALS("A1:B12", ws.calculate_dimension());
|
||||
ws = Worksheet(wb);
|
||||
TS_ASSERT_EQUALS("A1:A1", ws.calculate_dimension());
|
||||
ws.cell("B12").value = "AAA";
|
||||
TS_ASSERT_EQUALS("A1:B12", ws.calculate_dimension());
|
||||
}
|
||||
|
||||
void test_worksheet_range()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//xlrange = ws.range("A1:C4");
|
||||
//assert isinstance(xlrange, tuple);
|
||||
//TS_ASSERT_EQUALS(4, len(xlrange));
|
||||
//TS_ASSERT_EQUALS(3, len(xlrange[0]));
|
||||
ws = Worksheet(wb);
|
||||
xlrange = ws.range("A1:C4");
|
||||
assert isinstance(xlrange, tuple);
|
||||
TS_ASSERT_EQUALS(4, len(xlrange));
|
||||
TS_ASSERT_EQUALS(3, len(xlrange[0]));
|
||||
}
|
||||
|
||||
void test_worksheet_named_range()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//wb.create_named_range("test_range", ws, "C5");
|
||||
//xlrange = ws.range("test_range");
|
||||
//assert isinstance(xlrange, Cell);
|
||||
//TS_ASSERT_EQUALS(5, xlrange.row);
|
||||
ws = Worksheet(wb);
|
||||
wb.create_named_range("test_range", ws, "C5");
|
||||
xlrange = ws.range("test_range");
|
||||
assert isinstance(xlrange, Cell);
|
||||
TS_ASSERT_EQUALS(5, xlrange.row);
|
||||
}
|
||||
|
||||
void test_bad_named_range()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.range("bad_range");
|
||||
ws = Worksheet(wb);
|
||||
ws.range("bad_range");
|
||||
}
|
||||
|
||||
void test_named_range_wrong_sheet()
|
||||
{
|
||||
//ws1 = Worksheet(wb);
|
||||
//ws2 = Worksheet(wb);
|
||||
//wb.create_named_range("wrong_sheet_range", ws1, "C5");
|
||||
//ws2.range("wrong_sheet_range");
|
||||
ws1 = Worksheet(wb);
|
||||
ws2 = Worksheet(wb);
|
||||
wb.create_named_range("wrong_sheet_range", ws1, "C5");
|
||||
ws2.range("wrong_sheet_range");
|
||||
}
|
||||
|
||||
void test_cell_offset()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//TS_ASSERT_EQUALS("C17", ws.cell("B15").offset(2, 1).get_coordinate());
|
||||
ws = Worksheet(wb);
|
||||
TS_ASSERT_EQUALS("C17", ws.cell("B15").offset(2, 1).get_coordinate());
|
||||
}
|
||||
|
||||
void test_range_offset()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//xlrange = ws.range("A1:C4", 1, 3);
|
||||
//assert isinstance(xlrange, tuple);
|
||||
//TS_ASSERT_EQUALS(4, len(xlrange));
|
||||
//TS_ASSERT_EQUALS(3, len(xlrange[0]));
|
||||
//TS_ASSERT_EQUALS("D2", xlrange[0][0].get_coordinate());
|
||||
ws = Worksheet(wb);
|
||||
xlrange = ws.range("A1:C4", 1, 3);
|
||||
assert isinstance(xlrange, tuple);
|
||||
TS_ASSERT_EQUALS(4, len(xlrange));
|
||||
TS_ASSERT_EQUALS(3, len(xlrange[0]));
|
||||
TS_ASSERT_EQUALS("D2", xlrange[0][0].get_coordinate());
|
||||
}
|
||||
|
||||
void test_cell_alternate_coordinates()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//cell = ws.cell(row = 8, column = 4);
|
||||
//TS_ASSERT_EQUALS("E9", cell.get_coordinate());
|
||||
ws = Worksheet(wb);
|
||||
cell = ws.cell(row = 8, column = 4);
|
||||
TS_ASSERT_EQUALS("E9", cell.get_coordinate());
|
||||
}
|
||||
|
||||
void test_cell_insufficient_coordinates()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//cell = ws.cell(row = 8);
|
||||
ws = Worksheet(wb);
|
||||
cell = ws.cell(row = 8);
|
||||
}
|
||||
|
||||
void test_cell_range_name()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//wb.create_named_range("test_range_single", ws, "B12");
|
||||
//assert_raises(CellCoordinatesException, ws.cell, "test_range_single");
|
||||
//c_range_name = ws.range("test_range_single");
|
||||
//c_range_coord = ws.range("B12");
|
||||
//c_cell = ws.cell("B12");
|
||||
//TS_ASSERT_EQUALS(c_range_coord, c_range_name);
|
||||
//TS_ASSERT_EQUALS(c_range_coord, c_cell);
|
||||
ws = Worksheet(wb);
|
||||
wb.create_named_range("test_range_single", ws, "B12");
|
||||
assert_raises(CellCoordinatesException, ws.cell, "test_range_single");
|
||||
c_range_name = ws.range("test_range_single");
|
||||
c_range_coord = ws.range("B12");
|
||||
c_cell = ws.cell("B12");
|
||||
TS_ASSERT_EQUALS(c_range_coord, c_range_name);
|
||||
TS_ASSERT_EQUALS(c_range_coord, c_cell);
|
||||
}
|
||||
|
||||
void test_garbage_collect()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.cell("A1").value = "";
|
||||
//ws.cell("B2").value = "0";
|
||||
//ws.cell("C4").value = 0;
|
||||
//ws.garbage_collect();
|
||||
//for i, cell in enumerate(ws.get_cell_collection())
|
||||
//{
|
||||
// TS_ASSERT_EQUALS(cell, [ws.cell("B2"), ws.cell("C4")][i]);
|
||||
//}
|
||||
ws = Worksheet(wb);
|
||||
ws.cell("A1").value = "";
|
||||
ws.cell("B2").value = "0";
|
||||
ws.cell("C4").value = 0;
|
||||
ws.garbage_collect();
|
||||
for i, cell in enumerate(ws.get_cell_collection())
|
||||
{
|
||||
TS_ASSERT_EQUALS(cell, [ws.cell("B2"), ws.cell("C4")][i]);
|
||||
}
|
||||
}
|
||||
|
||||
void test_hyperlink_relationships()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//TS_ASSERT_EQUALS(len(ws.relationships), 0);
|
||||
ws = Worksheet(wb);
|
||||
TS_ASSERT_EQUALS(len(ws.relationships), 0);
|
||||
|
||||
//ws.cell("A1").hyperlink = "http://test.com";
|
||||
//TS_ASSERT_EQUALS(len(ws.relationships), 1);
|
||||
//TS_ASSERT_EQUALS("rId1", ws.cell("A1").hyperlink_rel_id);
|
||||
//TS_ASSERT_EQUALS("rId1", ws.relationships[0].id);
|
||||
//TS_ASSERT_EQUALS("http://test.com", ws.relationships[0].target);
|
||||
//TS_ASSERT_EQUALS("External", ws.relationships[0].target_mode);
|
||||
ws.cell("A1").hyperlink = "http:test.com";
|
||||
TS_ASSERT_EQUALS(len(ws.relationships), 1);
|
||||
TS_ASSERT_EQUALS("rId1", ws.cell("A1").hyperlink_rel_id);
|
||||
TS_ASSERT_EQUALS("rId1", ws.relationships[0].id);
|
||||
TS_ASSERT_EQUALS("http:test.com", ws.relationships[0].target);
|
||||
TS_ASSERT_EQUALS("External", ws.relationships[0].target_mode);
|
||||
|
||||
//ws.cell("A2").hyperlink = "http://test2.com";
|
||||
//TS_ASSERT_EQUALS(len(ws.relationships), 2);
|
||||
//TS_ASSERT_EQUALS("rId2", ws.cell("A2").hyperlink_rel_id);
|
||||
//TS_ASSERT_EQUALS("rId2", ws.relationships[1].id);
|
||||
//TS_ASSERT_EQUALS("http://test2.com", ws.relationships[1].target);
|
||||
//TS_ASSERT_EQUALS("External", ws.relationships[1].target_mode);
|
||||
ws.cell("A2").hyperlink = "http:test2.com";
|
||||
TS_ASSERT_EQUALS(len(ws.relationships), 2);
|
||||
TS_ASSERT_EQUALS("rId2", ws.cell("A2").hyperlink_rel_id);
|
||||
TS_ASSERT_EQUALS("rId2", ws.relationships[1].id);
|
||||
TS_ASSERT_EQUALS("http:test2.com", ws.relationships[1].target);
|
||||
TS_ASSERT_EQUALS("External", ws.relationships[1].target_mode);
|
||||
}
|
||||
|
||||
void test_bad_relationship_type()
|
||||
{
|
||||
//rel = Relationship("bad_type");
|
||||
rel = Relationship("bad_type");
|
||||
}
|
||||
|
||||
void test_append_list()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
ws = Worksheet(wb);
|
||||
|
||||
//ws.append(["This is A1", "This is B1"]);
|
||||
ws.append(["This is A1", "This is B1"]);
|
||||
|
||||
//TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
|
||||
//TS_ASSERT_EQUALS("This is B1", ws.cell("B1").value);
|
||||
TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
|
||||
TS_ASSERT_EQUALS("This is B1", ws.cell("B1").value);
|
||||
}
|
||||
|
||||
void test_append_dict_letter()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
ws = Worksheet(wb);
|
||||
|
||||
//ws.append({"A" : "This is A1", "C" : "This is C1"});
|
||||
ws.append({"A" : "This is A1", "C" : "This is C1"});
|
||||
|
||||
//TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
|
||||
//TS_ASSERT_EQUALS("This is C1", ws.cell("C1").value);
|
||||
TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
|
||||
TS_ASSERT_EQUALS("This is C1", ws.cell("C1").value);
|
||||
}
|
||||
|
||||
void test_append_dict_index()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
ws = Worksheet(wb);
|
||||
|
||||
//ws.append({0 : "This is A1", 2 : "This is C1"});
|
||||
ws.append({0 : "This is A1", 2 : "This is C1"});
|
||||
|
||||
//TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
|
||||
//TS_ASSERT_EQUALS("This is C1", ws.cell("C1").value);
|
||||
TS_ASSERT_EQUALS("This is A1", ws.cell("A1").value);
|
||||
TS_ASSERT_EQUALS("This is C1", ws.cell("C1").value);
|
||||
}
|
||||
|
||||
void test_bad_append()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.append("test");
|
||||
ws = Worksheet(wb);
|
||||
ws.append("test");
|
||||
}
|
||||
|
||||
void test_append_2d_list()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
ws = Worksheet(wb);
|
||||
|
||||
//ws.append(["This is A1", "This is B1"]);
|
||||
//ws.append(["This is A2", "This is B2"]);
|
||||
ws.append(["This is A1", "This is B1"]);
|
||||
ws.append(["This is A2", "This is B2"]);
|
||||
|
||||
//vals = ws.range("A1:B2");
|
||||
vals = ws.range("A1:B2");
|
||||
|
||||
//TS_ASSERT_EQUALS((("This is A1", "This is B1"),
|
||||
// ("This is A2", "This is B2"), ), flatten(vals));
|
||||
TS_ASSERT_EQUALS((("This is A1", "This is B1"),
|
||||
("This is A2", "This is B2"), ), flatten(vals));
|
||||
}
|
||||
|
||||
void test_rows()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
ws = Worksheet(wb);
|
||||
|
||||
//ws.cell("A1").value = "first";
|
||||
//ws.cell("C9").value = "last";
|
||||
ws.cell("A1").value = "first";
|
||||
ws.cell("C9").value = "last";
|
||||
|
||||
//rows = ws.rows;
|
||||
rows = ws.rows;
|
||||
|
||||
//TS_ASSERT_EQUALS(len(rows), 9);
|
||||
TS_ASSERT_EQUALS(len(rows), 9);
|
||||
|
||||
//TS_ASSERT_EQUALS(rows[0][0].value, "first");
|
||||
//TS_ASSERT_EQUALS(rows[-1][-1].value, "last");
|
||||
TS_ASSERT_EQUALS(rows[0][0].value, "first");
|
||||
TS_ASSERT_EQUALS(rows[-1][-1].value, "last");
|
||||
}
|
||||
|
||||
void test_cols()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
ws = Worksheet(wb);
|
||||
|
||||
//ws.cell("A1").value = "first";
|
||||
//ws.cell("C9").value = "last";
|
||||
ws.cell("A1").value = "first";
|
||||
ws.cell("C9").value = "last";
|
||||
|
||||
//cols = ws.columns;
|
||||
cols = ws.columns;
|
||||
|
||||
//TS_ASSERT_EQUALS(len(cols), 3);
|
||||
TS_ASSERT_EQUALS(len(cols), 3);
|
||||
|
||||
//TS_ASSERT_EQUALS(cols[0][0].value, "first");
|
||||
//TS_ASSERT_EQUALS(cols[-1][-1].value, "last");
|
||||
TS_ASSERT_EQUALS(cols[0][0].value, "first");
|
||||
TS_ASSERT_EQUALS(cols[-1][-1].value, "last");
|
||||
}
|
||||
|
||||
void test_auto_filter()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.auto_filter = ws.range("a1:f1");
|
||||
//assert ws.auto_filter == "A1:F1";
|
||||
ws = Worksheet(wb);
|
||||
ws.auto_filter = ws.range("a1:f1");
|
||||
assert ws.auto_filter == "A1:F1";
|
||||
|
||||
//ws.auto_filter = "";
|
||||
//assert ws.auto_filter is None;
|
||||
ws.auto_filter = "";
|
||||
assert ws.auto_filter is None;
|
||||
|
||||
//ws.auto_filter = "c1:g9";
|
||||
//assert ws.auto_filter == "C1:G9";
|
||||
ws.auto_filter = "c1:g9";
|
||||
assert ws.auto_filter == "C1:G9";
|
||||
}
|
||||
|
||||
void test_page_margins()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.page_margins.left = 2.0;
|
||||
//ws.page_margins.right = 2.0;
|
||||
//ws.page_margins.top = 2.0;
|
||||
//ws.page_margins.bottom = 2.0;
|
||||
//ws.page_margins.header = 1.5;
|
||||
//ws.page_margins.footer = 1.5;
|
||||
//xml_string = write_worksheet(ws, None, None);
|
||||
//assert "<pageMargins left="2.00" right="2.00" top="2.00" bottom="2.00" header="1.50" footer="1.50"></pageMargins>" in xml_string;
|
||||
ws = Worksheet(wb);
|
||||
ws.page_margins.left = 2.0;
|
||||
ws.page_margins.right = 2.0;
|
||||
ws.page_margins.top = 2.0;
|
||||
ws.page_margins.bottom = 2.0;
|
||||
ws.page_margins.header = 1.5;
|
||||
ws.page_margins.footer = 1.5;
|
||||
xml_string = write_worksheet(ws, None, None);
|
||||
assert "<pageMargins left="2.00" right="2.00" top="2.00" bottom="2.00" header="1.50" footer="1.50"></pageMargins>" in xml_string;
|
||||
|
||||
//ws = Worksheet(wb);
|
||||
//xml_string = write_worksheet(ws, None, None);
|
||||
//assert "<pageMargins" not in xml_string;
|
||||
ws = Worksheet(wb);
|
||||
xml_string = write_worksheet(ws, None, None);
|
||||
assert "<pageMargins" not in xml_string;
|
||||
}
|
||||
|
||||
void test_merge()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//string_table = {"":"", "Cell A1" : "Cell A1", "Cell B1" : "Cell B1"};
|
||||
ws = Worksheet(wb);
|
||||
string_table = {"":"", "Cell A1" : "Cell A1", "Cell B1" : "Cell B1"};
|
||||
|
||||
//ws.cell("A1").value = "Cell A1";
|
||||
//ws.cell("B1").value = "Cell B1";
|
||||
//xml_string = write_worksheet(ws, string_table, None);
|
||||
//assert "<c r="B1" t="s"><v>Cell B1</v></c>" in xml_string;
|
||||
ws.cell("A1").value = "Cell A1";
|
||||
ws.cell("B1").value = "Cell B1";
|
||||
xml_string = write_worksheet(ws, string_table, None);
|
||||
assert "<c r="B1" t="s"><v>Cell B1</v></c>" in xml_string;
|
||||
|
||||
//ws.merge_cells("A1:B1");
|
||||
//xml_string = write_worksheet(ws, string_table, None);
|
||||
//assert "<c r="B1" t="s"><v>Cell B1</v></c>" not in xml_string;
|
||||
//assert "<mergeCells><mergeCell ref="A1:B1"></mergeCell></mergeCells>" in xml_string;
|
||||
ws.merge_cells("A1:B1");
|
||||
xml_string = write_worksheet(ws, string_table, None);
|
||||
assert "<c r="B1" t="s"><v>Cell B1</v></c>" not in xml_string;
|
||||
assert "<mergeCells><mergeCell ref="A1:B1"></mergeCell></mergeCells>" in xml_string;
|
||||
|
||||
//ws.unmerge_cells("A1:B1");
|
||||
//xml_string = write_worksheet(ws, string_table, None);
|
||||
//assert "<mergeCell ref="A1:B1"></mergeCell>" not in xml_string;
|
||||
ws.unmerge_cells("A1:B1");
|
||||
xml_string = write_worksheet(ws, string_table, None);
|
||||
assert "<mergeCell ref="A1:B1"></mergeCell>" not in xml_string;
|
||||
}
|
||||
|
||||
void test_freeze()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.freeze_panes = ws.cell("b2");
|
||||
//assert ws.freeze_panes == "B2";
|
||||
ws = Worksheet(wb);
|
||||
ws.freeze_panes = ws.cell("b2");
|
||||
assert ws.freeze_panes == "B2";
|
||||
|
||||
//ws.freeze_panes = "";
|
||||
//assert ws.freeze_panes is None;
|
||||
ws.freeze_panes = "";
|
||||
assert ws.freeze_panes is None;
|
||||
|
||||
//ws.freeze_panes = "c5";
|
||||
//assert ws.freeze_panes == "C5";
|
||||
ws.freeze_panes = "c5";
|
||||
assert ws.freeze_panes == "C5";
|
||||
|
||||
//ws.freeze_panes = ws.cell("A1");
|
||||
//assert ws.freeze_panes is None;
|
||||
ws.freeze_panes = ws.cell("A1");
|
||||
assert ws.freeze_panes is None;
|
||||
}
|
||||
|
||||
void test_printer_settings()
|
||||
{
|
||||
//ws = Worksheet(wb);
|
||||
//ws.page_setup.orientation = ws.ORIENTATION_LANDSCAPE;
|
||||
//ws.page_setup.paperSize = ws.PAPERSIZE_TABLOID;
|
||||
//ws.page_setup.fitToPage = True;
|
||||
//ws.page_setup.fitToHeight = 0;
|
||||
//ws.page_setup.fitToWidth = 1;
|
||||
//xml_string = write_worksheet(ws, None, None);
|
||||
//assert "<pageSetup orientation="landscape" paperSize="3" fitToHeight="0" fitToWidth="1"></pageSetup>" in xml_string;
|
||||
//assert "<pageSetUpPr fitToPage="1"></pageSetUpPr>" in xml_string;
|
||||
ws = Worksheet(wb);
|
||||
ws.page_setup.orientation = ws.ORIENTATION_LANDSCAPE;
|
||||
ws.page_setup.paperSize = ws.PAPERSIZE_TABLOID;
|
||||
ws.page_setup.fitToPage = True;
|
||||
ws.page_setup.fitToHeight = 0;
|
||||
ws.page_setup.fitToWidth = 1;
|
||||
xml_string = write_worksheet(ws, None, None);
|
||||
assert "<pageSetup orientation="landscape" paperSize="3" fitToHeight="0" fitToWidth="1"></pageSetup>" in xml_string;
|
||||
assert "<pageSetUpPr fitToPage="1"></pageSetUpPr>" in xml_string;
|
||||
|
||||
//ws = Worksheet(wb);
|
||||
//xml_string = write_worksheet(ws, None, None);
|
||||
//assert "<pageSetup" not in xml_string;
|
||||
//assert "<pageSetUpPr" not in xml_string;
|
||||
ws = Worksheet(wb);
|
||||
xml_string = write_worksheet(ws, None, None);
|
||||
assert "<pageSetup" not in xml_string;
|
||||
assert "<pageSetUpPr" not in xml_string;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -15,225 +15,225 @@ public:
|
|||
|
||||
void test_write_empty_workbook()
|
||||
{
|
||||
//make_tmpdir();
|
||||
//wb = Workbook();
|
||||
//dest_filename = os.path.join(TMPDIR, "empty_book.xlsx");
|
||||
//save_workbook(wb, dest_filename);
|
||||
//assert os.path.isfile(dest_filename);
|
||||
//clean_tmpdir();
|
||||
make_tmpdir();
|
||||
wb = Workbook();
|
||||
dest_filename = os.path.join(TMPDIR, "empty_book.xlsx");
|
||||
save_workbook(wb, dest_filename);
|
||||
assert os.path.isfile(dest_filename);
|
||||
clean_tmpdir();
|
||||
}
|
||||
|
||||
void test_write_virtual_workbook()
|
||||
{
|
||||
//old_wb = Workbook();
|
||||
//saved_wb = save_virtual_workbook(old_wb);
|
||||
//new_wb = load_workbook(BytesIO(saved_wb));
|
||||
//assert new_wb;
|
||||
old_wb = Workbook();
|
||||
saved_wb = save_virtual_workbook(old_wb);
|
||||
new_wb = load_workbook(BytesIO(saved_wb));
|
||||
assert new_wb;
|
||||
}
|
||||
|
||||
void test_write_workbook_rels()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//content = write_workbook_rels(wb);
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "workbook.xml.rels"), content);
|
||||
wb = Workbook();
|
||||
content = write_workbook_rels(wb);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"workbook.xml.rels"), content);
|
||||
}
|
||||
|
||||
void test_write_workbook()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//content = write_workbook(wb);
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "workbook.xml"), content);
|
||||
wb = Workbook();
|
||||
content = write_workbook(wb);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"workbook.xml"), content);
|
||||
}
|
||||
|
||||
|
||||
void test_write_string_table()
|
||||
{
|
||||
//table = {"hello": 1, "world" : 2, "nice" : 3};
|
||||
//content = write_string_table(table);
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sharedStrings.xml"), content);
|
||||
table = {"hello": 1, "world" : 2, "nice" : 3};
|
||||
content = write_string_table(table);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sharedStrings.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_worksheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F42").value = "hello";
|
||||
//content = write_worksheet(ws, {"hello": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F42").value = "hello";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_hidden_worksheet()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.sheet_state = ws.SHEETSTATE_HIDDEN;
|
||||
//ws.cell("F42").value = "hello";
|
||||
//content = write_worksheet(ws, {"hello": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.sheet_state = ws.SHEETSTATE_HIDDEN;
|
||||
ws.cell("F42").value = "hello";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_bool()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F42").value = False;
|
||||
//ws.cell("F43").value = True;
|
||||
//content = write_worksheet(ws, {}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_bool.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F42").value = False;
|
||||
ws.cell("F43").value = True;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_bool.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_formula()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F1").value = 10;
|
||||
//ws.cell("F2").value = 32;
|
||||
//ws.cell("F3").value = "=F1+F2";
|
||||
//content = write_worksheet(ws, {}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_formula.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F1").value = 10;
|
||||
ws.cell("F2").value = 32;
|
||||
ws.cell("F3").value = "=F1+F2";
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_formula.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_style()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F1").value = "13%";
|
||||
//style_id_by_hash = StyleWriter(wb).get_style_by_hash();
|
||||
//content = write_worksheet(ws, {}, style_id_by_hash);
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_style.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F1").value = "13%";
|
||||
style_id_by_hash = StyleWriter(wb).get_style_by_hash();
|
||||
content = write_worksheet(ws, {}, style_id_by_hash);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_style.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_height()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F1").value = 10;
|
||||
//ws.row_dimensions[ws.cell("F1").row].height = 30;
|
||||
//content = write_worksheet(ws, {}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_height.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F1").value = 10;
|
||||
ws.row_dimensions[ws.cell("F1").row].height = 30;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_height.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_hyperlink()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("A1").value = "test";
|
||||
//ws.cell("A1").hyperlink = "http://test.com";
|
||||
//content = write_worksheet(ws, {"test": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_hyperlink.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("A1").value = "test";
|
||||
ws.cell("A1").hyperlink = "http:test.com";
|
||||
content = write_worksheet(ws, {"test": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_hyperlink.xml"), content);
|
||||
}
|
||||
|
||||
void test_write_hyperlink_rels()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//TS_ASSERT_EQUALS(0, len(ws.relationships));
|
||||
//ws.cell("A1").value = "test";
|
||||
//ws.cell("A1").hyperlink = "http://test.com/";
|
||||
//TS_ASSERT_EQUALS(1, len(ws.relationships));
|
||||
//ws.cell("A2").value = "test";
|
||||
//ws.cell("A2").hyperlink = "http://test2.com/";
|
||||
//TS_ASSERT_EQUALS(2, len(ws.relationships));
|
||||
//content = write_worksheet_rels(ws, 1);
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_hyperlink.xml.rels"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
TS_ASSERT_EQUALS(0, len(ws.relationships));
|
||||
ws.cell("A1").value = "test";
|
||||
ws.cell("A1").hyperlink = "http:test.com/";
|
||||
TS_ASSERT_EQUALS(1, len(ws.relationships));
|
||||
ws.cell("A2").value = "test";
|
||||
ws.cell("A2").hyperlink = "http:test2.com/";
|
||||
TS_ASSERT_EQUALS(2, len(ws.relationships));
|
||||
content = write_worksheet_rels(ws, 1);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_hyperlink.xml.rels"), content);
|
||||
}
|
||||
|
||||
void test_hyperlink_value()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("A1").hyperlink = "http://test.com";
|
||||
//TS_ASSERT_EQUALS("http://test.com", ws.cell("A1").value);
|
||||
//ws.cell("A1").value = "test";
|
||||
//TS_ASSERT_EQUALS("test", ws.cell("A1").value);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("A1").hyperlink = "http:test.com";
|
||||
TS_ASSERT_EQUALS("http:test.com", ws.cell("A1").value);
|
||||
ws.cell("A1").value = "test";
|
||||
TS_ASSERT_EQUALS("test", ws.cell("A1").value);
|
||||
}
|
||||
|
||||
void test_write_auto_filter()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.worksheets[0];
|
||||
//ws.cell("F42").value = "hello";
|
||||
//ws.auto_filter = "A1:F1";
|
||||
//content = write_worksheet(ws, {"hello": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_auto_filter.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.worksheets[0];
|
||||
ws.cell("F42").value = "hello";
|
||||
ws.auto_filter = "A1:F1";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_auto_filter.xml"), content);
|
||||
|
||||
//content = write_workbook(wb);
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "workbook_auto_filter.xml"), content);
|
||||
content = write_workbook(wb);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"workbook_auto_filter.xml"), content);
|
||||
}
|
||||
|
||||
void test_freeze_panes_horiz()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F42").value = "hello";
|
||||
//ws.freeze_panes = "A4";
|
||||
//content = write_worksheet(ws, {"hello": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_freeze_panes_horiz.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F42").value = "hello";
|
||||
ws.freeze_panes = "A4";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_freeze_panes_horiz.xml"), content);
|
||||
}
|
||||
|
||||
void test_freeze_panes_vert()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F42").value = "hello";
|
||||
//ws.freeze_panes = "D1";
|
||||
//content = write_worksheet(ws, {"hello": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_freeze_panes_vert.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F42").value = "hello";
|
||||
ws.freeze_panes = "D1";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_freeze_panes_vert.xml"), content);
|
||||
}
|
||||
|
||||
void test_freeze_panes_both()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("F42").value = "hello";
|
||||
//ws.freeze_panes = "D4";
|
||||
//content = write_worksheet(ws, {"hello": 0}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "sheet1_freeze_panes_both.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("F42").value = "hello";
|
||||
ws.freeze_panes = "D4";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_freeze_panes_both.xml"), content);
|
||||
}
|
||||
|
||||
void test_long_number()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("A1").value = 9781231231230;
|
||||
//content = write_worksheet(ws, {}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "long_number.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("A1").value = 9781231231230;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"long_number.xml"), content);
|
||||
}
|
||||
|
||||
void test_decimal()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("A1").value = decimal.Decimal("3.14");
|
||||
//content = write_worksheet(ws, {}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "decimal.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("A1").value = decimal.Decimal("3.14");
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"decimal.xml"), content);
|
||||
}
|
||||
|
||||
void test_short_number()
|
||||
{
|
||||
//wb = Workbook();
|
||||
//ws = wb.create_sheet();
|
||||
//ws.cell("A1").value = 1234567890;
|
||||
//content = write_worksheet(ws, {}, {});
|
||||
//assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
// "short_number.xml"), content);
|
||||
wb = Workbook();
|
||||
ws = wb.create_sheet();
|
||||
ws.cell("A1").value = 1234567890;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"short_number.xml"), content);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
#include <cxxtest/TestRunner.h>
|
||||
#include <cxxtest/RealDescriptions.h>
|
||||
#include <cxxtest/TestMain.h>
|
||||
#include <cxxtest/ErrorPrinter.h>
|
||||
#include <cxxtest/ParenPrinter.h>
|
||||
|
||||
int main( int argc, char *argv[] ) {
|
||||
int status;
|
||||
CxxTest::ErrorPrinter tmp;
|
||||
CxxTest::ParenPrinter tmp;
|
||||
CxxTest::RealWorldDescription::_worldName = "cxxtest";
|
||||
status = CxxTest::Main< CxxTest::ErrorPrinter >( tmp, argc, argv );
|
||||
status = CxxTest::Main< CxxTest::ParenPrinter >( tmp, argc, argv );
|
||||
return status;
|
||||
}
|
||||
bool suite_CellTestSuite_init = false;
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/CellTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\CellTestSuite.h"
|
||||
|
||||
static CellTestSuite suite_CellTestSuite;
|
||||
|
||||
|
@ -130,55 +130,61 @@ public:
|
|||
void runTest() { suite_CellTestSuite.test_leading_zero(); }
|
||||
} testDescription_suite_CellTestSuite_test_leading_zero;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_error_codes : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_error_codes() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 188, "test_error_codes" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_error_codes(); }
|
||||
} testDescription_suite_CellTestSuite_test_error_codes;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_data_type_check : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_data_type_check() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 200, "test_data_type_check" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_data_type_check() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 202, "test_data_type_check" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_data_type_check(); }
|
||||
} testDescription_suite_CellTestSuite_test_data_type_check;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_set_bad_type : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_set_bad_type() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 219, "test_set_bad_type" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_set_bad_type() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 220, "test_set_bad_type" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_set_bad_type(); }
|
||||
} testDescription_suite_CellTestSuite_test_set_bad_type;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_time : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_time() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 229, "test_time" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_time() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 230, "test_time" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_time(); }
|
||||
} testDescription_suite_CellTestSuite_test_time;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_date_format_on_non_date : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_date_format_on_non_date() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 258, "test_date_format_on_non_date" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_date_format_on_non_date() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 252, "test_date_format_on_non_date" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_date_format_on_non_date(); }
|
||||
} testDescription_suite_CellTestSuite_test_date_format_on_non_date;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_set_get_date : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_set_get_date() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 271, "test_set_get_date" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_set_get_date() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 265, "test_set_get_date" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_set_get_date(); }
|
||||
} testDescription_suite_CellTestSuite_test_set_get_date;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_repr : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_repr() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 289, "test_repr" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_repr() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 283, "test_repr" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_repr(); }
|
||||
} testDescription_suite_CellTestSuite_test_repr;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_is_date : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_is_date() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 298, "test_is_date" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_is_date() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 292, "test_is_date" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_is_date(); }
|
||||
} testDescription_suite_CellTestSuite_test_is_date;
|
||||
|
||||
static class TestDescription_suite_CellTestSuite_test_is_not_date_color_format : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_CellTestSuite_test_is_not_date_color_format() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 315, "test_is_not_date_color_format" ) {}
|
||||
TestDescription_suite_CellTestSuite_test_is_not_date_color_format() : CxxTest::RealTestDescription( Tests_CellTestSuite, suiteDescription_CellTestSuite, 309, "test_is_not_date_color_format" ) {}
|
||||
void runTest() { suite_CellTestSuite.test_is_not_date_color_format(); }
|
||||
} testDescription_suite_CellTestSuite_test_is_not_date_color_format;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/ChartTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\ChartTestSuite.h"
|
||||
|
||||
static ChartTestSuite suite_ChartTestSuite;
|
||||
|
||||
|
@ -269,7 +275,7 @@ public:
|
|||
void runTest() { suite_ChartTestSuite.test_write_chart_scatter(); }
|
||||
} testDescription_suite_ChartTestSuite_test_write_chart_scatter;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/DumpTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\DumpTestSuite.h"
|
||||
|
||||
static DumpTestSuite suite_DumpTestSuite;
|
||||
|
||||
|
@ -318,20 +324,7 @@ public:
|
|||
void runTest() { suite_DumpTestSuite.test_append_after_save(); }
|
||||
} testDescription_suite_DumpTestSuite_test_append_after_save;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/IntegrationTestSuite.h"
|
||||
|
||||
static IntegrationTestSuite suite_IntegrationTestSuite;
|
||||
|
||||
static CxxTest::List Tests_IntegrationTestSuite = { 0, 0 };
|
||||
CxxTest::StaticSuiteDescription suiteDescription_IntegrationTestSuite( "../../source/tests/IntegrationTestSuite.h", 8, "IntegrationTestSuite", suite_IntegrationTestSuite, Tests_IntegrationTestSuite );
|
||||
|
||||
static class TestDescription_suite_IntegrationTestSuite_test_1 : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_IntegrationTestSuite_test_1() : CxxTest::RealTestDescription( Tests_IntegrationTestSuite, suiteDescription_IntegrationTestSuite, 16, "test_1" ) {}
|
||||
void runTest() { suite_IntegrationTestSuite.test_1(); }
|
||||
} testDescription_suite_IntegrationTestSuite_test_1;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/IterTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\IterTestSuite.h"
|
||||
|
||||
static IterTestSuite suite_IterTestSuite;
|
||||
|
||||
|
@ -386,7 +379,7 @@ public:
|
|||
void runTest() { suite_IterTestSuite.test_read_single_cell_date(); }
|
||||
} testDescription_suite_IterTestSuite_test_read_single_cell_date;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/MetaTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\MetaTestSuite.h"
|
||||
|
||||
static MetaTestSuite suite_MetaTestSuite;
|
||||
|
||||
|
@ -405,7 +398,7 @@ public:
|
|||
void runTest() { suite_MetaTestSuite.test_write_root_rels(); }
|
||||
} testDescription_suite_MetaTestSuite_test_write_root_rels;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/NamedRangeTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\NamedRangeTestSuite.h"
|
||||
|
||||
static NamedRangeTestSuite suite_NamedRangeTestSuite;
|
||||
|
||||
|
@ -496,7 +489,7 @@ public:
|
|||
void runTest() { suite_NamedRangeTestSuite.test_can_be_saved(); }
|
||||
} testDescription_suite_NamedRangeTestSuite_test_can_be_saved;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/NullableTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\NullableTestSuite.h"
|
||||
|
||||
static NullableTestSuite suite_NullableTestSuite;
|
||||
|
||||
|
@ -533,7 +526,7 @@ public:
|
|||
void runTest() { suite_NullableTestSuite.test_copy_constructor(); }
|
||||
} testDescription_suite_NullableTestSuite_test_copy_constructor;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/NumberFormatTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\NumberFormatTestSuite.h"
|
||||
|
||||
static NumberFormatTestSuite suite_NumberFormatTestSuite;
|
||||
|
||||
|
@ -636,32 +629,44 @@ public:
|
|||
void runTest() { suite_NumberFormatTestSuite.test_mac_date(); }
|
||||
} testDescription_suite_NumberFormatTestSuite_test_mac_date;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/PackageTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\PackageTestSuite.h"
|
||||
|
||||
static PackageTestSuite suite_PackageTestSuite;
|
||||
|
||||
static CxxTest::List Tests_PackageTestSuite = { 0, 0 };
|
||||
CxxTest::StaticSuiteDescription suiteDescription_PackageTestSuite( "../../source/tests/PackageTestSuite.h", 8, "PackageTestSuite", suite_PackageTestSuite, Tests_PackageTestSuite );
|
||||
|
||||
static class TestDescription_suite_PackageTestSuite_test_existing_package : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_PackageTestSuite_test_existing_package() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 21, "test_existing_package" ) {}
|
||||
void runTest() { suite_PackageTestSuite.test_existing_package(); }
|
||||
} testDescription_suite_PackageTestSuite_test_existing_package;
|
||||
|
||||
static class TestDescription_suite_PackageTestSuite_test_new_package : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_PackageTestSuite_test_new_package() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 27, "test_new_package" ) {}
|
||||
void runTest() { suite_PackageTestSuite.test_new_package(); }
|
||||
} testDescription_suite_PackageTestSuite_test_new_package;
|
||||
|
||||
static class TestDescription_suite_PackageTestSuite_test_read_text : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_PackageTestSuite_test_read_text() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 16, "test_read_text" ) {}
|
||||
TestDescription_suite_PackageTestSuite_test_read_text() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 38, "test_read_text" ) {}
|
||||
void runTest() { suite_PackageTestSuite.test_read_text(); }
|
||||
} testDescription_suite_PackageTestSuite_test_read_text;
|
||||
|
||||
static class TestDescription_suite_PackageTestSuite_test_write_text : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_PackageTestSuite_test_write_text() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 28, "test_write_text" ) {}
|
||||
TestDescription_suite_PackageTestSuite_test_write_text() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 50, "test_write_text" ) {}
|
||||
void runTest() { suite_PackageTestSuite.test_write_text(); }
|
||||
} testDescription_suite_PackageTestSuite_test_write_text;
|
||||
|
||||
static class TestDescription_suite_PackageTestSuite_test_read_xml : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_PackageTestSuite_test_read_xml() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 53, "test_read_xml" ) {}
|
||||
TestDescription_suite_PackageTestSuite_test_read_xml() : CxxTest::RealTestDescription( Tests_PackageTestSuite, suiteDescription_PackageTestSuite, 75, "test_read_xml" ) {}
|
||||
void runTest() { suite_PackageTestSuite.test_read_xml(); }
|
||||
} testDescription_suite_PackageTestSuite_test_read_xml;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/PasswordHashTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\PasswordHashTestSuite.h"
|
||||
|
||||
static PasswordHashTestSuite suite_PasswordHashTestSuite;
|
||||
|
||||
|
@ -680,7 +685,7 @@ public:
|
|||
void runTest() { suite_PasswordHashTestSuite.test_sheet_protection(); }
|
||||
} testDescription_suite_PasswordHashTestSuite_test_sheet_protection;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/PropsTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\PropsTestSuite.h"
|
||||
|
||||
static PropsTestSuite suite_PropsTestSuite;
|
||||
|
||||
|
@ -729,7 +734,7 @@ public:
|
|||
void runTest() { suite_PropsTestSuite.test_write_properties_app(); }
|
||||
} testDescription_suite_PropsTestSuite_test_write_properties_app;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/ReadTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\ReadTestSuite.h"
|
||||
|
||||
static ReadTestSuite suite_ReadTestSuite;
|
||||
|
||||
|
@ -862,7 +867,7 @@ public:
|
|||
void runTest() { suite_ReadTestSuite.test_read_date_value(); }
|
||||
} testDescription_suite_ReadTestSuite_test_read_date_value;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/StringsTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\StringsTestSuite.h"
|
||||
|
||||
static StringsTestSuite suite_StringsTestSuite;
|
||||
|
||||
|
@ -893,7 +898,7 @@ public:
|
|||
void runTest() { suite_StringsTestSuite.test_formatted_string_table(); }
|
||||
} testDescription_suite_StringsTestSuite_test_formatted_string_table;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/StyleTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\StyleTestSuite.h"
|
||||
|
||||
static StyleTestSuite suite_StyleTestSuite;
|
||||
|
||||
|
@ -990,7 +995,7 @@ public:
|
|||
void runTest() { suite_StyleTestSuite.test_read_cell_style(); }
|
||||
} testDescription_suite_StyleTestSuite_test_read_cell_style;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/ThemeTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\ThemeTestSuite.h"
|
||||
|
||||
static ThemeTestSuite suite_ThemeTestSuite;
|
||||
|
||||
|
@ -1003,7 +1008,7 @@ public:
|
|||
void runTest() { suite_ThemeTestSuite.test_write_theme(); }
|
||||
} testDescription_suite_ThemeTestSuite_test_write_theme;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/UnicodeTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\UnicodeTestSuite.h"
|
||||
|
||||
static UnicodeTestSuite suite_UnicodeTestSuite;
|
||||
|
||||
|
@ -1016,7 +1021,7 @@ public:
|
|||
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 "C:\Users\taf656\Development\xlnt\source\tests\WorkbookTestSuite.h"
|
||||
|
||||
static WorkbookTestSuite suite_WorkbookTestSuite;
|
||||
|
||||
|
@ -1121,67 +1126,67 @@ public:
|
|||
|
||||
static class TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2 : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 138, "test_create_sheet_readonly2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 137, "test_create_sheet_readonly2" ) {}
|
||||
void runTest() { suite_WorkbookTestSuite.test_create_sheet_readonly2(); }
|
||||
} testDescription_suite_WorkbookTestSuite_test_create_sheet_readonly2;
|
||||
|
||||
static class TestDescription_suite_WorkbookTestSuite_test_remove_sheet2 : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_remove_sheet2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 145, "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(); }
|
||||
} testDescription_suite_WorkbookTestSuite_test_remove_sheet2;
|
||||
|
||||
static class TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2 : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 153, "test_get_sheet_by_name2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_sheet_by_name2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 152, "test_get_sheet_by_name2" ) {}
|
||||
void runTest() { 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 {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_index() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 163, "test_get_index" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_index() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 162, "test_get_index" ) {}
|
||||
void runTest() { 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, 171, "test_get_sheet_names2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_sheet_names2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 170, "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, 183, "test_get_named_ranges" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_named_ranges() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 182, "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 {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_add_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 189, "test_add_named_range" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_add_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 188, "test_add_named_range" ) {}
|
||||
void runTest() { 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 {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 199, "test_get_named_range2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 198, "test_get_named_range2" ) {}
|
||||
void runTest() { 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, 209, "test_remove_named_range2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_remove_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 208, "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, 221, "test_add_local_named_range2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_add_local_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 219, "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, 233, "test_write_regular_date" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_write_regular_date() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 232, "test_write_regular_date" ) {}
|
||||
void runTest() { suite_WorkbookTestSuite.test_write_regular_date(); }
|
||||
} testDescription_suite_WorkbookTestSuite_test_write_regular_date;
|
||||
|
||||
|
@ -1193,65 +1198,65 @@ public:
|
|||
|
||||
static class TestDescription_suite_WorkbookTestSuite_test_bad_encoding2 : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_bad_encoding2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 266, "test_bad_encoding2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_bad_encoding2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 267, "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, 276, "test_good_encoding2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_good_encoding2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 278, "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, 286, "test_add_named_range2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_add_named_range2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 288, "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, 296, "test_get_named_range" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_get_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 298, "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 {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_remove_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 306, "test_remove_named_range" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_remove_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 308, "test_remove_named_range" ) {}
|
||||
void runTest() { 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 {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_add_local_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 318, "test_add_local_named_range" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_add_local_named_range() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 319, "test_add_local_named_range" ) {}
|
||||
void runTest() { 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 {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_write_regular_date2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 331, "test_write_regular_date2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_write_regular_date2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 332, "test_write_regular_date2" ) {}
|
||||
void runTest() { suite_WorkbookTestSuite.test_write_regular_date2(); }
|
||||
} testDescription_suite_WorkbookTestSuite_test_write_regular_date2;
|
||||
|
||||
static class TestDescription_suite_WorkbookTestSuite_test_write_regular_float2 : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_write_regular_float2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 348, "test_write_regular_float2" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_write_regular_float2() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 350, "test_write_regular_float2" ) {}
|
||||
void runTest() { suite_WorkbookTestSuite.test_write_regular_float2(); }
|
||||
} testDescription_suite_WorkbookTestSuite_test_write_regular_float2;
|
||||
|
||||
static class TestDescription_suite_WorkbookTestSuite_test_bad_encoding : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorkbookTestSuite_test_bad_encoding() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 364, "test_bad_encoding" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_bad_encoding() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 369, "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, 374, "test_good_encoding" ) {}
|
||||
TestDescription_suite_WorkbookTestSuite_test_good_encoding() : CxxTest::RealTestDescription( Tests_WorkbookTestSuite, suiteDescription_WorkbookTestSuite, 379, "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 "C:\Users\taf656\Development\xlnt\source\tests\WorksheetTestSuite.h"
|
||||
|
||||
static WorksheetTestSuite suite_WorksheetTestSuite;
|
||||
|
||||
|
@ -1260,185 +1265,185 @@ CxxTest::StaticSuiteDescription suiteDescription_WorksheetTestSuite( "../../sour
|
|||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_new_worksheet : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_new_worksheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 18, "test_new_worksheet" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_new_worksheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 15, "test_new_worksheet" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_new_worksheet(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_new_worksheet;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_new_sheet_name : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_new_sheet_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 24, "test_new_sheet_name" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_new_sheet_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 21, "test_new_sheet_name" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_new_sheet_name(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_new_sheet_name;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_get_cell : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_get_cell() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 31, "test_get_cell" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_get_cell() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 28, "test_get_cell" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_get_cell(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_get_cell;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_set_bad_title : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_set_bad_title() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 38, "test_set_bad_title" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_set_bad_title() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 35, "test_set_bad_title" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_set_bad_title(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_set_bad_title;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_set_bad_title_character : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_set_bad_title_character() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 43, "test_set_bad_title_character" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_set_bad_title_character() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 40, "test_set_bad_title_character" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_set_bad_title_character(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_set_bad_title_character;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_worksheet_dimension : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 54, "test_worksheet_dimension" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 51, "test_worksheet_dimension" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_worksheet_dimension(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_worksheet_dimension;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_worksheet_range : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_worksheet_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 62, "test_worksheet_range" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_worksheet_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 59, "test_worksheet_range" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_worksheet_range(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_worksheet_range;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_worksheet_named_range : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 71, "test_worksheet_named_range" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 68, "test_worksheet_named_range" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_worksheet_named_range(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_worksheet_named_range;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_bad_named_range : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_bad_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 80, "test_bad_named_range" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_bad_named_range() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 77, "test_bad_named_range" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_bad_named_range(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_bad_named_range;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 86, "test_named_range_wrong_sheet" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 83, "test_named_range_wrong_sheet" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_named_range_wrong_sheet(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_named_range_wrong_sheet;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_cell_offset : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 94, "test_cell_offset" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 91, "test_cell_offset" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_cell_offset(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_cell_offset;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_range_offset : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_range_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 100, "test_range_offset" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_range_offset() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 97, "test_range_offset" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_range_offset(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_range_offset;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 110, "test_cell_alternate_coordinates" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 107, "test_cell_alternate_coordinates" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_cell_alternate_coordinates(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_cell_alternate_coordinates;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 117, "test_cell_insufficient_coordinates" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 114, "test_cell_insufficient_coordinates" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_cell_insufficient_coordinates(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_cell_insufficient_coordinates;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_cell_range_name : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_range_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 123, "test_cell_range_name" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_cell_range_name() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 120, "test_cell_range_name" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_cell_range_name(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_cell_range_name;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_garbage_collect : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_garbage_collect() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 135, "test_garbage_collect" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_garbage_collect() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 132, "test_garbage_collect" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_garbage_collect(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_garbage_collect;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_hyperlink_relationships : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 148, "test_hyperlink_relationships" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 145, "test_hyperlink_relationships" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_hyperlink_relationships(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_hyperlink_relationships;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_bad_relationship_type : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 168, "test_bad_relationship_type" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 165, "test_bad_relationship_type" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_bad_relationship_type(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_bad_relationship_type;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_append_list : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 173, "test_append_list" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 170, "test_append_list" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_append_list(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_append_list;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_append_dict_letter : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 183, "test_append_dict_letter" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 180, "test_append_dict_letter" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_append_dict_letter(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_append_dict_letter;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_append_dict_index : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_dict_index() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 193, "test_append_dict_index" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_dict_index() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 190, "test_append_dict_index" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_append_dict_index(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_append_dict_index;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_bad_append : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_bad_append() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 203, "test_bad_append" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_bad_append() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 200, "test_bad_append" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_bad_append(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_bad_append;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_append_2d_list : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_2d_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 209, "test_append_2d_list" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_append_2d_list() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 206, "test_append_2d_list" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_append_2d_list(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_append_2d_list;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_rows : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_rows() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 222, "test_rows" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_rows() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 219, "test_rows" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_rows(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_rows;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_cols : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_cols() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 237, "test_cols" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_cols() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 234, "test_cols" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_cols(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_cols;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_auto_filter : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_auto_filter() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 252, "test_auto_filter" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_auto_filter() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 249, "test_auto_filter" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_auto_filter(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_auto_filter;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_page_margins : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_page_margins() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 265, "test_page_margins" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_page_margins() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 262, "test_page_margins" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_page_margins(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_page_margins;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_merge : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_merge() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 282, "test_merge" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_merge() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 279, "test_merge" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_merge(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_merge;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_freeze : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_freeze() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 302, "test_freeze" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_freeze() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 299, "test_freeze" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_freeze(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_freeze;
|
||||
|
||||
static class TestDescription_suite_WorksheetTestSuite_test_printer_settings : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WorksheetTestSuite_test_printer_settings() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 318, "test_printer_settings" ) {}
|
||||
TestDescription_suite_WorksheetTestSuite_test_printer_settings() : CxxTest::RealTestDescription( Tests_WorksheetTestSuite, suiteDescription_WorksheetTestSuite, 315, "test_printer_settings" ) {}
|
||||
void runTest() { suite_WorksheetTestSuite.test_printer_settings(); }
|
||||
} testDescription_suite_WorksheetTestSuite_test_printer_settings;
|
||||
|
||||
#include "/Users/thomas/Development/xlnt/source/tests/WriteTestSuite.h"
|
||||
#include "C:\Users\taf656\Development\xlnt\source\tests\WriteTestSuite.h"
|
||||
|
||||
static WriteTestSuite suite_WriteTestSuite;
|
||||
|
||||
|
|
Binary file not shown.
530
source/xlnt.cpp
530
source/xlnt.cpp
|
@ -2,6 +2,7 @@
|
|||
#include <array>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <locale>
|
||||
#include <sstream>
|
||||
|
||||
#include "xlnt.h"
|
||||
|
@ -19,10 +20,272 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
const std::array<unsigned char, 3086> existing_xlsx = {
|
||||
0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
|
||||
0x21, 0x00, 0xf8, 0x17, 0x86, 0x86, 0x7a, 0x01, 0x00, 0x00, 0x10, 0x03,
|
||||
0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x64, 0x6f, 0x63, 0x50, 0x72, 0x6f,
|
||||
0x70, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2e, 0x78, 0x6d, 0x6c, 0x9d, 0x92,
|
||||
0x41, 0x6f, 0xdb, 0x30, 0x0c, 0x85, 0xef, 0x03, 0xf6, 0x1f, 0x0c, 0xdd,
|
||||
0x1b, 0x39, 0x5d, 0x31, 0x0c, 0x81, 0xac, 0xa2, 0x48, 0x3b, 0xf4, 0xb0,
|
||||
0x61, 0x01, 0x92, 0x76, 0x67, 0x4e, 0xa6, 0x63, 0xa1, 0xb2, 0x24, 0x88,
|
||||
0xac, 0x91, 0xec, 0xd7, 0x4f, 0x76, 0x10, 0xd7, 0x59, 0x77, 0xda, 0xed,
|
||||
0x91, 0x7c, 0x78, 0xfe, 0x4c, 0x4a, 0xdd, 0x1e, 0x3a, 0x57, 0xf4, 0x98,
|
||||
0xc8, 0x06, 0x5f, 0x89, 0xe5, 0xa2, 0x14, 0x05, 0x7a, 0x13, 0x6a, 0xeb,
|
||||
0xf7, 0x95, 0x78, 0xda, 0x7d, 0xbd, 0xfa, 0x22, 0x0a, 0x62, 0xf0, 0x35,
|
||||
0xb8, 0xe0, 0xb1, 0x12, 0x47, 0x24, 0x71, 0xab, 0x3f, 0x7e, 0x50, 0x9b,
|
||||
0x14, 0x22, 0x26, 0xb6, 0x48, 0x45, 0x8e, 0xf0, 0x54, 0x89, 0x96, 0x39,
|
||||
0xae, 0xa4, 0x24, 0xd3, 0x62, 0x07, 0xb4, 0xc8, 0x63, 0x9f, 0x27, 0x4d,
|
||||
0x48, 0x1d, 0x70, 0x2e, 0xd3, 0x5e, 0x86, 0xa6, 0xb1, 0x06, 0xef, 0x83,
|
||||
0x79, 0xed, 0xd0, 0xb3, 0xbc, 0x2e, 0xcb, 0xcf, 0x12, 0x0f, 0x8c, 0xbe,
|
||||
0xc6, 0xfa, 0x2a, 0x4e, 0x81, 0xe2, 0x94, 0xb8, 0xea, 0xf9, 0x7f, 0x43,
|
||||
0xeb, 0x60, 0x06, 0x3e, 0x7a, 0xde, 0x1d, 0x63, 0xce, 0xd3, 0xea, 0x2e,
|
||||
0x46, 0x67, 0x0d, 0x70, 0xfe, 0x4b, 0xfd, 0xdd, 0x9a, 0x14, 0x28, 0x34,
|
||||
0x5c, 0x3c, 0x1c, 0x0c, 0x3a, 0x25, 0xe7, 0x43, 0x95, 0x83, 0xb6, 0x68,
|
||||
0x5e, 0x93, 0xe5, 0xa3, 0x2e, 0x95, 0x9c, 0x97, 0x6a, 0x6b, 0xc0, 0xe1,
|
||||
0x3a, 0x07, 0xeb, 0x06, 0x1c, 0xa1, 0x92, 0x6f, 0x0d, 0xf5, 0x88, 0x30,
|
||||
0x2c, 0x6d, 0x03, 0x36, 0x91, 0x56, 0x3d, 0xaf, 0x7a, 0x34, 0x1c, 0x52,
|
||||
0x41, 0xf6, 0x77, 0x5e, 0xdb, 0xb5, 0x28, 0x7e, 0x01, 0xe1, 0x80, 0x53,
|
||||
0x89, 0x1e, 0x92, 0x05, 0xcf, 0xe2, 0x64, 0x3b, 0x15, 0xa3, 0x76, 0x91,
|
||||
0x38, 0xe9, 0x9f, 0x21, 0xbd, 0x50, 0x8b, 0xc8, 0xa4, 0xe4, 0xd4, 0x1c,
|
||||
0xe5, 0xdc, 0x3b, 0xd7, 0xf6, 0x46, 0x2f, 0x47, 0x43, 0x16, 0x97, 0x46,
|
||||
0x39, 0x81, 0x64, 0x7d, 0x89, 0xb8, 0xb3, 0xec, 0x90, 0x7e, 0x34, 0x1b,
|
||||
0x48, 0xfc, 0x0f, 0xe2, 0xe5, 0x9c, 0x78, 0x64, 0x10, 0x33, 0xc6, 0x91,
|
||||
0xef, 0x1d, 0xde, 0xf9, 0x43, 0x7f, 0x45, 0xaf, 0x43, 0x17, 0xc1, 0xe7,
|
||||
0xfd, 0xc9, 0x49, 0x7d, 0xb3, 0xfe, 0x85, 0x9e, 0xe2, 0x2e, 0xdc, 0x03,
|
||||
0xe3, 0x79, 0x9b, 0x97, 0x4d, 0xb5, 0x6d, 0x21, 0x61, 0x9d, 0x0f, 0x30,
|
||||
0x6d, 0x7b, 0x6a, 0xa8, 0xc7, 0x8c, 0x95, 0xdc, 0xe0, 0x5f, 0xb7, 0xe0,
|
||||
0xf7, 0x58, 0x9f, 0x3d, 0xef, 0x07, 0xc3, 0xed, 0x9f, 0x4f, 0x0f, 0x5c,
|
||||
0x2f, 0x6f, 0x16, 0xe5, 0xa7, 0xb2, 0x1c, 0x4f, 0x7e, 0xee, 0x29, 0xf9,
|
||||
0xf6, 0x94, 0xf5, 0x1f, 0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0xa2, 0xc0, 0x5e, 0x9a, 0x32, 0x01,
|
||||
0x00, 0x00, 0x51, 0x02, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x64, 0x6f,
|
||||
0x63, 0x50, 0x72, 0x6f, 0x70, 0x73, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2e,
|
||||
0x78, 0x6d, 0x6c, 0x7d, 0x92, 0x5f, 0x6b, 0xc3, 0x20, 0x14, 0xc5, 0xdf,
|
||||
0x07, 0xfb, 0x0e, 0xc1, 0xf7, 0x44, 0xed, 0x3f, 0x36, 0x49, 0x52, 0xd8,
|
||||
0x46, 0x9f, 0x56, 0x18, 0x2c, 0xa3, 0x63, 0x6f, 0xa2, 0xb7, 0xad, 0x2c,
|
||||
0x1a, 0x51, 0xb7, 0xb4, 0xdf, 0x7e, 0x26, 0x6d, 0xd3, 0x16, 0xca, 0xc0,
|
||||
0x17, 0x3d, 0xe7, 0xfe, 0xee, 0xb9, 0x17, 0xf3, 0xf9, 0x4e, 0xd7, 0xc9,
|
||||
0x2f, 0x38, 0xaf, 0x1a, 0x53, 0x20, 0x9a, 0x11, 0x94, 0x80, 0x11, 0x8d,
|
||||
0x54, 0x66, 0x53, 0xa0, 0x8f, 0x6a, 0x91, 0x3e, 0xa0, 0xc4, 0x07, 0x6e,
|
||||
0x24, 0xaf, 0x1b, 0x03, 0x05, 0xda, 0x83, 0x47, 0xf3, 0xf2, 0xfe, 0x2e,
|
||||
0x17, 0x96, 0x89, 0xc6, 0xc1, 0x9b, 0x6b, 0x2c, 0xb8, 0xa0, 0xc0, 0x27,
|
||||
0x91, 0x64, 0x3c, 0x13, 0xb6, 0x40, 0xdb, 0x10, 0x2c, 0xc3, 0xd8, 0x8b,
|
||||
0x2d, 0x68, 0xee, 0xb3, 0xe8, 0x30, 0x51, 0x5c, 0x37, 0x4e, 0xf3, 0x10,
|
||||
0xaf, 0x6e, 0x83, 0x2d, 0x17, 0xdf, 0x7c, 0x03, 0x78, 0x44, 0xc8, 0x0c,
|
||||
0x6b, 0x08, 0x5c, 0xf2, 0xc0, 0x71, 0x07, 0x4c, 0xed, 0x40, 0x44, 0x47,
|
||||
0xa4, 0x14, 0x03, 0xd2, 0xfe, 0xb8, 0xba, 0x07, 0x48, 0x81, 0xa1, 0x06,
|
||||
0x0d, 0x26, 0x78, 0x4c, 0x33, 0x8a, 0xcf, 0xde, 0x00, 0x4e, 0xfb, 0x9b,
|
||||
0x05, 0xbd, 0x72, 0xe1, 0xd4, 0x2a, 0xec, 0x2d, 0xdc, 0xb4, 0x9e, 0xc4,
|
||||
0xc1, 0xbd, 0xf3, 0x6a, 0x30, 0xb6, 0x6d, 0x9b, 0xb5, 0xe3, 0xde, 0x1a,
|
||||
0xf3, 0x53, 0xfc, 0xb9, 0x7c, 0x7d, 0xef, 0x47, 0x4d, 0x95, 0xe9, 0x76,
|
||||
0x25, 0x00, 0x95, 0xb9, 0x14, 0x4c, 0x38, 0xe0, 0xa1, 0x71, 0x65, 0x8e,
|
||||
0x2f, 0x2f, 0x71, 0x71, 0x35, 0xf7, 0x61, 0x19, 0x77, 0xbc, 0x56, 0x20,
|
||||
0x9f, 0xf6, 0x51, 0xbf, 0xf1, 0x76, 0x1c, 0xe4, 0x50, 0x07, 0x32, 0x89,
|
||||
0x01, 0xd8, 0x21, 0xee, 0x49, 0x59, 0x8d, 0x9f, 0x5f, 0xaa, 0x05, 0x2a,
|
||||
0xbb, 0x1d, 0xa6, 0xe4, 0x31, 0xa5, 0xb3, 0x8a, 0x10, 0xd6, 0x9f, 0xaf,
|
||||
0xae, 0xe5, 0x55, 0xfd, 0x19, 0xa8, 0x8f, 0x4d, 0xfe, 0x25, 0xd2, 0x49,
|
||||
0x4a, 0xa6, 0x29, 0x1d, 0x55, 0x74, 0xc2, 0xa6, 0x33, 0x46, 0xa7, 0x17,
|
||||
0xc4, 0x13, 0xe0, 0x90, 0xfb, 0xfa, 0x13, 0x94, 0x7f, 0x50, 0x4b, 0x03,
|
||||
0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x57, 0xac, 0x44, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09,
|
||||
0x00, 0x00, 0x00, 0x78, 0x6c, 0x2f, 0x5f, 0x72, 0x65, 0x6c, 0x73, 0x2f,
|
||||
0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x4d, 0x57,
|
||||
0xac, 0x44, 0xc4, 0x41, 0xfb, 0x70, 0xb7, 0x00, 0x00, 0x00, 0x2c, 0x01,
|
||||
0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x78, 0x6c, 0x2f, 0x5f, 0x72, 0x65,
|
||||
0x6c, 0x73, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e,
|
||||
0x78, 0x6d, 0x6c, 0x2e, 0x72, 0x65, 0x6c, 0x73, 0x8d, 0xcf, 0xcd, 0x0a,
|
||||
0xc2, 0x30, 0x0c, 0x07, 0xf0, 0xbb, 0xe0, 0x3b, 0x94, 0xdc, 0x5d, 0x36,
|
||||
0x0f, 0x22, 0xb2, 0x6e, 0x17, 0x11, 0x76, 0x95, 0xf9, 0x00, 0xa5, 0xcb,
|
||||
0x3e, 0xd8, 0xd6, 0x96, 0xa6, 0x7e, 0xec, 0xed, 0x2d, 0x1e, 0x44, 0xc1,
|
||||
0x83, 0xa7, 0x90, 0x84, 0xfc, 0xc2, 0x3f, 0x2f, 0x1f, 0xf3, 0x24, 0x6e,
|
||||
0xe4, 0x79, 0xb0, 0x46, 0x42, 0x96, 0xa4, 0x20, 0xc8, 0x68, 0xdb, 0x0c,
|
||||
0xa6, 0x93, 0x70, 0xa9, 0x4f, 0x9b, 0x3d, 0x08, 0x0e, 0xca, 0x34, 0x6a,
|
||||
0xb2, 0x86, 0x24, 0x2c, 0xc4, 0x50, 0x16, 0xeb, 0x55, 0x7e, 0xa6, 0x49,
|
||||
0x85, 0x78, 0xc4, 0xfd, 0xe0, 0x58, 0x44, 0xc5, 0xb0, 0x84, 0x3e, 0x04,
|
||||
0x77, 0x40, 0x64, 0xdd, 0xd3, 0xac, 0x38, 0xb1, 0x8e, 0x4c, 0xdc, 0xb4,
|
||||
0xd6, 0xcf, 0x2a, 0xc4, 0xd6, 0x77, 0xe8, 0x94, 0x1e, 0x55, 0x47, 0xb8,
|
||||
0x4d, 0xd3, 0x1d, 0xfa, 0x4f, 0x03, 0x8a, 0x2f, 0x53, 0x54, 0x8d, 0x04,
|
||||
0x5f, 0x35, 0x19, 0x88, 0x7a, 0x71, 0xf4, 0x8f, 0x6d, 0xdb, 0x76, 0xd0,
|
||||
0x74, 0xb4, 0xfa, 0x3a, 0x93, 0x09, 0x3f, 0x5e, 0xe0, 0xdd, 0xfa, 0x91,
|
||||
0x7b, 0xa2, 0x10, 0x51, 0xe5, 0x3b, 0x0a, 0x12, 0xde, 0x23, 0xc6, 0x57,
|
||||
0xc9, 0x92, 0xa8, 0x02, 0x16, 0x39, 0x7e, 0x25, 0x8c, 0x91, 0x9f, 0x50,
|
||||
0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21,
|
||||
0x00, 0x2c, 0x65, 0xe1, 0xa5, 0x48, 0x01, 0x00, 0x00, 0x26, 0x02, 0x00,
|
||||
0x00, 0x0f, 0x00, 0x00, 0x00, 0x78, 0x6c, 0x2f, 0x77, 0x6f, 0x72, 0x6b,
|
||||
0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x78, 0x6d, 0x6c, 0x8d, 0x91, 0xc1, 0x4e,
|
||||
0xc3, 0x30, 0x0c, 0x86, 0xef, 0x48, 0xbc, 0x43, 0xe4, 0x3b, 0x6b, 0x9b,
|
||||
0x95, 0x69, 0x4c, 0x6b, 0x27, 0x21, 0x40, 0xec, 0x82, 0x76, 0x18, 0xec,
|
||||
0x1c, 0x1a, 0x77, 0x8d, 0x96, 0x26, 0x55, 0x92, 0xae, 0xdb, 0xdb, 0xe3,
|
||||
0xb6, 0x2a, 0xe3, 0xc8, 0xc9, 0xfe, 0x9d, 0xf8, 0xcb, 0x6f, 0x67, 0xbd,
|
||||
0xb9, 0xd4, 0x9a, 0x9d, 0xd1, 0x79, 0x65, 0x4d, 0x06, 0xc9, 0x2c, 0x06,
|
||||
0x86, 0xa6, 0xb0, 0x52, 0x99, 0x63, 0x06, 0x9f, 0xfb, 0xb7, 0x87, 0x25,
|
||||
0x30, 0x1f, 0x84, 0x91, 0x42, 0x5b, 0x83, 0x19, 0x5c, 0xd1, 0xc3, 0x26,
|
||||
0xbf, 0xbf, 0x5b, 0x77, 0xd6, 0x9d, 0xbe, 0xad, 0x3d, 0x31, 0x02, 0x18,
|
||||
0x9f, 0x41, 0x15, 0x42, 0xb3, 0x8a, 0x22, 0x5f, 0x54, 0x58, 0x0b, 0x3f,
|
||||
0xb3, 0x0d, 0x1a, 0x3a, 0x29, 0xad, 0xab, 0x45, 0x20, 0xe9, 0x8e, 0x91,
|
||||
0x6f, 0x1c, 0x0a, 0xe9, 0x2b, 0xc4, 0x50, 0xeb, 0x88, 0xc7, 0xf1, 0x22,
|
||||
0xaa, 0x85, 0x32, 0x30, 0x12, 0x56, 0xee, 0x3f, 0x0c, 0x5b, 0x96, 0xaa,
|
||||
0xc0, 0x17, 0x5b, 0xb4, 0x35, 0x9a, 0x30, 0x42, 0x1c, 0x6a, 0x11, 0xc8,
|
||||
0xbe, 0xaf, 0x54, 0xe3, 0x21, 0x5f, 0x97, 0x4a, 0xe3, 0xd7, 0x38, 0x11,
|
||||
0x13, 0x4d, 0xf3, 0x21, 0x6a, 0xf2, 0x7d, 0xd1, 0xc0, 0xb4, 0xf0, 0xe1,
|
||||
0x55, 0xaa, 0x80, 0x32, 0x83, 0x47, 0x92, 0xb6, 0xc3, 0x5b, 0x21, 0x05,
|
||||
0xe6, 0xda, 0xe6, 0xb9, 0x55, 0x9a, 0xc4, 0xd3, 0x3c, 0x9e, 0x43, 0x94,
|
||||
0xff, 0x0e, 0xb9, 0x73, 0x8c, 0xa8, 0x01, 0xdd, 0xce, 0xa9, 0xb3, 0x28,
|
||||
0xae, 0xb4, 0x29, 0x60, 0x12, 0x4b, 0xd1, 0xea, 0xb0, 0x27, 0xb3, 0xd3,
|
||||
0x7b, 0x54, 0xe7, 0x29, 0xe7, 0x8b, 0xbe, 0xb7, 0xef, 0xfb, 0x52, 0xd8,
|
||||
0xf9, 0x1b, 0xa6, 0x97, 0xec, 0x72, 0x50, 0x46, 0xda, 0x2e, 0x03, 0x9e,
|
||||
0xd2, 0xb2, 0xaf, 0x93, 0x4a, 0x62, 0xb2, 0xd4, 0x0d, 0xe2, 0xa0, 0x64,
|
||||
0xa8, 0xa8, 0x92, 0x2e, 0x6f, 0xb5, 0x77, 0x54, 0xc7, 0x2a, 0x64, 0xb0,
|
||||
0x8c, 0x93, 0xb8, 0xa7, 0x47, 0x7f, 0xf0, 0xc3, 0x4a, 0xa7, 0xc8, 0xcc,
|
||||
0x30, 0xef, 0x90, 0xd3, 0xd7, 0xf5, 0x61, 0x2b, 0x07, 0xbf, 0x6e, 0xa5,
|
||||
0x28, 0x71, 0x5b, 0x99, 0x0c, 0x80, 0xa9, 0xab, 0x10, 0xba, 0xa0, 0xf9,
|
||||
0xfa, 0x30, 0x5c, 0xe4, 0x9c, 0x27, 0xe3, 0x8d, 0xc9, 0x76, 0xfe, 0x03,
|
||||
0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x57,
|
||||
0xac, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x78, 0x6c, 0x2f, 0x77, 0x6f, 0x72,
|
||||
0x6b, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x50, 0x4b, 0x03, 0x04,
|
||||
0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0xe6, 0x55,
|
||||
0xa8, 0xe3, 0x5d, 0x01, 0x00, 0x00, 0x84, 0x02, 0x00, 0x00, 0x18, 0x00,
|
||||
0x00, 0x00, 0x78, 0x6c, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x68, 0x65,
|
||||
0x65, 0x74, 0x73, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x31, 0x2e, 0x78,
|
||||
0x6d, 0x6c, 0x8d, 0x92, 0x4f, 0x6b, 0x02, 0x31, 0x10, 0xc5, 0xef, 0x85,
|
||||
0x7e, 0x87, 0x90, 0xbb, 0x46, 0x6d, 0x6d, 0xab, 0xb8, 0x4a, 0x41, 0xa4,
|
||||
0x1e, 0x0a, 0xa5, 0xff, 0xee, 0xd9, 0xec, 0xec, 0x6e, 0x30, 0xc9, 0x2c,
|
||||
0xc9, 0x58, 0xf5, 0xdb, 0x77, 0x76, 0xad, 0x52, 0xf0, 0xe2, 0x6d, 0x5e,
|
||||
0x26, 0xf3, 0xe3, 0xbd, 0x49, 0x66, 0x8b, 0xbd, 0x77, 0xe2, 0x07, 0x62,
|
||||
0xb2, 0x18, 0x32, 0x39, 0xec, 0x0f, 0xa4, 0x80, 0x60, 0xb0, 0xb0, 0xa1,
|
||||
0xca, 0xe4, 0xd7, 0xe7, 0xaa, 0xf7, 0x24, 0x45, 0x22, 0x1d, 0x0a, 0xed,
|
||||
0x30, 0x40, 0x26, 0x0f, 0x90, 0xe4, 0x62, 0x7e, 0x7b, 0x33, 0xdb, 0x61,
|
||||
0xdc, 0xa4, 0x1a, 0x80, 0x04, 0x13, 0x42, 0xca, 0x64, 0x4d, 0xd4, 0x4c,
|
||||
0x95, 0x4a, 0xa6, 0x06, 0xaf, 0x53, 0x1f, 0x1b, 0x08, 0xdc, 0x29, 0x31,
|
||||
0x7a, 0x4d, 0x2c, 0x63, 0xa5, 0x52, 0x13, 0x41, 0x17, 0xdd, 0x90, 0x77,
|
||||
0x6a, 0x34, 0x18, 0x3c, 0x28, 0xaf, 0x6d, 0x90, 0x47, 0xc2, 0x34, 0x5e,
|
||||
0xc3, 0xc0, 0xb2, 0xb4, 0x06, 0x96, 0x68, 0xb6, 0x1e, 0x02, 0x1d, 0x21,
|
||||
0x11, 0x9c, 0x26, 0xf6, 0x9f, 0x6a, 0xdb, 0xa4, 0x13, 0xcd, 0x9b, 0x6b,
|
||||
0x70, 0x5e, 0xc7, 0xcd, 0xb6, 0xe9, 0x19, 0xf4, 0x0d, 0x23, 0x72, 0xeb,
|
||||
0x2c, 0x1d, 0x3a, 0xa8, 0x14, 0xde, 0x4c, 0xd7, 0x55, 0xc0, 0xa8, 0x73,
|
||||
0xc7, 0xb9, 0xf7, 0xc3, 0x7b, 0x6d, 0x4e, 0xec, 0x4e, 0x5c, 0xe0, 0xbd,
|
||||
0x35, 0x11, 0x13, 0x96, 0xd4, 0x67, 0xdc, 0x9f, 0xd1, 0xcb, 0xcc, 0x13,
|
||||
0x35, 0x51, 0x4c, 0x9a, 0xcf, 0x0a, 0xcb, 0x09, 0xda, 0xb5, 0x8b, 0x08,
|
||||
0x65, 0x26, 0x9f, 0x87, 0x52, 0xcd, 0x67, 0xdd, 0xc5, 0x6f, 0x0b, 0xbb,
|
||||
0xf4, 0xaf, 0x16, 0xa4, 0xf3, 0x0f, 0x70, 0x60, 0x08, 0x0a, 0x7e, 0x23,
|
||||
0x29, 0xda, 0xdd, 0xe7, 0x88, 0x9b, 0xb6, 0xb9, 0xe6, 0xa3, 0x41, 0x3b,
|
||||
0xaa, 0x2e, 0x66, 0x57, 0x5d, 0xd0, 0xb7, 0x28, 0x0a, 0x28, 0xf5, 0xd6,
|
||||
0xd1, 0x3b, 0xee, 0x5e, 0xc0, 0x56, 0x35, 0x31, 0x64, 0xcc, 0x59, 0xda,
|
||||
0x14, 0xd3, 0xe2, 0xb0, 0x84, 0x64, 0x78, 0x97, 0x8c, 0xe9, 0x8f, 0xc6,
|
||||
0x67, 0x13, 0x4b, 0x4d, 0x9a, 0xeb, 0x46, 0x57, 0xf0, 0xaa, 0x63, 0x65,
|
||||
0x43, 0x12, 0x0e, 0xca, 0xee, 0xd6, 0xa3, 0x14, 0xf1, 0x88, 0xe9, 0x6a,
|
||||
0xc2, 0xa6, 0xab, 0x18, 0x99, 0x23, 0x11, 0xfa, 0x93, 0xaa, 0x39, 0x39,
|
||||
0xc4, 0x56, 0xdd, 0x49, 0x51, 0x22, 0xd2, 0x49, 0xb4, 0x6e, 0xcf, 0xff,
|
||||
0x67, 0xfe, 0x0b, 0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x08,
|
||||
0x00, 0x65, 0x57, 0xac, 0x44, 0xba, 0x83, 0x84, 0x3d, 0x2a, 0x01, 0x00,
|
||||
0x00, 0x1f, 0x03, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x5b, 0x43, 0x6f,
|
||||
0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x54, 0x79, 0x70, 0x65, 0x73, 0x5d,
|
||||
0x2e, 0x78, 0x6d, 0x6c, 0xad, 0x92, 0xcd, 0x6e, 0xc2, 0x30, 0x10, 0x84,
|
||||
0xef, 0x95, 0xfa, 0x0e, 0x96, 0xaf, 0x28, 0x36, 0xf4, 0x50, 0x55, 0x15,
|
||||
0x81, 0x43, 0x7f, 0x8e, 0x2d, 0x07, 0xfa, 0x00, 0xae, 0xbd, 0x49, 0x2c,
|
||||
0xfc, 0x27, 0xaf, 0xa1, 0xf0, 0xf6, 0xdd, 0x04, 0xda, 0x03, 0xa2, 0xb4,
|
||||
0x48, 0x3d, 0x59, 0xc9, 0xce, 0xcc, 0x37, 0x89, 0x77, 0x3a, 0xdf, 0x7a,
|
||||
0xc7, 0x36, 0x90, 0xd1, 0xc6, 0x50, 0xf3, 0x89, 0x18, 0x73, 0x06, 0x41,
|
||||
0x47, 0x63, 0x43, 0x5b, 0xf3, 0xb7, 0xe5, 0x73, 0x75, 0xc7, 0x19, 0x16,
|
||||
0x15, 0x8c, 0x72, 0x31, 0x40, 0xcd, 0x77, 0x80, 0x7c, 0x3e, 0xbb, 0xbe,
|
||||
0x9a, 0x2e, 0x77, 0x09, 0x90, 0x91, 0x3b, 0x60, 0xcd, 0xbb, 0x52, 0xd2,
|
||||
0xbd, 0x94, 0xa8, 0x3b, 0xf0, 0x0a, 0x45, 0x4c, 0x10, 0x68, 0xd2, 0xc4,
|
||||
0xec, 0x55, 0xa1, 0xc7, 0xdc, 0xca, 0xa4, 0xf4, 0x4a, 0xb5, 0x20, 0x6f,
|
||||
0xc6, 0xe3, 0x5b, 0xa9, 0x63, 0x28, 0x10, 0x4a, 0x55, 0xfa, 0x0c, 0x3e,
|
||||
0x9b, 0x3e, 0x42, 0xa3, 0xd6, 0xae, 0xb0, 0xa7, 0x2d, 0xbd, 0xde, 0x37,
|
||||
0xc9, 0xe0, 0x90, 0xb3, 0x87, 0xbd, 0xb0, 0x67, 0xd5, 0x5c, 0xa5, 0xe4,
|
||||
0xac, 0x56, 0x85, 0xe6, 0x72, 0x13, 0xcc, 0x11, 0xa5, 0x3a, 0x10, 0x04,
|
||||
0x39, 0x07, 0x0d, 0x76, 0x36, 0xe1, 0x88, 0x04, 0x5c, 0x9e, 0x24, 0xf4,
|
||||
0x93, 0x9f, 0x01, 0x07, 0xdf, 0x2b, 0xfd, 0x9a, 0x6c, 0x0d, 0xb0, 0x85,
|
||||
0xca, 0xe5, 0x45, 0x79, 0x52, 0xc9, 0xad, 0x93, 0x1f, 0x31, 0xaf, 0xde,
|
||||
0x63, 0x5c, 0x89, 0xf3, 0x21, 0x27, 0x5a, 0xc6, 0xa6, 0xb1, 0x1a, 0x4c,
|
||||
0xd4, 0x6b, 0x4f, 0x16, 0x81, 0x29, 0x83, 0x32, 0xd8, 0x01, 0x14, 0xef,
|
||||
0xc4, 0x70, 0x0a, 0xaf, 0x6c, 0x18, 0xfd, 0xce, 0x1f, 0xc4, 0x28, 0x87,
|
||||
0x63, 0xf2, 0xcf, 0x45, 0xbe, 0xf3, 0xcf, 0xf5, 0x20, 0xef, 0x22, 0xc7,
|
||||
0x84, 0x74, 0x9d, 0x19, 0x2e, 0x2f, 0xf0, 0x75, 0x5f, 0xbd, 0xbb, 0x4a,
|
||||
0x14, 0x04, 0xb9, 0x58, 0xc0, 0x3f, 0x11, 0x29, 0xfa, 0x72, 0xe0, 0xd1,
|
||||
0x17, 0x43, 0xbf, 0x0a, 0x06, 0xcc, 0x09, 0xb6, 0x1c, 0x96, 0x9b, 0xb6,
|
||||
0xfc, 0x13, 0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00,
|
||||
0x00, 0x00, 0x21, 0x00, 0xb5, 0x55, 0x30, 0x23, 0xec, 0x00, 0x00, 0x00,
|
||||
0x4c, 0x02, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5f, 0x72, 0x65, 0x6c,
|
||||
0x73, 0x2f, 0x2e, 0x72, 0x65, 0x6c, 0x73, 0x8d, 0x92, 0xcd, 0x4e, 0xc3,
|
||||
0x30, 0x0c, 0x80, 0xef, 0x48, 0xbc, 0x43, 0xe4, 0xfb, 0xea, 0x6e, 0x48,
|
||||
0x08, 0xa1, 0xa5, 0xbb, 0x20, 0xa4, 0xdd, 0x10, 0x2a, 0x0f, 0x60, 0x12,
|
||||
0xf7, 0x47, 0x6d, 0xe3, 0x28, 0x09, 0xd0, 0xbd, 0x3d, 0xe1, 0x80, 0xa0,
|
||||
0xd2, 0x18, 0x3d, 0xc6, 0xb1, 0x3f, 0x7f, 0xb6, 0xbc, 0x3f, 0xcc, 0xd3,
|
||||
0xa8, 0xde, 0x39, 0xc4, 0x5e, 0x9c, 0x86, 0x6d, 0x51, 0x82, 0x62, 0x67,
|
||||
0xc4, 0xf6, 0xae, 0xd5, 0xf0, 0x52, 0x3f, 0x6e, 0xee, 0x40, 0xc5, 0x44,
|
||||
0xce, 0xd2, 0x28, 0x8e, 0x35, 0x9c, 0x38, 0xc2, 0xa1, 0xba, 0xbe, 0xda,
|
||||
0x3f, 0xf3, 0x48, 0x29, 0x17, 0xc5, 0xae, 0xf7, 0x51, 0x65, 0x8a, 0x8b,
|
||||
0x1a, 0xba, 0x94, 0xfc, 0x3d, 0x62, 0x34, 0x1d, 0x4f, 0x14, 0x0b, 0xf1,
|
||||
0xec, 0xf2, 0x4f, 0x23, 0x61, 0xa2, 0x94, 0x9f, 0xa1, 0x45, 0x4f, 0x66,
|
||||
0xa0, 0x96, 0x71, 0x57, 0x96, 0xb7, 0x18, 0x7e, 0x33, 0xa0, 0x5a, 0x30,
|
||||
0xd5, 0xd1, 0x6a, 0x08, 0x47, 0x7b, 0x03, 0xaa, 0x3e, 0x79, 0x5e, 0xc3,
|
||||
0x96, 0xa6, 0xe9, 0x0d, 0x3f, 0x88, 0x79, 0x9b, 0xd8, 0xa5, 0x33, 0x2d,
|
||||
0x90, 0xe7, 0xc4, 0xce, 0xb2, 0xdd, 0xf8, 0x90, 0xeb, 0x43, 0xea, 0xf3,
|
||||
0x34, 0xaa, 0xa6, 0xd0, 0x72, 0xd2, 0x60, 0xc5, 0x3c, 0xe5, 0x70, 0x44,
|
||||
0xf2, 0xbe, 0xc8, 0x68, 0xc0, 0xf3, 0x46, 0xbb, 0xf5, 0x46, 0x7f, 0x4f,
|
||||
0x8b, 0x13, 0x27, 0xb2, 0x94, 0x08, 0x8d, 0x04, 0xbe, 0xec, 0xf3, 0x95,
|
||||
0x71, 0x49, 0x68, 0xbb, 0x5e, 0xe8, 0xff, 0x15, 0x2d, 0x33, 0x7e, 0x6c,
|
||||
0xe6, 0x11, 0x3f, 0x24, 0x0c, 0xaf, 0x22, 0xc3, 0xb7, 0x0b, 0x2e, 0x6e,
|
||||
0xa0, 0xfa, 0x04, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00, 0x00,
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0xf8, 0x17, 0x86, 0x86, 0x7a,
|
||||
0x01, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x64, 0x6f, 0x63, 0x50, 0x72, 0x6f, 0x70, 0x73, 0x2f, 0x61, 0x70,
|
||||
0x70, 0x2e, 0x78, 0x6d, 0x6c, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0xa2, 0xc0, 0x5e,
|
||||
0x9a, 0x32, 0x01, 0x00, 0x00, 0x51, 0x02, 0x00, 0x00, 0x11, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0xa8,
|
||||
0x01, 0x00, 0x00, 0x64, 0x6f, 0x63, 0x50, 0x72, 0x6f, 0x70, 0x73, 0x2f,
|
||||
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x78, 0x6d, 0x6c, 0x50, 0x4b, 0x01, 0x02,
|
||||
0x14, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x57, 0xac, 0x44,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x00, 0x00, 0x09, 0x03, 0x00, 0x00, 0x78, 0x6c, 0x2f, 0x5f, 0x72, 0x65,
|
||||
0x6c, 0x73, 0x2f, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00, 0x00,
|
||||
0x00, 0x08, 0x00, 0x4d, 0x57, 0xac, 0x44, 0xc4, 0x41, 0xfb, 0x70, 0xb7,
|
||||
0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x30, 0x03, 0x00,
|
||||
0x00, 0x78, 0x6c, 0x2f, 0x5f, 0x72, 0x65, 0x6c, 0x73, 0x2f, 0x77, 0x6f,
|
||||
0x72, 0x6b, 0x62, 0x6f, 0x6f, 0x6b, 0x2e, 0x78, 0x6d, 0x6c, 0x2e, 0x72,
|
||||
0x65, 0x6c, 0x73, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00, 0x00,
|
||||
0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0x2c, 0x65, 0xe1, 0xa5, 0x48,
|
||||
0x01, 0x00, 0x00, 0x26, 0x02, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x1f, 0x04, 0x00,
|
||||
0x00, 0x78, 0x6c, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x62, 0x6f, 0x6f, 0x6b,
|
||||
0x2e, 0x78, 0x6d, 0x6c, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x11, 0x57, 0xac, 0x44, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x94, 0x05,
|
||||
0x00, 0x00, 0x78, 0x6c, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x68, 0x65,
|
||||
0x65, 0x74, 0x73, 0x2f, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00,
|
||||
0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0xe6, 0x55, 0xa8, 0xe3,
|
||||
0x5d, 0x01, 0x00, 0x00, 0x84, 0x02, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0xc0, 0x05,
|
||||
0x00, 0x00, 0x78, 0x6c, 0x2f, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x68, 0x65,
|
||||
0x65, 0x74, 0x73, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x31, 0x2e, 0x78,
|
||||
0x6d, 0x6c, 0x50, 0x4b, 0x01, 0x02, 0x14, 0x00, 0x14, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x65, 0x57, 0xac, 0x44, 0xba, 0x83, 0x84, 0x3d, 0x2a, 0x01,
|
||||
0x00, 0x00, 0x1f, 0x03, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00, 0x00, 0x53, 0x07, 0x00, 0x00,
|
||||
0x5b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x54, 0x79, 0x70,
|
||||
0x65, 0x73, 0x5d, 0x2e, 0x78, 0x6d, 0x6c, 0x50, 0x4b, 0x01, 0x02, 0x14,
|
||||
0x00, 0x14, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x21, 0x00, 0xb5,
|
||||
0x55, 0x30, 0x23, 0xec, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x0b,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00, 0x00,
|
||||
0x00, 0xae, 0x08, 0x00, 0x00, 0x5f, 0x72, 0x65, 0x6c, 0x73, 0x2f, 0x2e,
|
||||
0x72, 0x65, 0x6c, 0x73, 0x50, 0x4b, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00,
|
||||
0x09, 0x00, 0x09, 0x00, 0x35, 0x02, 0x00, 0x00, 0xc3, 0x09, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#include <Shlwapi.h>
|
||||
void file::copy(const std::string &source, const std::string &destination, bool overwrite)
|
||||
{
|
||||
assert(source.size() + 1 < MAX_PATH);
|
||||
|
@ -35,7 +298,6 @@ void file::copy(const std::string &source, const std::string &destination, bool
|
|||
|
||||
if(result == 0)
|
||||
{
|
||||
DWORD error = GetLastError();
|
||||
switch(GetLastError())
|
||||
{
|
||||
case ERROR_ACCESS_DENIED: throw std::runtime_error("Access is denied");
|
||||
|
@ -100,7 +362,8 @@ struct part_struct
|
|||
: package_(package),
|
||||
uri_(uri),
|
||||
container_(container)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
relationship create_relationship(const std::string &target_uri, target_mode target_mode, const std::string &relationship_type);
|
||||
|
||||
|
@ -136,6 +399,12 @@ struct part_struct
|
|||
auto name = uri_;
|
||||
auto name_pointer = name.c_str();
|
||||
|
||||
auto match = opcPartFind(container_, (xmlChar*)name_pointer, nullptr, 0);
|
||||
if(match == nullptr)
|
||||
{
|
||||
match = opcPartCreate(container_, (xmlChar*)name_pointer, nullptr, 0);
|
||||
}
|
||||
|
||||
auto part_stream = opcContainerCreateOutputStream(container_, (xmlChar*)name_pointer, opcCompressionOption_t::OPC_COMPRESSIONOPTION_NORMAL);
|
||||
|
||||
std::stringstream ss(data);
|
||||
|
@ -172,12 +441,6 @@ struct part_struct
|
|||
opcContainer *container_;
|
||||
};
|
||||
|
||||
part::part(package_impl &package, const std::string &uri, opcContainer *container)
|
||||
: root_(new part_struct(package, uri, container))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
part::part(part_struct *root) : root_(root)
|
||||
{
|
||||
|
||||
|
@ -220,6 +483,8 @@ bool part::operator==(const std::nullptr_t &) const
|
|||
|
||||
struct package_impl
|
||||
{
|
||||
static const int BufferSize = 4096 * 4;
|
||||
|
||||
package *parent_;
|
||||
opcContainer *opc_container_;
|
||||
std::iostream &stream_;
|
||||
|
@ -244,16 +509,16 @@ struct package_impl
|
|||
: stream_(stream),
|
||||
package_mode_(package_mode),
|
||||
package_access_(package_access),
|
||||
container_buffer_(4096)
|
||||
container_buffer_(BufferSize)
|
||||
{
|
||||
open_container();
|
||||
}
|
||||
|
||||
package_impl(const std::string &path, file_mode package_mode, file_access package_access)
|
||||
: stream_(file_stream_),
|
||||
package_mode_(package_mode),
|
||||
package_access_(package_access),
|
||||
container_buffer_(4096)
|
||||
container_buffer_(BufferSize),
|
||||
filename_(path)
|
||||
{
|
||||
switch(package_mode)
|
||||
{
|
||||
|
@ -272,10 +537,10 @@ struct package_impl
|
|||
switch(package_access)
|
||||
{
|
||||
case file_access::Read:
|
||||
file_stream_.open(path, std::ios::binary | std::ios::in);
|
||||
file_stream_.open(path, std::ios::binary | std::ios::in | std::ios::trunc);
|
||||
break;
|
||||
case file_access::ReadWrite:
|
||||
file_stream_.open(path, std::ios::binary | std::ios::in | std::ios::out);
|
||||
file_stream_.open(path, std::ios::binary | std::ios::in | std::ios::out | std::ios::trunc);
|
||||
break;
|
||||
case file_access::Write:
|
||||
file_stream_.open(path, std::ios::binary | std::ios::out);
|
||||
|
@ -357,11 +622,22 @@ struct package_impl
|
|||
break;
|
||||
}
|
||||
|
||||
open_container();
|
||||
if(!file_stream_)
|
||||
{
|
||||
throw std::runtime_error("something");
|
||||
}
|
||||
}
|
||||
|
||||
void open_container()
|
||||
{
|
||||
if(package_mode_ != file_mode::Open)
|
||||
{
|
||||
stream_.write((const char *)existing_xlsx.data(), existing_xlsx.size());
|
||||
stream_.seekg(std::ios::beg);
|
||||
stream_.seekp(std::ios::beg);
|
||||
stream_.flush();
|
||||
}
|
||||
|
||||
opcContainerOpenMode m;
|
||||
|
||||
switch(package_access_)
|
||||
|
@ -381,8 +657,15 @@ struct package_impl
|
|||
|
||||
opc_container_ = opcContainerOpenIO(&read_callback, &write_callback,
|
||||
&close_callback, &seek_callback,
|
||||
&trim_callback, &flush_callback, this, 4096, m, this);
|
||||
&trim_callback, &flush_callback, this, BufferSize, m, this);
|
||||
open_ = true;
|
||||
|
||||
type_ = determine_type();
|
||||
|
||||
if(type_ != package::type::Excel)
|
||||
{
|
||||
throw std::runtime_error("only excel spreadsheets are supported for now");
|
||||
}
|
||||
}
|
||||
|
||||
~package_impl()
|
||||
|
@ -390,11 +673,45 @@ struct package_impl
|
|||
close();
|
||||
}
|
||||
|
||||
package::type determine_type()
|
||||
{
|
||||
opcRelation rel = opcRelationFind(opc_container_, OPC_PART_INVALID, NULL, _X("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
|
||||
|
||||
if(OPC_RELATION_INVALID != rel)
|
||||
{
|
||||
opcPart main = opcRelationGetInternalTarget(opc_container_, OPC_PART_INVALID, rel);
|
||||
|
||||
if(OPC_PART_INVALID != main)
|
||||
{
|
||||
const xmlChar *type = opcPartGetType(opc_container_, main);
|
||||
|
||||
if(0 == xmlStrcmp(type, _X("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")))
|
||||
{
|
||||
return package::type::Word;
|
||||
}
|
||||
else if(0 == xmlStrcmp(type, _X("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml")))
|
||||
{
|
||||
return package::type::Powerpoint;
|
||||
}
|
||||
else if(0 == xmlStrcmp(type, _X("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml")))
|
||||
{
|
||||
return package::type::Excel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return package::type::Zip;
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
if(open_)
|
||||
{
|
||||
open_ = false;
|
||||
for(auto part : parts_)
|
||||
{
|
||||
delete part.second;
|
||||
}
|
||||
opcContainerClose(opc_container_, opcContainerCloseMode::OPC_CLOSE_NOW);
|
||||
opc_container_ = nullptr;
|
||||
}
|
||||
|
@ -402,7 +719,11 @@ struct package_impl
|
|||
|
||||
part create_part(const std::string &part_uri, const std::string &/*content_type*/, compression_option /*compression*/)
|
||||
{
|
||||
return part(new part_struct(*this, part_uri, opc_container_));
|
||||
if(parts_.find(part_uri) == parts_.end())
|
||||
{
|
||||
parts_[part_uri] = new part_struct(*this, part_uri, opc_container_);
|
||||
}
|
||||
return part(parts_[part_uri]);
|
||||
}
|
||||
|
||||
void delete_part(const std::string &/*part_uri*/)
|
||||
|
@ -417,7 +738,11 @@ struct package_impl
|
|||
|
||||
part get_part(const std::string &part_uri)
|
||||
{
|
||||
return part(*this, part_uri, opc_container_);
|
||||
if(parts_.find(part_uri) == parts_.end())
|
||||
{
|
||||
parts_[part_uri] = new part_struct(*this, part_uri, opc_container_);
|
||||
}
|
||||
return part(parts_[part_uri]);
|
||||
}
|
||||
|
||||
part_collection get_parts()
|
||||
|
@ -460,8 +785,18 @@ struct package_impl
|
|||
return current_position;
|
||||
}
|
||||
|
||||
int trim(std::ios::pos_type /*new_size*/)
|
||||
int trim(std::ios::pos_type new_size)
|
||||
{
|
||||
file_stream_.flush();
|
||||
std::vector<char> buffer(new_size);
|
||||
auto current_position = stream_.tellg();
|
||||
seek(std::ios::beg);
|
||||
write(buffer.data(), (int)new_size);
|
||||
file_stream_.close();
|
||||
file_stream_.open(filename_, std::ios::trunc | std::ios::out | std::ios::binary | std::ios::in);
|
||||
file_stream_.write(buffer.data(), new_size);
|
||||
seek(current_position);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -502,6 +837,10 @@ struct package_impl
|
|||
object->flush();
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, part_struct *> parts_;
|
||||
package::type type_;
|
||||
std::string filename_;
|
||||
};
|
||||
|
||||
file_access package::get_file_open_access() const
|
||||
|
@ -509,26 +848,42 @@ file_access package::get_file_open_access() const
|
|||
return impl_->get_file_open_access();
|
||||
}
|
||||
|
||||
package package::open(std::iostream &stream, file_mode package_mode, file_access package_access)
|
||||
package::~package()
|
||||
{
|
||||
return package(stream, package_mode, package_access);
|
||||
close();
|
||||
delete impl_;
|
||||
}
|
||||
|
||||
package package::open(const std::string &path, file_mode package_mode, file_access package_access, file_share /*package_share*/)
|
||||
void package::open(std::iostream &stream, file_mode package_mode, file_access package_access)
|
||||
{
|
||||
return package(path, package_mode, package_access);
|
||||
}
|
||||
if(impl_ != nullptr)
|
||||
{
|
||||
close();
|
||||
delete impl_;
|
||||
impl_ = nullptr;
|
||||
}
|
||||
|
||||
package::package(std::iostream &stream, file_mode package_mode, file_access package_access)
|
||||
: impl_(new package_impl(stream, package_mode, package_access))
|
||||
{
|
||||
impl_ = new package_impl(stream, package_mode, package_access);
|
||||
impl_->parent_ = this;
|
||||
open_container();
|
||||
}
|
||||
|
||||
package::package(const std::string &path, file_mode package_mode, file_access package_access)
|
||||
: impl_(new package_impl(path, package_mode, package_access))
|
||||
void package::open(const std::string &path, file_mode package_mode, file_access package_access, file_share /*package_share*/)
|
||||
{
|
||||
if(impl_ != nullptr)
|
||||
{
|
||||
close();
|
||||
delete impl_;
|
||||
impl_ = nullptr;
|
||||
}
|
||||
|
||||
impl_ = new package_impl(path, package_mode, package_access);
|
||||
impl_->parent_ = this;
|
||||
open_container();
|
||||
}
|
||||
|
||||
package::package() : impl_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void package::open_container()
|
||||
|
@ -622,6 +977,18 @@ struct cell_struct
|
|||
worksheet_struct *parent_worksheet;
|
||||
int column;
|
||||
int row;
|
||||
style style;
|
||||
};
|
||||
|
||||
const std::unordered_map<std::string, int> cell::ErrorCodes =
|
||||
{
|
||||
{"#NULL!", 0},
|
||||
{"#DIV/0!", 1},
|
||||
{"#VALUE!", 2},
|
||||
{"#REF!", 3},
|
||||
{"#NAME?", 4},
|
||||
{"#NUM!", 5},
|
||||
{"#N/A!", 6}
|
||||
};
|
||||
|
||||
cell::cell() : root_(nullptr)
|
||||
|
@ -646,6 +1013,62 @@ cell::cell(cell_struct *root) : root_(root)
|
|||
{
|
||||
}
|
||||
|
||||
cell::type cell::data_type_for_value(const std::string &value)
|
||||
{
|
||||
return type::null;
|
||||
}
|
||||
|
||||
void cell::set_explicit_value(const std::string &value, type data_type)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool cell::bind_value()
|
||||
{
|
||||
root_->type = type::null;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cell::bind_value(int value)
|
||||
{
|
||||
root_->type = type::numeric;
|
||||
root_->numeric_value = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cell::bind_value(double value)
|
||||
{
|
||||
root_->type = type::numeric;
|
||||
root_->numeric_value = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cell::bind_value(const std::string &value)
|
||||
{
|
||||
//Given a value, infer type and display options.
|
||||
root_->type = data_type_for_value(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cell::bind_value(const char *value)
|
||||
{
|
||||
return bind_value(std::string(value));
|
||||
}
|
||||
|
||||
bool cell::bind_value(bool value)
|
||||
{
|
||||
root_->type = type::boolean;
|
||||
root_->bool_value = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cell::bind_value(const tm &value)
|
||||
{
|
||||
root_->type = type::date;
|
||||
root_->date_value = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
coordinate cell::coordinate_from_string(const std::string &coord_string)
|
||||
{
|
||||
// Convert a coordinate string like 'B12' to a tuple ('B', 12)
|
||||
|
@ -654,9 +1077,9 @@ coordinate cell::coordinate_from_string(const std::string &coord_string)
|
|||
|
||||
for(auto character : coord_string)
|
||||
{
|
||||
char upper = std::toupper(character);
|
||||
char upper = std::toupper(character, std::locale::classic());
|
||||
|
||||
if(std::isalpha(character))
|
||||
if(std::isalpha(character, std::locale::classic()))
|
||||
{
|
||||
if(column_part)
|
||||
{
|
||||
|
@ -674,7 +1097,7 @@ coordinate cell::coordinate_from_string(const std::string &coord_string)
|
|||
{
|
||||
column_part = false;
|
||||
}
|
||||
else if(!(std::isdigit(character) || character == '$'))
|
||||
else if(!(std::isdigit(character, std::locale::classic()) || character == '$'))
|
||||
{
|
||||
std::string msg = "Invalid cell coordinates (" + coord_string + ")";
|
||||
throw std::runtime_error(msg);
|
||||
|
@ -708,14 +1131,14 @@ int cell::column_index_from_string(const std::string &column_string)
|
|||
int column_index = 0;
|
||||
int place = 1;
|
||||
|
||||
for(int i = column_string.length() - 1; i >= 0; i--)
|
||||
for(int i = static_cast<int>(column_string.length()) - 1; i >= 0; i--)
|
||||
{
|
||||
if(!std::isalpha(column_string[i]))
|
||||
if(!std::isalpha(column_string[i], std::locale::classic()))
|
||||
{
|
||||
throw std::runtime_error("column must contain only letters in the range A-Z");
|
||||
}
|
||||
|
||||
column_index += (std::toupper(column_string[i]) - 'A' + 1) * place;
|
||||
column_index += (std::toupper(column_string[i], std::locale::classic()) - 'A' + 1) * place;
|
||||
place *= 26;
|
||||
}
|
||||
|
||||
|
@ -762,19 +1185,44 @@ bool cell::is_date() const
|
|||
return root_->type == type::date;
|
||||
}
|
||||
|
||||
bool cell::operator==(const std::string &comparand) const
|
||||
{
|
||||
return root_->type == cell::type::string && root_->string_value == comparand;
|
||||
}
|
||||
|
||||
bool cell::operator==(const char *comparand) const
|
||||
{
|
||||
return *this == std::string(comparand);
|
||||
}
|
||||
|
||||
bool cell::operator==(const tm &comparand) const
|
||||
{
|
||||
return root_->type == cell::type::date && root_->date_value.tm_hour == comparand.tm_hour;
|
||||
}
|
||||
|
||||
bool operator==(const char *comparand, const cell &cell)
|
||||
{
|
||||
return std::string(comparand) == cell;
|
||||
return cell == comparand;
|
||||
}
|
||||
|
||||
bool operator==(const std::string &comparand, const cell &cell)
|
||||
{
|
||||
return cell.root_->type == cell::type::string && cell.root_->string_value == comparand;
|
||||
return cell == comparand;
|
||||
}
|
||||
|
||||
bool operator==(const tm &comparand, const cell &cell)
|
||||
{
|
||||
return cell.root_->type == cell::type::date && cell.root_->date_value.tm_hour == comparand.tm_hour;
|
||||
return cell == comparand;
|
||||
}
|
||||
|
||||
style &cell::get_style()
|
||||
{
|
||||
return root_->style;
|
||||
}
|
||||
|
||||
const style &cell::get_style() const
|
||||
{
|
||||
return root_->style;
|
||||
}
|
||||
|
||||
std::string cell::absolute_coordinate(const std::string &absolute_address)
|
||||
|
@ -793,7 +1241,7 @@ std::string cell::absolute_coordinate(const std::string &absolute_address)
|
|||
}
|
||||
}
|
||||
|
||||
cell::type cell::get_data_type()
|
||||
cell::type cell::get_data_type() const
|
||||
{
|
||||
return root_->type;
|
||||
}
|
||||
|
@ -1245,7 +1693,7 @@ worksheet workbook::get_sheet_by_name(const std::string &name)
|
|||
return worksheet(nullptr);
|
||||
}
|
||||
|
||||
worksheet workbook::get_active()
|
||||
worksheet workbook::get_active_sheet()
|
||||
{
|
||||
return active_worksheet_;
|
||||
}
|
||||
|
@ -1300,8 +1748,8 @@ worksheet workbook::operator[](const std::string &name)
|
|||
|
||||
void workbook::save(const std::string &filename)
|
||||
{
|
||||
auto package = package::open(filename);
|
||||
package.close();
|
||||
package p;
|
||||
p.open(filename);
|
||||
}
|
||||
|
||||
std::string cell_struct::to_string() const
|
||||
|
|
|
@ -506,7 +506,6 @@ private:
|
|||
friend struct package_impl;
|
||||
|
||||
part(part_struct *root);
|
||||
part(package_impl &package, const std::string &uri, opcContainer *container);
|
||||
|
||||
part_struct *root_;
|
||||
};
|
||||
|
@ -520,15 +519,28 @@ typedef std::vector<part> part_collection;
|
|||
class package
|
||||
{
|
||||
public:
|
||||
enum class type
|
||||
{
|
||||
Excel,
|
||||
Word,
|
||||
Powerpoint,
|
||||
Zip
|
||||
};
|
||||
|
||||
package();
|
||||
~package();
|
||||
|
||||
type get_type() const;
|
||||
|
||||
/// <summary>
|
||||
/// Opens a package with a given IO stream, file mode, and file access setting.
|
||||
/// </summary>
|
||||
static package open(std::iostream &stream, file_mode package_mode, file_access package_access);
|
||||
void open(std::iostream &stream, file_mode package_mode, file_access package_access);
|
||||
|
||||
/// <summary>
|
||||
/// Opens a package at a given path using a given file mode, file access, and file share setting.
|
||||
/// </summary>
|
||||
static package open(const std::string &path, file_mode package_mode = file_mode::OpenOrCreate,
|
||||
void open(const std::string &path, file_mode package_mode = file_mode::OpenOrCreate,
|
||||
file_access package_access = file_access::ReadWrite, file_share package_share = file_share::None);
|
||||
|
||||
/// <summary>
|
||||
|
@ -767,9 +779,6 @@ public:
|
|||
private:
|
||||
friend opc_callback_handler;
|
||||
|
||||
package(std::iostream &stream, file_mode package_mode, file_access package_access);
|
||||
package(const std::string &path, file_mode package_mode, file_access package_access);
|
||||
|
||||
void open_container();
|
||||
|
||||
int write(char *buffer, int length);
|
||||
|
@ -789,6 +798,25 @@ struct coordinate
|
|||
int row;
|
||||
};
|
||||
|
||||
class number_format
|
||||
{
|
||||
public:
|
||||
void set_format_code(const std::string &format_code) { format_code_ = format_code; }
|
||||
|
||||
private:
|
||||
std::string format_code_;
|
||||
};
|
||||
|
||||
class style
|
||||
{
|
||||
public:
|
||||
number_format &get_number_format() { return number_format_; }
|
||||
const number_format &get_number_format() const { return number_format_; }
|
||||
|
||||
private:
|
||||
number_format number_format_;
|
||||
};
|
||||
|
||||
class cell
|
||||
{
|
||||
public:
|
||||
|
@ -803,6 +831,8 @@ public:
|
|||
error
|
||||
};
|
||||
|
||||
static const std::unordered_map<std::string, int> ErrorCodes;
|
||||
|
||||
static coordinate coordinate_from_string(const std::string &address);
|
||||
static int column_index_from_string(const std::string &column_string);
|
||||
static std::string get_column_letter(int column_index);
|
||||
|
@ -812,6 +842,17 @@ public:
|
|||
cell(worksheet &ws, const std::string &column, int row);
|
||||
cell(worksheet &ws, const std::string &column, int row, const std::string &initial_value);
|
||||
|
||||
void set_explicit_value(const std::string &value, type data_type);
|
||||
type data_type_for_value(const std::string &value);
|
||||
|
||||
bool bind_value();
|
||||
bool bind_value(int value);
|
||||
bool bind_value(double value);
|
||||
bool bind_value(const std::string &value);
|
||||
bool bind_value(const char *value);
|
||||
bool bind_value(bool value);
|
||||
bool bind_value(const tm &value);
|
||||
|
||||
cell &operator=(int value);
|
||||
cell &operator=(double value);
|
||||
cell &operator=(const std::string &value);
|
||||
|
@ -819,6 +860,10 @@ public:
|
|||
cell &operator=(bool value);
|
||||
cell &operator=(const tm &value);
|
||||
|
||||
bool operator==(const std::string &comparand) const;
|
||||
bool operator==(const char *comparand) const;
|
||||
bool operator==(const tm &comparand) const;
|
||||
|
||||
friend bool operator==(const std::string &comparand, const cell &cell);
|
||||
friend bool operator==(const char *comparand, const cell &cell);
|
||||
friend bool operator==(const tm &comparand, const cell &cell);
|
||||
|
@ -826,7 +871,8 @@ public:
|
|||
std::string to_string() const;
|
||||
bool is_date() const;
|
||||
style &get_style();
|
||||
type get_data_type();
|
||||
const style &get_style() const;
|
||||
type get_data_type() const;
|
||||
|
||||
private:
|
||||
friend struct worksheet_struct;
|
||||
|
@ -929,7 +975,7 @@ public:
|
|||
const workbook &operator=(const workbook &) = delete;
|
||||
|
||||
worksheet get_sheet_by_name(const std::string &sheet_name);
|
||||
worksheet get_active();
|
||||
worksheet get_active_sheet();
|
||||
worksheet create_sheet();
|
||||
worksheet create_sheet(std::size_t index);
|
||||
std::vector<std::string> get_sheet_names() const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user