continue synchronizing tests and start implementing styles

This commit is contained in:
Thomas Fussell 2014-07-26 16:19:15 -04:00
parent c5967686ff
commit 16f8c3223a
28 changed files with 654 additions and 370 deletions

View File

@ -86,6 +86,7 @@ public:
bool has_style() const;
style &get_style();
const style &get_style() const;
void set_style(const style &s);
std::pair<int, int> get_anchor() const;
@ -96,8 +97,7 @@ public:
bool is_date() const;
comment get_comment() const;
void set_comment(comment &comment);
void set_comment(comment &&comment);
void set_comment(const comment &comment);
void clear_comment();
bool has_comment() const;

View File

@ -94,6 +94,8 @@ public:
std::string to_string() const;
range_reference to_range() const;
range_reference operator,(const cell_reference &other) const;
bool operator==(const cell_reference &comparand) const;
bool operator==(const std::string &reference_string) const { return *this == cell_reference(reference_string); }
bool operator==(const char *reference_string) const { return *this == std::string(reference_string); }

View File

@ -3,23 +3,20 @@
#include <string>
namespace xlnt {
namespace detail {
struct cell_impl;
struct comment_impl;
} // namespace detail
class comment
{
public:
comment();
comment(const std::string &text, const std::string &author);
~comment();
std::string get_text() const;
std::string get_author() const;
private:
friend class cell;
comment(detail::comment_impl *d);
detail::comment_impl *d_;
std::string text_;
std::string author_;
};
} // namespace xlnt

View File

@ -27,6 +27,7 @@ public:
value();
value(value &&v);
value(const value &v);
value(bool b);
value(int8_t i);
value(int16_t i);

View File

@ -89,6 +89,9 @@ public:
static bool is_date_format(const std::string &format);
static bool is_builtin(const std::string &format);
number_format() : format_code_(format::general), format_index_(0) {}
number_format(format code) : format_code_(code) {}
format get_format_code() const { return format_code_; }
void set_format_code(format format_code) { format_code_ = format_code; }
void set_format_code(const std::string &format_code) { custom_format_code_ = format_code; }

View File

@ -35,8 +35,12 @@ public:
unprotected
};
type locked;
type hidden;
protection();
protection(type locked);
private:
type locked_;
type hidden_;
};
} // namespace xlnt

View File

@ -37,6 +37,7 @@ class style
{
public:
style(bool static_ = false) : static_(static_) {}
style(const style &rhs);
style copy() const;
@ -60,8 +61,6 @@ public:
void set_protection(protection protection);
private:
style(const style &rhs);
bool static_ = false;
font font_;
fill fill_;

View File

@ -307,6 +307,8 @@ public:
const range operator[](const range_reference &reference) const;
range operator[](const std::string &range_string);
const range operator[](const std::string &range_string) const;
range operator()(const cell_reference &top_left, const cell_reference &bottom_right);
const range operator()(const cell_reference &top_left, const cell_reference &bottom_right) const;
// page
page_setup &get_page_setup();

View File

@ -35,27 +35,28 @@ class workbook;
class style_writer
{
public:
style_writer(workbook &wb);
style_writer(const style_writer &);
style_writer &operator=(const style_writer &);
std::unordered_map<std::size_t, std::string> get_style_by_hash() const;
std::string write_table() const;
private:
std::vector<style> get_style_list(const workbook &wb) const;
std::unordered_map<int, std::string> write_fonts() const;
std::unordered_map<int, std::string> write_fills() const;
std::unordered_map<int, std::string> write_borders() const;
void write_cell_style_xfs();
void write_cell_xfs();
void write_cell_style();
void write_dxfs();
void write_table_styles();
void write_number_formats();
std::vector<style> style_list_;
workbook &wb_;
public:
style_writer(workbook &wb);
style_writer(const style_writer &);
style_writer &operator=(const style_writer &);
std::unordered_map<std::size_t, std::string> get_style_by_hash() const;
std::string write_table() const;
std::vector<style> get_styles() const;
private:
std::vector<style> get_style_list(const workbook &wb) const;
std::unordered_map<int, std::string> write_fonts() const;
std::unordered_map<int, std::string> write_fills() const;
std::unordered_map<int, std::string> write_borders() const;
void write_cell_style_xfs();
void write_cell_xfs();
void write_cell_style();
void write_dxfs();
void write_table_styles();
void write_number_formats();
std::vector<style> style_list_;
workbook &wb_;
};
} // namespace xlnt

View File

@ -0,0 +1,9 @@
import sys
def format(args):
print()
for line in sys.stdin.readlines():
print('"' + line.rstrip().replace('"', '\\"') + '"')
if __name__ == '__main__':
format(sys.argv)

View File

@ -324,6 +324,11 @@ const style &cell::get_style() const
}
return *d_->style_;
}
void cell::set_style(const xlnt::style &s)
{
get_style() = s;
}
cell &cell::operator=(const cell &rhs)
{
@ -402,64 +407,29 @@ void cell::clear_formula()
d_->formula_.clear();
}
void cell::set_comment(xlnt::comment &c)
void cell::set_comment(const xlnt::comment &c)
{
if(c.d_->parent_worksheet_ != nullptr)
{
if(c.d_->parent_cell_ != get_reference())
{
throw std::runtime_error("");
}
}
if(d_->comment_.parent_worksheet_ == nullptr)
if(!has_comment())
{
get_parent().increment_comments();
}
d_->comment_.text_ = c.get_text();
d_->comment_.author_ = c.get_author();
d_->comment_.parent_worksheet_ = d_->parent_;
d_->comment_.parent_cell_ = get_reference();
//XXX: there's a memory leak here, not sure how to go about fixing it yet
c.d_ = &d_->comment_;
}
void cell::set_comment(xlnt::comment &&c)
{
if(c.d_->parent_worksheet_ != nullptr && c.d_->parent_cell_ != get_reference())
{
throw std::runtime_error("");
}
if(d_->comment_.parent_worksheet_ == nullptr)
{
get_parent().increment_comments();
}
d_->comment_.text_ = c.get_text();
d_->comment_.author_ = c.get_author();
d_->comment_.parent_worksheet_ = d_->parent_;
d_->comment_.parent_cell_ = get_reference();
d_->comment_ = c;
}
void cell::clear_comment()
{
if(d_->comment_.parent_worksheet_ != nullptr)
if(has_comment())
{
get_parent().decrement_comments();
}
d_->comment_.parent_worksheet_ = nullptr;
d_->comment_.parent_cell_ = "A1";
d_->comment_.text_.clear();
d_->comment_.author_.clear();
d_->comment_ = comment();
}
bool cell::has_comment() const
{
return d_->comment_.parent_worksheet_ != nullptr;
return d_->comment_.get_text() != "";
}
void cell::set_error(const std::string &error)
@ -489,7 +459,7 @@ const worksheet cell::get_parent() const
comment cell::get_comment() const
{
return comment(&d_->comment_);
return d_->comment_;
}
std::pair<int, int> cell::get_anchor() const

View File

@ -57,6 +57,11 @@ absolute_(absolute)
}
}
range_reference cell_reference::operator,(const xlnt::cell_reference &other) const
{
return range_reference(*this, other);
}
std::string cell_reference::to_string() const
{
if(absolute_)

View File

@ -1,47 +1,27 @@
#include "cell/comment.hpp"
#include "detail/comment_impl.hpp"
namespace xlnt {
namespace detail {
detail::comment_impl::comment_impl() : parent_worksheet_(nullptr)
comment::comment(const std::string &text, const std::string &author) : text_(text), author_(author)
{
}
comment_impl::comment_impl(worksheet_impl *ws, const cell_reference &ref, const std::string &text, const std::string &author) : parent_worksheet_(ws), parent_cell_(ref), text_(text), author_(author)
{
}
} // namespace detail
comment::comment(const std::string &text, const std::string &author) : d_(new detail::comment_impl())
{
d_->text_ = text;
d_->author_ = author;
}
comment::comment(detail::comment_impl *d) : d_(d)
comment::comment()
{
}
comment::~comment()
{
if(d_->parent_worksheet_ == nullptr)
{
delete d_;
d_ = nullptr;
}
}
std::string comment::get_author() const
{
return d_->author_;
return author_;
}
std::string comment::get_text() const
{
return d_->text_;
return text_;
}
} // namespace xlnt

View File

@ -4,15 +4,15 @@
namespace xlnt {
namespace detail {
cell_impl::cell_impl() : parent_(nullptr), column_(0), row_(0), style_(nullptr), merged(false), has_hyperlink_(false), comment_(nullptr, "A1", "", ""), is_date_(false)
cell_impl::cell_impl() : parent_(nullptr), column_(0), row_(0), style_(nullptr), merged(false), has_hyperlink_(false), is_date_(false)
{
}
cell_impl::cell_impl(worksheet_impl *parent, int column_index, int row_index) : parent_(parent), column_(column_index), row_(row_index), style_(nullptr), merged(false), has_hyperlink_(false), comment_(nullptr, "A1", "", ""), is_date_(false)
cell_impl::cell_impl(worksheet_impl *parent, int column_index, int row_index) : parent_(parent), column_(column_index), row_(row_index), style_(nullptr), merged(false), has_hyperlink_(false), is_date_(false)
{
}
cell_impl::cell_impl(const cell_impl &rhs) : comment_(nullptr, "A1", "", ""), is_date_(false)
cell_impl::cell_impl(const cell_impl &rhs) : is_date_(false)
{
*this = rhs;
}

View File

@ -1,10 +1,10 @@
#pragma once
#include "cell/cell.hpp"
#include "cell/comment.hpp"
#include "cell/value.hpp"
#include "common/types.hpp"
#include "common/relationship.hpp"
#include "comment_impl.hpp"
namespace xlnt {
@ -31,7 +31,7 @@ struct cell_impl
bool merged;
bool is_date_;
bool has_hyperlink_;
comment_impl comment_;
comment comment_;
};
} // namespace detail

View File

@ -1,24 +0,0 @@
#pragma once
#include "cell/cell_reference.hpp"
namespace xlnt {
namespace detail {
struct worksheet_impl;
struct comment_impl
{
comment_impl();
comment_impl(worksheet_impl *parent, const cell_reference &ref, const std::string &text, const std::string &author);
comment_impl(const comment_impl &rhs);
comment_impl &operator=(const comment_impl &rhs);
worksheet_impl *parent_worksheet_;
cell_reference parent_cell_;
std::string text_;
std::string author_;
};
} // namespace detail
} // namespace xlnt

View File

@ -3,7 +3,6 @@
#include <vector>
#include "cell_impl.hpp"
#include "comment_impl.hpp"
namespace xlnt {

15
source/protection.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "styles/protection.hpp"
namespace xlnt {
protection::protection() : locked_(type::unprotected)
{
}
protection::protection(type t) : locked_(t)
{
}
} // namespace xlnt

19
source/style.cpp Normal file
View File

@ -0,0 +1,19 @@
#include "styles/style.hpp"
namespace xlnt {
style::style(const style &rhs) : protection_(rhs.protection_), number_format_(rhs.number_format_)
{
}
void style::set_protection(xlnt::protection protection)
{
protection_ = protection;
}
void style::set_number_format(xlnt::number_format format)
{
number_format_ = format;
}
} // namespace xlnt

View File

@ -30,4 +30,30 @@ std::unordered_map<std::size_t, std::string> style_writer::get_style_by_hash() c
return styles;
}
std::vector<style> style_writer::get_styles() const
{
std::vector<style> styles;
for(auto ws : wb_)
{
for(auto row : ws.rows())
{
for(auto cell : row)
{
if(cell.has_style())
{
styles.push_back(cell.get_style());
}
}
}
}
return styles;
}
std::string style_writer::write_table() const
{
return "";
}
} // namespace xlnt

View File

@ -19,6 +19,13 @@ value::value(value &&v)
swap(*this, v);
}
value::value(const value &v)
{
type_ = v.type_;
numeric_value_ = v.numeric_value_;
string_value_ = v.string_value_;
}
value::value(bool b) : type_(type::boolean), numeric_value_(b ? 1 : 0)
{
}
@ -49,10 +56,26 @@ value &value::operator=(value other)
return *this;
}
value &value::operator=(int i)
{
return *this = value(i);
}
bool value::is(type t) const
{
return type_ == t;
}
template<>
std::string value::get() const
{
if(type_ == type::string)
{
return string_value_;
}
throw std::runtime_error("not a string");
}
template<>
double value::as() const

View File

@ -1,6 +1,7 @@
#include <algorithm>
#include <array>
#include <fstream>
#include <set>
#include <sstream>
#include <pugixml.hpp>
@ -511,6 +512,31 @@ bool workbook::save(const std::string &filename)
f.set_file_contents("[Content_Types].xml", writer::write_content_types(*this));
f.set_file_contents("docProps/app.xml", writer::write_properties_app(*this));
f.set_file_contents("docProps/core.xml", writer::write_properties_core(get_properties()));
std::set<std::string> shared_strings_set;
for(auto ws : *this)
{
for(auto row : ws.rows())
{
for(auto cell : row)
{
if(cell.get_value().is(value::type::string))
{
shared_strings_set.insert(cell.get_value().get<std::string>());
}
}
}
}
std::vector<std::string> shared_strings(shared_strings_set.begin(), shared_strings_set.end());
f.set_file_contents("xl/sharedStrings.xml", writer::write_shared_strings(shared_strings));
f.set_file_contents("xl/theme/theme1.xml", writer::write_theme());
//f.set_file_contents("xl/styles.xml", writer::wri)
f.set_file_contents("_rels/.rels", writer::write_root_rels());
f.set_file_contents("xl/_rels/workbook.xml.rels", writer::write_workbook_rels(*this));
@ -522,7 +548,9 @@ bool workbook::save(const std::string &filename)
{
std::string sheet_index_string = relationship.get_target_uri().substr(16);
std::size_t sheet_index = std::stoi(sheet_index_string.substr(0, sheet_index_string.find('.'))) - 1;
f.set_file_contents("xl/" + relationship.get_target_uri(), writer::write_worksheet(get_sheet_by_index(sheet_index)));
std::string sheet_uri = "xl/" + relationship.get_target_uri();
auto ws = get_sheet_by_index(sheet_index);
f.set_file_contents(sheet_uri, writer::write_worksheet(ws, shared_strings));
}
}

View File

@ -42,6 +42,11 @@ void worksheet::create_named_range(const std::string &name, const range_referenc
d_->named_ranges_[name] = reference;
}
range worksheet::operator()(const xlnt::cell_reference &top_left, const xlnt::cell_reference &bottom_right)
{
return get_range({top_left, bottom_right});
}
cell worksheet::operator[](const cell_reference &ref)
{
return get_cell(ref);

View File

@ -21,7 +21,7 @@ int main( int argc, char *argv[] ) {
return status;
}
bool suite_test_cell_init = false;
#include "C:\Users\taf656\Development\xlnt\tests\test_cell.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_cell.hpp"
static test_cell suite_test_cell;
@ -250,19 +250,13 @@ public:
void runTest() { suite_test_cell.test_comment_count(); }
} testDescription_suite_test_cell_test_comment_count;
static class TestDescription_suite_test_cell_test_comment_assignment : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_cell_test_comment_assignment() : CxxTest::RealTestDescription( Tests_test_cell, suiteDescription_test_cell, 415, "test_comment_assignment" ) {}
void runTest() { suite_test_cell.test_comment_assignment(); }
} testDescription_suite_test_cell_test_comment_assignment;
static class TestDescription_suite_test_cell_test_cell_offset : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_cell_test_cell_offset() : CxxTest::RealTestDescription( Tests_test_cell, suiteDescription_test_cell, 429, "test_cell_offset" ) {}
TestDescription_suite_test_cell_test_cell_offset() : CxxTest::RealTestDescription( Tests_test_cell, suiteDescription_test_cell, 415, "test_cell_offset" ) {}
void runTest() { suite_test_cell.test_cell_offset(); }
} testDescription_suite_test_cell_test_cell_offset;
#include "C:\Users\taf656\Development\xlnt\tests\test_chart.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_chart.hpp"
static test_chart suite_test_chart;
@ -353,7 +347,7 @@ public:
void runTest() { suite_test_chart.test_write_chart_scatter(); }
} testDescription_suite_test_chart_test_write_chart_scatter;
#include "C:\Users\taf656\Development\xlnt\tests\test_named_range.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_named_range.hpp"
static test_named_range suite_test_named_range;
@ -444,7 +438,7 @@ public:
void runTest() { suite_test_named_range.test_can_be_saved(); }
} testDescription_suite_test_named_range_test_can_be_saved;
#include "C:\Users\taf656\Development\xlnt\tests\test_number_format.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_number_format.hpp"
static test_number_format suite_test_number_format;
@ -547,7 +541,7 @@ public:
void runTest() { suite_test_number_format.test_mac_date(); }
} testDescription_suite_test_number_format_test_mac_date;
#include "C:\Users\taf656\Development\xlnt\tests\test_props.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_props.hpp"
static test_props suite_test_props;
@ -590,7 +584,7 @@ public:
void runTest() { suite_test_props.test_write_properties_app(); }
} testDescription_suite_test_props_test_write_properties_app;
#include "C:\Users\taf656\Development\xlnt\tests\test_read.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_read.hpp"
static test_read suite_test_read;
@ -783,7 +777,7 @@ public:
void runTest() { suite_test_read.test_bad_formats_no(); }
} testDescription_suite_test_read_test_bad_formats_no;
#include "C:\Users\taf656\Development\xlnt\tests\test_strings.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_strings.hpp"
static test_strings suite_test_strings;
@ -814,7 +808,7 @@ public:
void runTest() { suite_test_strings.test_formatted_string_table(); }
} testDescription_suite_test_strings_test_formatted_string_table;
#include "C:\Users\taf656\Development\xlnt\tests\test_style.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_style.hpp"
static test_style suite_test_style;
@ -823,95 +817,107 @@ CxxTest::StaticSuiteDescription suiteDescription_test_style( "../../tests/test_s
static class TestDescription_suite_test_style_test_create_style_table : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_create_style_table() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 11, "test_create_style_table" ) {}
TestDescription_suite_test_style_test_create_style_table() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 31, "test_create_style_table" ) {}
void runTest() { suite_test_style.test_create_style_table(); }
} testDescription_suite_test_style_test_create_style_table;
static class TestDescription_suite_test_style_test_write_style_table : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_write_style_table() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 16, "test_write_style_table" ) {}
TestDescription_suite_test_style_test_write_style_table() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 36, "test_write_style_table" ) {}
void runTest() { suite_test_style.test_write_style_table(); }
} testDescription_suite_test_style_test_write_style_table;
static class TestDescription_suite_test_style_test_no_style : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_no_style() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 28, "test_no_style" ) {}
TestDescription_suite_test_style_test_no_style() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 50, "test_no_style" ) {}
void runTest() { suite_test_style.test_no_style(); }
} testDescription_suite_test_style_test_no_style;
static class TestDescription_suite_test_style_test_nb_style : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_nb_style() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 35, "test_nb_style" ) {}
TestDescription_suite_test_style_test_nb_style() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 57, "test_nb_style" ) {}
void runTest() { suite_test_style.test_nb_style(); }
} testDescription_suite_test_style_test_nb_style;
static class TestDescription_suite_test_style_test_style_unicity : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_style_unicity() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 49, "test_style_unicity" ) {}
TestDescription_suite_test_style_test_style_unicity() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 62, "test_style_unicity" ) {}
void runTest() { suite_test_style.test_style_unicity(); }
} testDescription_suite_test_style_test_style_unicity;
static class TestDescription_suite_test_style_test_fonts : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_fonts() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 59, "test_fonts" ) {}
TestDescription_suite_test_style_test_fonts() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 67, "test_fonts" ) {}
void runTest() { suite_test_style.test_fonts(); }
} testDescription_suite_test_style_test_fonts;
static class TestDescription_suite_test_style_test_fonts_with_underline : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_fonts_with_underline() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 101, "test_fonts_with_underline" ) {}
void runTest() { suite_test_style.test_fonts_with_underline(); }
} testDescription_suite_test_style_test_fonts_with_underline;
static class TestDescription_suite_test_style_test_fills : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_fills() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 73, "test_fills" ) {}
TestDescription_suite_test_style_test_fills() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 136, "test_fills" ) {}
void runTest() { suite_test_style.test_fills(); }
} testDescription_suite_test_style_test_fills;
static class TestDescription_suite_test_style_test_borders : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_borders() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 82, "test_borders" ) {}
TestDescription_suite_test_style_test_borders() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 167, "test_borders" ) {}
void runTest() { suite_test_style.test_borders(); }
} testDescription_suite_test_style_test_borders;
static class TestDescription_suite_test_style_test_write_color : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_write_color() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 203, "test_write_color" ) {}
void runTest() { suite_test_style.test_write_color(); }
} testDescription_suite_test_style_test_write_color;
static class TestDescription_suite_test_style_test_write_cell_xfs_1 : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_write_cell_xfs_1() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 91, "test_write_cell_xfs_1" ) {}
TestDescription_suite_test_style_test_write_cell_xfs_1() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 208, "test_write_cell_xfs_1" ) {}
void runTest() { suite_test_style.test_write_cell_xfs_1(); }
} testDescription_suite_test_style_test_write_cell_xfs_1;
static class TestDescription_suite_test_style_test_alignment : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_alignment() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 105, "test_alignment" ) {}
TestDescription_suite_test_style_test_alignment() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 213, "test_alignment" ) {}
void runTest() { suite_test_style.test_alignment(); }
} testDescription_suite_test_style_test_alignment;
static class TestDescription_suite_test_style_test_alignment_rotation : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_alignment_rotation() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 118, "test_alignment_rotation" ) {}
TestDescription_suite_test_style_test_alignment_rotation() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 218, "test_alignment_rotation" ) {}
void runTest() { suite_test_style.test_alignment_rotation(); }
} testDescription_suite_test_style_test_alignment_rotation;
static class TestDescription_suite_test_style_test_format_comparisions : public CxxTest::RealTestDescription {
static class TestDescription_suite_test_style_test_alignment_indent : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_format_comparisions() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 133, "test_format_comparisions" ) {}
void runTest() { suite_test_style.test_format_comparisions(); }
} testDescription_suite_test_style_test_format_comparisions;
TestDescription_suite_test_style_test_alignment_indent() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 223, "test_alignment_indent" ) {}
void runTest() { suite_test_style.test_alignment_indent(); }
} testDescription_suite_test_style_test_alignment_indent;
static class TestDescription_suite_test_style_test_builtin_format : public CxxTest::RealTestDescription {
static class TestDescription_suite_test_style_test_rewrite_styles : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_builtin_format() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 148, "test_builtin_format" ) {}
void runTest() { suite_test_style.test_builtin_format(); }
} testDescription_suite_test_style_test_builtin_format;
TestDescription_suite_test_style_test_rewrite_styles() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 228, "test_rewrite_styles" ) {}
void runTest() { suite_test_style.test_rewrite_styles(); }
} testDescription_suite_test_style_test_rewrite_styles;
static class TestDescription_suite_test_style_test_read_style : public CxxTest::RealTestDescription {
static class TestDescription_suite_test_style_test_write_dxf : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_read_style() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 156, "test_read_style" ) {}
void runTest() { suite_test_style.test_read_style(); }
} testDescription_suite_test_style_test_read_style;
TestDescription_suite_test_style_test_write_dxf() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 233, "test_write_dxf" ) {}
void runTest() { suite_test_style.test_write_dxf(); }
} testDescription_suite_test_style_test_write_dxf;
static class TestDescription_suite_test_style_test_read_cell_style : public CxxTest::RealTestDescription {
static class TestDescription_suite_test_style_test_protection : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_style_test_read_cell_style() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 173, "test_read_cell_style" ) {}
void runTest() { suite_test_style.test_read_cell_style(); }
} testDescription_suite_test_style_test_read_cell_style;
TestDescription_suite_test_style_test_protection() : CxxTest::RealTestDescription( Tests_test_style, suiteDescription_test_style, 282, "test_protection" ) {}
void runTest() { suite_test_style.test_protection(); }
} testDescription_suite_test_style_test_protection;
#include "C:\Users\taf656\Development\xlnt\tests\test_theme.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_theme.hpp"
static test_theme suite_test_theme;
@ -924,7 +930,7 @@ public:
void runTest() { suite_test_theme.test_write_theme(); }
} testDescription_suite_test_theme_test_write_theme;
#include "C:\Users\taf656\Development\xlnt\tests\test_workbook.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_workbook.hpp"
static test_workbook suite_test_workbook;
@ -1045,7 +1051,7 @@ public:
void runTest() { suite_test_workbook.test_write_regular_float(); }
} testDescription_suite_test_workbook_test_write_regular_float;
#include "C:\Users\taf656\Development\xlnt\tests\test_worksheet.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_worksheet.hpp"
static test_worksheet suite_test_worksheet;
@ -1088,181 +1094,205 @@ public:
void runTest() { suite_test_worksheet.test_set_bad_title_character(); }
} testDescription_suite_test_worksheet_test_set_bad_title_character;
static class TestDescription_suite_test_worksheet_test_unique_sheet_title : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_unique_sheet_title() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 56, "test_unique_sheet_title" ) {}
void runTest() { suite_test_worksheet.test_unique_sheet_title(); }
} testDescription_suite_test_worksheet_test_unique_sheet_title;
static class TestDescription_suite_test_worksheet_test_worksheet_dimension : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 56, "test_worksheet_dimension" ) {}
TestDescription_suite_test_worksheet_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 61, "test_worksheet_dimension" ) {}
void runTest() { suite_test_worksheet.test_worksheet_dimension(); }
} testDescription_suite_test_worksheet_test_worksheet_dimension;
static class TestDescription_suite_test_worksheet_test_worksheet_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_worksheet_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 65, "test_worksheet_range" ) {}
TestDescription_suite_test_worksheet_test_worksheet_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 70, "test_worksheet_range" ) {}
void runTest() { suite_test_worksheet.test_worksheet_range(); }
} testDescription_suite_test_worksheet_test_worksheet_range;
static class TestDescription_suite_test_worksheet_test_worksheet_named_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 73, "test_worksheet_named_range" ) {}
TestDescription_suite_test_worksheet_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 78, "test_worksheet_named_range" ) {}
void runTest() { suite_test_worksheet.test_worksheet_named_range(); }
} testDescription_suite_test_worksheet_test_worksheet_named_range;
static class TestDescription_suite_test_worksheet_test_bad_named_range : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_bad_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 83, "test_bad_named_range" ) {}
TestDescription_suite_test_worksheet_test_bad_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 88, "test_bad_named_range" ) {}
void runTest() { suite_test_worksheet.test_bad_named_range(); }
} testDescription_suite_test_worksheet_test_bad_named_range;
static class TestDescription_suite_test_worksheet_test_named_range_wrong_sheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 89, "test_named_range_wrong_sheet" ) {}
TestDescription_suite_test_worksheet_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 94, "test_named_range_wrong_sheet" ) {}
void runTest() { suite_test_worksheet.test_named_range_wrong_sheet(); }
} testDescription_suite_test_worksheet_test_named_range_wrong_sheet;
static class TestDescription_suite_test_worksheet_test_cell_offset : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_cell_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 97, "test_cell_offset" ) {}
TestDescription_suite_test_worksheet_test_cell_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 102, "test_cell_offset" ) {}
void runTest() { suite_test_worksheet.test_cell_offset(); }
} testDescription_suite_test_worksheet_test_cell_offset;
static class TestDescription_suite_test_worksheet_test_range_offset : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_range_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 103, "test_range_offset" ) {}
TestDescription_suite_test_worksheet_test_range_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 108, "test_range_offset" ) {}
void runTest() { suite_test_worksheet.test_range_offset(); }
} testDescription_suite_test_worksheet_test_range_offset;
static class TestDescription_suite_test_worksheet_test_cell_alternate_coordinates : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 112, "test_cell_alternate_coordinates" ) {}
TestDescription_suite_test_worksheet_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 117, "test_cell_alternate_coordinates" ) {}
void runTest() { suite_test_worksheet.test_cell_alternate_coordinates(); }
} testDescription_suite_test_worksheet_test_cell_alternate_coordinates;
static class TestDescription_suite_test_worksheet_test_cell_range_name : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_cell_range_name() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 119, "test_cell_range_name" ) {}
TestDescription_suite_test_worksheet_test_cell_range_name() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 124, "test_cell_range_name" ) {}
void runTest() { suite_test_worksheet.test_cell_range_name(); }
} testDescription_suite_test_worksheet_test_cell_range_name;
static class TestDescription_suite_test_worksheet_test_garbage_collect : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_garbage_collect() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 131, "test_garbage_collect" ) {}
TestDescription_suite_test_worksheet_test_garbage_collect() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 136, "test_garbage_collect" ) {}
void runTest() { suite_test_worksheet.test_garbage_collect(); }
} testDescription_suite_test_worksheet_test_garbage_collect;
static class TestDescription_suite_test_worksheet_test_hyperlink_relationships : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 168, "test_hyperlink_relationships" ) {}
TestDescription_suite_test_worksheet_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 173, "test_hyperlink_relationships" ) {}
void runTest() { suite_test_worksheet.test_hyperlink_relationships(); }
} testDescription_suite_test_worksheet_test_hyperlink_relationships;
static class TestDescription_suite_test_worksheet_test_bad_relationship_type : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 188, "test_bad_relationship_type" ) {}
TestDescription_suite_test_worksheet_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 193, "test_bad_relationship_type" ) {}
void runTest() { suite_test_worksheet.test_bad_relationship_type(); }
} testDescription_suite_test_worksheet_test_bad_relationship_type;
static class TestDescription_suite_test_worksheet_test_append_list : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_append_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 193, "test_append_list" ) {}
TestDescription_suite_test_worksheet_test_append_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 198, "test_append_list" ) {}
void runTest() { suite_test_worksheet.test_append_list(); }
} testDescription_suite_test_worksheet_test_append_list;
static class TestDescription_suite_test_worksheet_test_append_dict_letter : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 203, "test_append_dict_letter" ) {}
TestDescription_suite_test_worksheet_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 208, "test_append_dict_letter" ) {}
void runTest() { suite_test_worksheet.test_append_dict_letter(); }
} testDescription_suite_test_worksheet_test_append_dict_letter;
static class TestDescription_suite_test_worksheet_test_append_dict_index : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_append_dict_index() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 213, "test_append_dict_index" ) {}
TestDescription_suite_test_worksheet_test_append_dict_index() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 218, "test_append_dict_index" ) {}
void runTest() { suite_test_worksheet.test_append_dict_index(); }
} testDescription_suite_test_worksheet_test_append_dict_index;
static class TestDescription_suite_test_worksheet_test_append_2d_list : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_append_2d_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 223, "test_append_2d_list" ) {}
TestDescription_suite_test_worksheet_test_append_2d_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 228, "test_append_2d_list" ) {}
void runTest() { suite_test_worksheet.test_append_2d_list(); }
} testDescription_suite_test_worksheet_test_append_2d_list;
static class TestDescription_suite_test_worksheet_test_rows : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_rows() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 238, "test_rows" ) {}
TestDescription_suite_test_worksheet_test_rows() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 243, "test_rows" ) {}
void runTest() { suite_test_worksheet.test_rows(); }
} testDescription_suite_test_worksheet_test_rows;
static class TestDescription_suite_test_worksheet_test_cols : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_cols() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 253, "test_cols" ) {}
TestDescription_suite_test_worksheet_test_cols() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 258, "test_cols" ) {}
void runTest() { suite_test_worksheet.test_cols(); }
} testDescription_suite_test_worksheet_test_cols;
static class TestDescription_suite_test_worksheet_test_auto_filter : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_auto_filter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 268, "test_auto_filter" ) {}
TestDescription_suite_test_worksheet_test_auto_filter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 273, "test_auto_filter" ) {}
void runTest() { suite_test_worksheet.test_auto_filter(); }
} testDescription_suite_test_worksheet_test_auto_filter;
static class TestDescription_suite_test_worksheet_test_getitem : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_getitem() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 287, "test_getitem" ) {}
void runTest() { suite_test_worksheet.test_getitem(); }
} testDescription_suite_test_worksheet_test_getitem;
static class TestDescription_suite_test_worksheet_test_setitem : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_setitem() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 294, "test_setitem" ) {}
void runTest() { suite_test_worksheet.test_setitem(); }
} testDescription_suite_test_worksheet_test_setitem;
static class TestDescription_suite_test_worksheet_test_getslice : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_getslice() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 301, "test_getslice" ) {}
void runTest() { suite_test_worksheet.test_getslice(); }
} testDescription_suite_test_worksheet_test_getslice;
static class TestDescription_suite_test_worksheet_test_freeze : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_freeze() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 282, "test_freeze" ) {}
TestDescription_suite_test_worksheet_test_freeze() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 311, "test_freeze" ) {}
void runTest() { suite_test_worksheet.test_freeze(); }
} testDescription_suite_test_worksheet_test_freeze;
static class TestDescription_suite_test_worksheet_test_write_empty : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_write_empty() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 299, "test_write_empty" ) {}
TestDescription_suite_test_worksheet_test_write_empty() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 328, "test_write_empty" ) {}
void runTest() { suite_test_worksheet.test_write_empty(); }
} testDescription_suite_test_worksheet_test_write_empty;
static class TestDescription_suite_test_worksheet_test_page_margins : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_page_margins() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 330, "test_page_margins" ) {}
TestDescription_suite_test_worksheet_test_page_margins() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 359, "test_page_margins" ) {}
void runTest() { suite_test_worksheet.test_page_margins(); }
} testDescription_suite_test_worksheet_test_page_margins;
static class TestDescription_suite_test_worksheet_test_merge : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_merge() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 368, "test_merge" ) {}
TestDescription_suite_test_worksheet_test_merge() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 397, "test_merge" ) {}
void runTest() { suite_test_worksheet.test_merge(); }
} testDescription_suite_test_worksheet_test_merge;
static class TestDescription_suite_test_worksheet_test_printer_settings : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_printer_settings() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 477, "test_printer_settings" ) {}
TestDescription_suite_test_worksheet_test_printer_settings() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 506, "test_printer_settings" ) {}
void runTest() { suite_test_worksheet.test_printer_settings(); }
} testDescription_suite_test_worksheet_test_printer_settings;
static class TestDescription_suite_test_worksheet_test_header_footer : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_header_footer() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 497, "test_header_footer" ) {}
TestDescription_suite_test_worksheet_test_header_footer() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 547, "test_header_footer" ) {}
void runTest() { suite_test_worksheet.test_header_footer(); }
} testDescription_suite_test_worksheet_test_header_footer;
static class TestDescription_suite_test_worksheet_test_positioning_point : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_positioning_point() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 574, "test_positioning_point" ) {}
TestDescription_suite_test_worksheet_test_positioning_point() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 624, "test_positioning_point" ) {}
void runTest() { suite_test_worksheet.test_positioning_point(); }
} testDescription_suite_test_worksheet_test_positioning_point;
static class TestDescription_suite_test_worksheet_test_positioning_roundtrip : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_positioning_roundtrip() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 580, "test_positioning_roundtrip" ) {}
TestDescription_suite_test_worksheet_test_positioning_roundtrip() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 630, "test_positioning_roundtrip" ) {}
void runTest() { suite_test_worksheet.test_positioning_roundtrip(); }
} testDescription_suite_test_worksheet_test_positioning_roundtrip;
static class TestDescription_suite_test_worksheet_test_page_setup : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_page_setup() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 588, "test_page_setup" ) {}
TestDescription_suite_test_worksheet_test_page_setup() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 638, "test_page_setup" ) {}
void runTest() { suite_test_worksheet.test_page_setup(); }
} testDescription_suite_test_worksheet_test_page_setup;
static class TestDescription_suite_test_worksheet_test_page_options : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_worksheet_test_page_options() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 596, "test_page_options" ) {}
TestDescription_suite_test_worksheet_test_page_options() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 646, "test_page_options" ) {}
void runTest() { suite_test_worksheet.test_page_options(); }
} testDescription_suite_test_worksheet_test_page_options;
#include "C:\Users\taf656\Development\xlnt\tests\test_write.hpp"
#include "/Users/thomas/Development/xlnt/tests/test_write.hpp"
static test_write suite_test_write;
@ -1277,117 +1307,141 @@ public:
static class TestDescription_suite_test_write_test_write_virtual_workbook : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_virtual_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 26, "test_write_virtual_workbook" ) {}
TestDescription_suite_test_write_test_write_virtual_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 31, "test_write_virtual_workbook" ) {}
void runTest() { suite_test_write.test_write_virtual_workbook(); }
} testDescription_suite_test_write_test_write_virtual_workbook;
static class TestDescription_suite_test_write_test_write_workbook_rels : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_workbook_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 35, "test_write_workbook_rels" ) {}
TestDescription_suite_test_write_test_write_workbook_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 40, "test_write_workbook_rels" ) {}
void runTest() { suite_test_write.test_write_workbook_rels(); }
} testDescription_suite_test_write_test_write_workbook_rels;
static class TestDescription_suite_test_write_test_write_workbook : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 43, "test_write_workbook" ) {}
TestDescription_suite_test_write_test_write_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 48, "test_write_workbook" ) {}
void runTest() { suite_test_write.test_write_workbook(); }
} testDescription_suite_test_write_test_write_workbook;
static class TestDescription_suite_test_write_test_write_string_table : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_string_table() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 51, "test_write_string_table" ) {}
TestDescription_suite_test_write_test_write_string_table() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 56, "test_write_string_table" ) {}
void runTest() { suite_test_write.test_write_string_table(); }
} testDescription_suite_test_write_test_write_string_table;
static class TestDescription_suite_test_write_test_write_worksheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 58, "test_write_worksheet" ) {}
TestDescription_suite_test_write_test_write_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 63, "test_write_worksheet" ) {}
void runTest() { suite_test_write.test_write_worksheet(); }
} testDescription_suite_test_write_test_write_worksheet;
static class TestDescription_suite_test_write_test_write_hidden_worksheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hidden_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 66, "test_write_hidden_worksheet" ) {}
TestDescription_suite_test_write_test_write_hidden_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 71, "test_write_hidden_worksheet" ) {}
void runTest() { suite_test_write.test_write_hidden_worksheet(); }
} testDescription_suite_test_write_test_write_hidden_worksheet;
static class TestDescription_suite_test_write_test_write_bool : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_bool() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 75, "test_write_bool" ) {}
TestDescription_suite_test_write_test_write_bool() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 80, "test_write_bool" ) {}
void runTest() { suite_test_write.test_write_bool(); }
} testDescription_suite_test_write_test_write_bool;
static class TestDescription_suite_test_write_test_write_formula : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_formula() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 84, "test_write_formula" ) {}
TestDescription_suite_test_write_test_write_formula() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 89, "test_write_formula" ) {}
void runTest() { suite_test_write.test_write_formula(); }
} testDescription_suite_test_write_test_write_formula;
static class TestDescription_suite_test_write_test_write_style : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_style() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 94, "test_write_style" ) {}
TestDescription_suite_test_write_test_write_style() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 99, "test_write_style" ) {}
void runTest() { suite_test_write.test_write_style(); }
} testDescription_suite_test_write_test_write_style;
static class TestDescription_suite_test_write_test_write_height : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_height() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 105, "test_write_height" ) {}
TestDescription_suite_test_write_test_write_height() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 110, "test_write_height" ) {}
void runTest() { suite_test_write.test_write_height(); }
} testDescription_suite_test_write_test_write_height;
static class TestDescription_suite_test_write_test_write_hyperlink : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hyperlink() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 114, "test_write_hyperlink" ) {}
TestDescription_suite_test_write_test_write_hyperlink() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 119, "test_write_hyperlink" ) {}
void runTest() { suite_test_write.test_write_hyperlink(); }
} testDescription_suite_test_write_test_write_hyperlink;
static class TestDescription_suite_test_write_test_write_hyperlink_rels : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hyperlink_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 123, "test_write_hyperlink_rels" ) {}
TestDescription_suite_test_write_test_write_hyperlink_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 128, "test_write_hyperlink_rels" ) {}
void runTest() { suite_test_write.test_write_hyperlink_rels(); }
} testDescription_suite_test_write_test_write_hyperlink_rels;
static class TestDescription_suite_test_write_test_write_hyperlink_image_rels : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hyperlink_image_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 142, "test_write_hyperlink_image_rels" ) {}
void runTest() { suite_test_write.test_write_hyperlink_image_rels(); }
} testDescription_suite_test_write_test_write_hyperlink_image_rels;
static class TestDescription_suite_test_write_test_hyperlink_value : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 137, "test_hyperlink_value" ) {}
TestDescription_suite_test_write_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 147, "test_hyperlink_value" ) {}
void runTest() { suite_test_write.test_hyperlink_value(); }
} testDescription_suite_test_write_test_hyperlink_value;
static class TestDescription_suite_test_write_test_write_auto_filter : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_auto_filter() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 146, "test_write_auto_filter" ) {}
TestDescription_suite_test_write_test_write_auto_filter() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 156, "test_write_auto_filter" ) {}
void runTest() { suite_test_write.test_write_auto_filter(); }
} testDescription_suite_test_write_test_write_auto_filter;
static class TestDescription_suite_test_write_test_write_auto_filter_filter_column : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_auto_filter_filter_column() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 169, "test_write_auto_filter_filter_column" ) {}
void runTest() { suite_test_write.test_write_auto_filter_filter_column(); }
} testDescription_suite_test_write_test_write_auto_filter_filter_column;
static class TestDescription_suite_test_write_test_write_auto_filter_sort_condition : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_auto_filter_sort_condition() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 174, "test_write_auto_filter_sort_condition" ) {}
void runTest() { suite_test_write.test_write_auto_filter_sort_condition(); }
} testDescription_suite_test_write_test_write_auto_filter_sort_condition;
static class TestDescription_suite_test_write_test_freeze_panes_horiz : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_freeze_panes_horiz() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 159, "test_freeze_panes_horiz" ) {}
TestDescription_suite_test_write_test_freeze_panes_horiz() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 179, "test_freeze_panes_horiz" ) {}
void runTest() { suite_test_write.test_freeze_panes_horiz(); }
} testDescription_suite_test_write_test_freeze_panes_horiz;
static class TestDescription_suite_test_write_test_freeze_panes_vert : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_freeze_panes_vert() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 168, "test_freeze_panes_vert" ) {}
TestDescription_suite_test_write_test_freeze_panes_vert() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 188, "test_freeze_panes_vert" ) {}
void runTest() { suite_test_write.test_freeze_panes_vert(); }
} testDescription_suite_test_write_test_freeze_panes_vert;
static class TestDescription_suite_test_write_test_freeze_panes_both : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_freeze_panes_both() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 177, "test_freeze_panes_both" ) {}
TestDescription_suite_test_write_test_freeze_panes_both() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 197, "test_freeze_panes_both" ) {}
void runTest() { suite_test_write.test_freeze_panes_both(); }
} testDescription_suite_test_write_test_freeze_panes_both;
static class TestDescription_suite_test_write_test_long_number : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_long_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 186, "test_long_number" ) {}
TestDescription_suite_test_write_test_long_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 206, "test_long_number" ) {}
void runTest() { suite_test_write.test_long_number(); }
} testDescription_suite_test_write_test_long_number;
static class TestDescription_suite_test_write_test_short_number : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_short_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 194, "test_short_number" ) {}
TestDescription_suite_test_write_test_short_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 214, "test_short_number" ) {}
void runTest() { suite_test_write.test_short_number(); }
} testDescription_suite_test_write_test_short_number;
static class TestDescription_suite_test_write_test_write_images : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_images() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 222, "test_write_images" ) {}
void runTest() { suite_test_write.test_write_images(); }
} testDescription_suite_test_write_test_write_images;
#include <cxxtest/Root.cpp>
const char* CxxTest::RealWorldDescription::_worldName = "cxxtest";

View File

@ -412,20 +412,6 @@ public:
TS_ASSERT(ws.get_comment_count() == 0);
}
void test_comment_assignment()
{
xlnt::worksheet ws = wb.create_sheet();
xlnt::cell cell(ws, "A1");
xlnt::comment c("text", "author");
cell.set_comment(c);
TS_ASSERT_THROWS_ANYTHING(ws.get_cell("A2").set_comment(c));
ws.get_cell("A2").set_comment(xlnt::comment("text2", "author2"));
TS_ASSERT_THROWS_ANYTHING(ws.get_cell("A1").set_comment(ws.get_cell("A2").get_comment()));
ws.get_cell("A1").clear_comment();
TS_ASSERT_THROWS_NOTHING(ws.get_cell("A2").set_comment(c));
}
void test_cell_offset()
{
xlnt::worksheet ws = wb.create_sheet();

View File

@ -8,178 +8,283 @@
class test_style : public CxxTest::TestSuite
{
public:
test_style() : writer_(workbook_)
{
workbook_.set_guess_types(true);
auto now = xlnt::datetime::now();
auto ws = workbook_.get_active_sheet();
ws.get_cell("A1").set_value("12.34%"); // 2
ws.get_cell("B4").set_value(now); // 3
ws.get_cell("B5").set_value(now);
ws.get_cell("C14").set_value("This is a test"); // 1
ws.get_cell("D9").set_value("31.31415"); // 3
xlnt::style st;
st.set_number_format(xlnt::number_format(xlnt::number_format::format::number_00));
st.set_protection(xlnt::protection(xlnt::protection::type::unprotected));
ws.get_cell("D9").set_style(st);
xlnt::style st2;
st.set_protection(xlnt::protection(xlnt::protection::type::unprotected));
ws.get_cell("E1").set_style(st2);
}
void test_create_style_table()
{
//TS_ASSERT_EQUALS(3, len(writer.style_table));
TS_ASSERT_EQUALS(5, writer_.get_styles().size());
}
void test_write_style_table()
{
//reference_file = os.path.join(DATADIR, "writer", "expected", "simple-styles.xml");
//assert_equals_file_content(reference_file, writer.write_table());
}
void setUp_writer()
{
//workbook = Workbook()
// worksheet = workbook.create_sheet()
auto path = PathHelper::GetDataDirectory("/expected/simple-styles.xml");
pugi::xml_document expected;
expected.load(path.c_str());
auto content = writer_.write_table();
pugi::xml_document observed;
observed.load(content.c_str());
auto diff = Helper::compare_xml(expected, observed);
TS_ASSERT(diff);
}
void test_no_style()
{
//w = StyleWriter(workbook)
// TS_ASSERT_EQUALS(0, len(w.style_table))
xlnt::workbook wb;
xlnt::style_writer w(wb);
TS_ASSERT_EQUALS(w.get_styles().size(), 1); // there is always the empty (default) style
}
void test_nb_style()
{
//for i in range(1, 6)
//{
// worksheet.cell(row = 1, column = i).style.font.size += i
// w = StyleWriter(workbook)
// TS_ASSERT_EQUALS(5, len(w.style_table))
// worksheet.cell("A10").style.borders.top = Border.BORDER_THIN
// w = StyleWriter(workbook)
// TS_ASSERT_EQUALS(6, len(w.style_table))
//}
TS_SKIP("not implemented");
}
void test_style_unicity()
{
//for i in range(1, 6)
//{
// worksheet.cell(row = 1, column = i).style.font.bold = True
// w = StyleWriter(workbook)
// TS_ASSERT_EQUALS(1, len(w.style_table))
//}
TS_SKIP("not implemented");
}
void test_fonts()
{
//worksheet.cell("A1").style.font.size = 12
// worksheet.cell("A1").style.font.bold = True
// w = StyleWriter(workbook)
// w._write_fonts()
// TS_ASSERT_EQUALS(get_xml(w._root), "<?xml version=\"1.0\" encoding=\"" + utf8_xml_str + "\"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11" /><color theme="1" /><name val="Calibri" /><family val="2" /><scheme val="minor" /></font><font><sz val="12" /><color rgb="FF000000" /><name val="Calibri" /><family val="2" /><b /><u val="none" /></font></fonts></styleSheet>")
// worksheet.cell("A1").style.font.underline = Font.UNDERLINE_SINGLE
// w = StyleWriter(workbook)
// w._write_fonts()
// TS_ASSERT_EQUALS(get_xml(w._root), "<?xml version=\"1.0\" encoding=\"" + utf8_xml_str + "\"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11" /><color theme="1" /><name val="Calibri" /><family val="2" /><scheme val="minor" /></font><font><sz val="12" /><color rgb="FF000000" /><name val="Calibri" /><family val="2" /><b /><u /></font></fonts></styleSheet>")
auto expected =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"
" <fonts count=\"2\">"
" <font>"
" <sz val=\"11\" />"
" <color theme=\"1\" />"
" <name val=\"Calibri\" />"
" <family val=\"2\" />"
" <scheme val=\"minor\" />"
" </font>"
" <font>"
" <sz val=\"12.0\" />"
" <color rgb=\"00000000\" />"
" <name val=\"Calibri\" />"
" <family val=\"2\" />"
" <b />"
" </font>"
" </fonts>"
"</styleSheet>";
pugi::xml_document expected_doc;
expected_doc.load(expected);
std::string observed = "";
pugi::xml_document observed_doc;
observed_doc.load(observed.c_str());
auto diff = Helper::compare_xml(expected_doc, observed_doc);
TS_ASSERT(diff);
}
void test_fonts_with_underline()
{
auto expected =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"
" <fonts count=\"2\">"
" <font>"
" <sz val=\"11\" />"
" <color theme=\"1\" />"
" <name val=\"Calibri\" />"
" <family val=\"2\" />"
" <scheme val=\"minor\" />"
" </font>"
" <font>"
" <sz val=\"12.0\" />"
" <color rgb=\"00000000\" />"
" <name val=\"Calibri\" />"
" <family val=\"2\" />"
" <b />"
" <u />"
" </font>"
" </fonts>"
"</styleSheet>";
pugi::xml_document expected_doc;
expected_doc.load(expected);
std::string observed = "";
pugi::xml_document observed_doc;
observed_doc.load(observed.c_str());
auto diff = Helper::compare_xml(expected_doc, observed_doc);
TS_ASSERT(diff);
}
void test_fills()
{
//worksheet.cell("A1").style.fill.fill_type = "solid"
// worksheet.cell("A1").style.fill.start_color.index = Color.DARKYELLOW
// w = StyleWriter(workbook)
// w._write_fills()
// TS_ASSERT_EQUALS(get_xml(w._root), "<?xml version=\"1.0\" encoding=\"" + utf8_xml_str + "\"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><fills count="3"><fill><patternFill patternType="none" /></fill><fill><patternFill patternType="gray125" /></fill><fill><patternFill patternType="solid"><fgColor rgb="FF808000" /></patternFill></fill></fills></styleSheet>")
auto expected =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"
" <fills count=\"3\">"
" <fill>"
" <patternFill patternType=\"none\" />"
" </fill>"
" <fill>"
" <patternFill patternType=\"gray125\" />"
" </fill>"
" <fill>"
" <patternFill patternType=\"solid\">"
" <fgColor rgb=\"0000FF00\" />"
" </patternFill>"
" </fill>"
" </fills>"
"</styleSheet>";
pugi::xml_document expected_doc;
expected_doc.load(expected);
std::string observed = "";
pugi::xml_document observed_doc;
observed_doc.load(observed.c_str());
auto diff = Helper::compare_xml(expected_doc, observed_doc);
TS_ASSERT(diff);
}
void test_borders()
{
//worksheet.cell("A1").style.borders.top.border_style = Border.BORDER_THIN
// worksheet.cell("A1").style.borders.top.color.index = Color.DARKYELLOW
// w = StyleWriter(workbook)
// w._write_borders()
// TS_ASSERT_EQUALS(get_xml(w._root), "<?xml version=\"1.0\" encoding=\"" + utf8_xml_str + "\"?><styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><borders count="2"><border><left /><right /><top /><bottom /><diagonal /></border><border><left style="none"><color rgb="FF000000" /></left><right style="none"><color rgb="FF000000" /></right><top style="thin"><color rgb="FF808000" /></top><bottom style="none"><color rgb="FF000000" /></bottom><diagonal style="none"><color rgb="FF000000" /></diagonal></border></borders></styleSheet>")
auto expected =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"
" <borders count=\"2\">"
" <border>"
" <left />"
" <right />"
" <top />"
" <bottom />"
" <diagonal />"
" </border>"
" <border>"
" <left />"
" <right />"
" <top style=\"thin\">"
" <color rgb=\"0000FF00\" />"
" </top>"
" <bottom />"
" <diagonal />"
" </border>"
" </borders>"
"</styleSheet>";
pugi::xml_document expected_doc;
expected_doc.load(expected);
std::string observed = "";
pugi::xml_document observed_doc;
observed_doc.load(observed.c_str());
auto diff = Helper::compare_xml(expected_doc, observed_doc);
TS_ASSERT(diff);
}
void test_write_color()
{
TS_SKIP("not implemented");
}
void test_write_cell_xfs_1()
{
//worksheet.cell("A1").style.font.size = 12
// w = StyleWriter(workbook)
// ft = w._write_fonts()
// nft = w._write_number_formats()
// w._write_cell_xfs(nft, ft, {}, {})
// xml = get_xml(w._root)
// ok_("applyFont="1"" in xml)
// ok_("applyFillId="1"" not in xml)
// ok_("applyBorder="1"" not in xml)
// ok_("applyAlignment="1"" not in xml)
TS_SKIP("not implemented");
}
void test_alignment()
{
//worksheet.cell("A1").style.alignment.horizontal = "center"
// worksheet.cell("A1").style.alignment.vertical = "center"
// w = StyleWriter(workbook)
// nft = w._write_number_formats()
// w._write_cell_xfs(nft, {}, {}, {})
// xml = get_xml(w._root)
// ok_("applyAlignment="1"" in xml)
// ok_("horizontal="center"" in xml)
// ok_("vertical="center"" in xml)
TS_SKIP("not implemented");
}
void test_alignment_rotation()
{
//worksheet.cell("A1").style.alignment.vertical = "center"
// worksheet.cell("A1").style.alignment.text_rotation = 90
// worksheet.cell("A2").style.alignment.vertical = "center"
// worksheet.cell("A2").style.alignment.text_rotation = 135
// w = StyleWriter(workbook)
// nft = w._write_number_formats()
// w._write_cell_xfs(nft, {}, {}, {})
// xml = get_xml(w._root)
// ok_("textRotation="90"" in xml)
// ok_("textRotation="135"" in xml)
TS_SKIP("not implemented");
}
void test_format_comparisions()
void test_alignment_indent()
{
//format1 = NumberFormat()
// format2 = NumberFormat()
// format3 = NumberFormat()
// format1.format_code = "m/d/yyyy"
// format2.format_code = "m/d/yyyy"
// format3.format_code = "mm/dd/yyyy"
// assert not format1 < format2
// assert format1 < format3
// assert format1 == format2
// assert format1 != format3
TS_SKIP("not implemented");
}
void test_builtin_format()
void test_rewrite_styles()
{
//format = NumberFormat()
// format.format_code = "0.00"
// TS_ASSERT_EQUALS(format.builtin_format_code(2), format._format_code)
TS_SKIP("not implemented");
}
void test_read_style()
void test_write_dxf()
{
//reference_file = os.path.join(DATADIR, "reader", "simple-styles.xml")
// handle = open(reference_file, "r")
// try :
// content = handle.read()
// finally :
// handle.close()
// style_table = read_style_table(content)
// TS_ASSERT_EQUALS(4, len(style_table))
// TS_ASSERT_EQUALS(NumberFormat._BUILTIN_FORMATS[9],
// style_table[1].number_format.format_code)
// TS_ASSERT_EQUALS("yyyy-mm-dd", style_table[2].number_format.format_code)
auto expected =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"
" <dxfs count=\"1\">"
" <dxf>"
" <font>"
" <color rgb=\"FFFFFFFF\" />"
" <b val=\"1\" />"
" <i val=\"1\" />"
" <u val=\"single\" />"
" <strike />"
" </font>"
" <fill>"
" <patternFill patternType=\"solid\">"
" <fgColor rgb=\"FFEE1111\" />"
" <bgColor rgb=\"FFEE1111\" />"
" </patternFill>"
" </fill>"
" <border>"
" <left style=\"medium\">"
" <color rgb=\"000000FF\" />"
" </left>"
" <right style=\"medium\">"
" <color rgb=\"000000FF\" />"
" </right>"
" <top style=\"medium\">"
" <color rgb=\"000000FF\" />"
" </top>"
" <bottom style=\"medium\">"
" <color rgb=\"000000FF\" />"
" </bottom>"
" </border>"
" </dxf>"
" </dxfs>"
"</styleSheet>";
pugi::xml_document expected_doc;
expected_doc.load(expected);
std::string observed = "";
pugi::xml_document observed_doc;
observed_doc.load(observed.c_str());
auto diff = Helper::compare_xml(expected_doc, observed_doc);
TS_ASSERT(diff);
}
void test_read_cell_style()
void test_protection()
{
//reference_file = os.path.join(
// DATADIR, "reader", "empty-workbook-styles.xml")
// handle = open(reference_file, "r")
// try :
// content = handle.read()
// finally :
// handle.close()
// style_table = read_style_table(content)
// TS_ASSERT_EQUALS(2, len(style_table))
TS_SKIP("not implemented");
}
private:
xlnt::workbook workbook_;
xlnt::style_writer writer_;
};

View File

@ -12,18 +12,18 @@ public:
void test_new_worksheet()
{
xlnt::worksheet ws = wb_.create_sheet();
TS_ASSERT(wb_ == ws.get_parent());
TS_ASSERT(wb_ == ws.get_parent());
}
void test_new_sheet_name()
{
xlnt::worksheet ws = wb_.create_sheet("TestName");
xlnt::worksheet ws = wb_.create_sheet("TestName");
TS_ASSERT_EQUALS(ws.to_string(), "<Worksheet \"TestName\">");
}
void test_get_cell()
{
xlnt::worksheet ws(wb_);
xlnt::worksheet ws(wb_);
auto cell = ws.get_cell("A1");
TS_ASSERT_EQUALS(cell.get_reference().to_string(), "A1");
}
@ -31,7 +31,7 @@ public:
void test_set_bad_title()
{
std::string title(50, 'X');
TS_ASSERT_THROWS(wb_.create_sheet(title), xlnt::sheet_title_exception);
TS_ASSERT_THROWS(wb_.create_sheet(title), xlnt::sheet_title_exception);
}
void test_increment_title()
@ -52,6 +52,11 @@ public:
TS_ASSERT_THROWS(wb_.create_sheet("/"), xlnt::sheet_title_exception);
TS_ASSERT_THROWS(wb_.create_sheet("\\"), xlnt::sheet_title_exception);
}
void test_unique_sheet_title()
{
TS_SKIP("not implemented");
}
void test_worksheet_dimension()
{
@ -278,6 +283,30 @@ public:
ws.auto_filter("c1:g9");
TS_ASSERT_EQUALS(ws.get_auto_filter(), "C1:G9");
}
void test_getitem()
{
xlnt::worksheet ws(wb_);
xlnt::cell cell = ws[xlnt::cell_reference("A1")];
TS_ASSERT(cell.get_reference().to_string() == "A1");
}
void test_setitem()
{
xlnt::worksheet ws(wb_);
ws[xlnt::cell_reference("A1")].get_value() = 5;
TS_ASSERT(ws[xlnt::cell_reference("A1")].get_value() == 5);
}
void test_getslice()
{
xlnt::worksheet ws(wb_);
auto cell_range = ws("A1", "B2");
TS_ASSERT_EQUALS(cell_range[0][0], ws.get_cell("A1"));
TS_ASSERT_EQUALS(cell_range[1][0], ws.get_cell("A2"));
TS_ASSERT_EQUALS(cell_range[0][1], ws.get_cell("B1"));
TS_ASSERT_EQUALS(cell_range[1][1], ws.get_cell("B2"));
}
void test_freeze()
{
@ -488,10 +517,31 @@ public:
pugi::xml_document doc;
doc.load(xml_string.c_str());
auto expected_string =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">"
" <sheetPr>"
" <outlinePr summaryRight=\"1\" summaryBelow=\"1\" />"
" <pageSetUpPr fitToPage=\"1\" />"
" </sheetPr>"
" <dimension ref=\"A1:A1\" />"
" <sheetViews>"
" <sheetView workbookViewId=\"0\">"
" <selection sqref=\"A1\" activeCell=\"A1\" />"
" </sheetView>"
" </sheetViews>"
" <sheetFormatPr baseColWidth=\"10\" defaultRowHeight=\"15\" />"
" <sheetData />"
" <printOptions horizontalCentered=\"1\" verticalCentered=\"1\" />"
" <pageMargins left=\"0.75\" right=\"0.75\" top=\"1\" bottom=\"1\" header=\"0.5\" footer=\"0.5\" />"
" <pageSetup orientation=\"landscape\" paperSize=\"3\" fitToHeight=\"0\" fitToWidth=\"1\" />"
"</worksheet>";
pugi::xml_document expected_doc;
expected_doc.load(expected_string);
xlnt::worksheet ws2(wb_);
xml_string = xlnt::writer::write_worksheet(ws2);
doc.load(xml_string.c_str());
TS_ASSERT(Helper::compare_xml(expected_doc, doc));
}
void test_header_footer()

View File

@ -13,6 +13,11 @@ class test_write : public CxxTest::TestSuite
public:
void test_write_empty_workbook()
{
xlnt::workbook wbt;
auto ws = wbt.get_active_sheet();
ws.get_cell("A2").set_value("Thomas Fussell");
wbt.save("/Users/thomas/Desktop/a.xlsx");
if(PathHelper::FileExists(temp_file.GetFilename()))
{
PathHelper::DeleteFile(temp_file.GetFilename());
@ -133,6 +138,11 @@ public:
auto content = xlnt::writer::write_worksheet_rels(ws);
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml.rels", content));
}
void test_write_hyperlink_image_rels()
{
TS_SKIP("not implemented");
}
void test_hyperlink_value()
{
@ -155,6 +165,16 @@ public:
content = xlnt::writer::write_workbook(wb);
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/workbook_auto_filter.xml", content));
}
void test_write_auto_filter_filter_column()
{
}
void test_write_auto_filter_sort_condition()
{
}
void test_freeze_panes_horiz()
{
@ -186,7 +206,7 @@ public:
void test_long_number()
{
auto ws = wb_.create_sheet();
ws.get_cell("A1").set_value(9781231231230);
ws.get_cell("A1").set_value(9781231231230LL);
auto content = xlnt::writer::write_worksheet(ws, {}, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/long_number.xml", content));
}
@ -198,6 +218,11 @@ public:
auto content = xlnt::writer::write_worksheet(ws, {}, {});
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/short_number.xml", content));
}
void test_write_images()
{
TS_SKIP("not implemented");
}
private:
TemporaryFile temp_file;