mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
enabled more tests
This commit is contained in:
parent
7edef82577
commit
3c04a7b9d2
|
@ -4,6 +4,7 @@
|
|||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "style.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace xlnt {
|
||||
|
@ -20,271 +21,6 @@ struct cell_impl;
|
|||
|
||||
typedef std::string comment;
|
||||
|
||||
/// <summary>
|
||||
/// Alignment options for use in styles.
|
||||
/// </summary>
|
||||
struct alignment
|
||||
{
|
||||
enum class horizontal_alignment
|
||||
{
|
||||
general,
|
||||
left,
|
||||
right,
|
||||
center,
|
||||
center_continuous,
|
||||
justify
|
||||
};
|
||||
|
||||
enum class vertical_alignment
|
||||
{
|
||||
bottom,
|
||||
top,
|
||||
center,
|
||||
justify
|
||||
};
|
||||
|
||||
horizontal_alignment horizontal = horizontal_alignment::general;
|
||||
vertical_alignment vertical = vertical_alignment::bottom;
|
||||
int text_rotation = 0;
|
||||
bool wrap_text = false;
|
||||
bool shrink_to_fit = false;
|
||||
int indent = 0;
|
||||
};
|
||||
|
||||
class number_format
|
||||
{
|
||||
public:
|
||||
enum class format
|
||||
{
|
||||
general,
|
||||
text,
|
||||
number,
|
||||
number00,
|
||||
number_comma_separated1,
|
||||
number_comma_separated2,
|
||||
percentage,
|
||||
percentage00,
|
||||
date_yyyymmdd2,
|
||||
date_yyyymmdd,
|
||||
date_ddmmyyyy,
|
||||
date_dmyslash,
|
||||
date_dmyminus,
|
||||
date_dmminus,
|
||||
date_myminus,
|
||||
date_xlsx14,
|
||||
date_xlsx15,
|
||||
date_xlsx16,
|
||||
date_xlsx17,
|
||||
date_xlsx22,
|
||||
date_datetime,
|
||||
date_time1,
|
||||
date_time2,
|
||||
date_time3,
|
||||
date_time4,
|
||||
date_time5,
|
||||
date_time6,
|
||||
date_time7,
|
||||
date_time8,
|
||||
date_timedelta,
|
||||
date_yyyymmddslash,
|
||||
currency_usd_simple,
|
||||
currency_usd,
|
||||
currency_eur_simple
|
||||
};
|
||||
|
||||
static const std::unordered_map<int, std::string> builtin_formats;
|
||||
|
||||
static std::string builtin_format_code(int index);
|
||||
|
||||
static bool is_date_format(const std::string &format);
|
||||
static bool is_builtin(const std::string &format);
|
||||
|
||||
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; }
|
||||
|
||||
private:
|
||||
std::string custom_format_code_ = "";
|
||||
format format_code_ = format::general;
|
||||
int format_index_ = 0;
|
||||
};
|
||||
|
||||
struct color
|
||||
{
|
||||
static const color black;
|
||||
static const color white;
|
||||
static const color red;
|
||||
static const color darkred;
|
||||
static const color blue;
|
||||
static const color darkblue;
|
||||
static const color green;
|
||||
static const color darkgreen;
|
||||
static const color yellow;
|
||||
static const color darkyellow;
|
||||
|
||||
color(int index)
|
||||
{
|
||||
this->index = index;
|
||||
}
|
||||
|
||||
int index;
|
||||
};
|
||||
|
||||
class font
|
||||
{
|
||||
enum class underline
|
||||
{
|
||||
none,
|
||||
double_,
|
||||
double_accounting,
|
||||
single,
|
||||
single_accounting
|
||||
};
|
||||
|
||||
/* std::string name = "Calibri";
|
||||
int size = 11;
|
||||
bool bold = false;
|
||||
bool italic = false;
|
||||
bool superscript = false;
|
||||
bool subscript = false;
|
||||
underline underline = underline::none;
|
||||
bool strikethrough = false;
|
||||
color color = color::black;*/
|
||||
};
|
||||
|
||||
class fill
|
||||
{
|
||||
public:
|
||||
enum class type
|
||||
{
|
||||
none,
|
||||
solid,
|
||||
gradient_linear,
|
||||
gradient_path,
|
||||
pattern_darkdown,
|
||||
pattern_darkgray,
|
||||
pattern_darkgrid,
|
||||
pattern_darkhorizontal,
|
||||
pattern_darktrellis,
|
||||
pattern_darkup,
|
||||
pattern_darkvertical,
|
||||
pattern_gray0625,
|
||||
pattern_gray125,
|
||||
pattern_lightdown,
|
||||
pattern_lightgray,
|
||||
pattern_lightgrid,
|
||||
pattern_lighthorizontal,
|
||||
pattern_lighttrellis,
|
||||
pattern_lightup,
|
||||
pattern_lightvertical,
|
||||
pattern_mediumgray,
|
||||
};
|
||||
|
||||
type type_ = type::none;
|
||||
int rotation = 0;
|
||||
color start_color = color::white;
|
||||
color end_color = color::black;
|
||||
};
|
||||
|
||||
class borders
|
||||
{
|
||||
struct border
|
||||
{
|
||||
enum class style
|
||||
{
|
||||
none,
|
||||
dashdot,
|
||||
dashdotdot,
|
||||
dashed,
|
||||
dotted,
|
||||
double_,
|
||||
hair,
|
||||
medium,
|
||||
mediumdashdot,
|
||||
mediumdashdotdot,
|
||||
mediumdashed,
|
||||
slantdashdot,
|
||||
thick,
|
||||
thin
|
||||
};
|
||||
|
||||
style style_ = style::none;
|
||||
color color_ = color::black;
|
||||
};
|
||||
|
||||
enum class diagonal_direction
|
||||
{
|
||||
none,
|
||||
up,
|
||||
down,
|
||||
both
|
||||
};
|
||||
|
||||
border left;
|
||||
border right;
|
||||
border top;
|
||||
border bottom;
|
||||
border diagonal;
|
||||
// diagonal_direction diagonal_direction = diagonal_direction::none;
|
||||
border all_borders;
|
||||
border outline;
|
||||
border inside;
|
||||
border vertical;
|
||||
border horizontal;
|
||||
};
|
||||
|
||||
class protection
|
||||
{
|
||||
public:
|
||||
enum class type
|
||||
{
|
||||
inherit,
|
||||
protected_,
|
||||
unprotected
|
||||
};
|
||||
|
||||
type locked;
|
||||
type hidden;
|
||||
};
|
||||
|
||||
class style
|
||||
{
|
||||
public:
|
||||
style(bool static_ = false) : static_(static_) {}
|
||||
|
||||
style copy() const;
|
||||
|
||||
font get_font() const;
|
||||
void set_font(font font);
|
||||
|
||||
fill get_fill() const;
|
||||
void set_fill(fill fill);
|
||||
|
||||
borders get_borders() const;
|
||||
void set_borders(borders borders);
|
||||
|
||||
alignment get_alignment() const;
|
||||
void set_alignment(alignment alignment);
|
||||
|
||||
number_format &get_number_format() { return number_format_; }
|
||||
const number_format &get_number_format() const { return number_format_; }
|
||||
void set_number_format(number_format number_format);
|
||||
|
||||
protection get_protection() const;
|
||||
void set_protection(protection protection);
|
||||
|
||||
private:
|
||||
style(const style &rhs);
|
||||
|
||||
bool static_ = false;
|
||||
font font_;
|
||||
fill fill_;
|
||||
borders borders_;
|
||||
alignment alignment_;
|
||||
number_format number_format_;
|
||||
protection protection_;
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Describes cell associated properties.
|
||||
/// </summary>
|
||||
|
@ -367,6 +103,8 @@ public:
|
|||
cell &operator=(bool value);
|
||||
cell &operator=(int value);
|
||||
cell &operator=(double value);
|
||||
cell &operator=(long int value);
|
||||
cell &operator=(long double value);
|
||||
cell &operator=(const std::string &value);
|
||||
cell &operator=(const char *value);
|
||||
cell &operator=(const date &value);
|
||||
|
|
270
include/xlnt/style.h
Normal file
270
include/xlnt/style.h
Normal file
|
@ -0,0 +1,270 @@
|
|||
#pragma once
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
/// <summary>
|
||||
/// Alignment options for use in styles.
|
||||
/// </summary>
|
||||
struct alignment
|
||||
{
|
||||
enum class horizontal_alignment
|
||||
{
|
||||
general,
|
||||
left,
|
||||
right,
|
||||
center,
|
||||
center_continuous,
|
||||
justify
|
||||
};
|
||||
|
||||
enum class vertical_alignment
|
||||
{
|
||||
bottom,
|
||||
top,
|
||||
center,
|
||||
justify
|
||||
};
|
||||
|
||||
horizontal_alignment horizontal = horizontal_alignment::general;
|
||||
vertical_alignment vertical = vertical_alignment::bottom;
|
||||
int text_rotation = 0;
|
||||
bool wrap_text = false;
|
||||
bool shrink_to_fit = false;
|
||||
int indent = 0;
|
||||
};
|
||||
|
||||
class number_format
|
||||
{
|
||||
public:
|
||||
enum class format
|
||||
{
|
||||
general,
|
||||
text,
|
||||
number,
|
||||
number00,
|
||||
number_comma_separated1,
|
||||
number_comma_separated2,
|
||||
percentage,
|
||||
percentage00,
|
||||
date_yyyymmdd2,
|
||||
date_yyyymmdd,
|
||||
date_ddmmyyyy,
|
||||
date_dmyslash,
|
||||
date_dmyminus,
|
||||
date_dmminus,
|
||||
date_myminus,
|
||||
date_xlsx14,
|
||||
date_xlsx15,
|
||||
date_xlsx16,
|
||||
date_xlsx17,
|
||||
date_xlsx22,
|
||||
date_datetime,
|
||||
date_time1,
|
||||
date_time2,
|
||||
date_time3,
|
||||
date_time4,
|
||||
date_time5,
|
||||
date_time6,
|
||||
date_time7,
|
||||
date_time8,
|
||||
date_timedelta,
|
||||
date_yyyymmddslash,
|
||||
currency_usd_simple,
|
||||
currency_usd,
|
||||
currency_eur_simple
|
||||
};
|
||||
|
||||
static const std::unordered_map<int, std::string> builtin_formats;
|
||||
|
||||
static std::string builtin_format_code(int index);
|
||||
|
||||
static bool is_date_format(const std::string &format);
|
||||
static bool is_builtin(const std::string &format);
|
||||
|
||||
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; }
|
||||
|
||||
private:
|
||||
std::string custom_format_code_ = "";
|
||||
format format_code_ = format::general;
|
||||
int format_index_ = 0;
|
||||
};
|
||||
|
||||
struct color
|
||||
{
|
||||
static const color black;
|
||||
static const color white;
|
||||
static const color red;
|
||||
static const color darkred;
|
||||
static const color blue;
|
||||
static const color darkblue;
|
||||
static const color green;
|
||||
static const color darkgreen;
|
||||
static const color yellow;
|
||||
static const color darkyellow;
|
||||
|
||||
color(int index)
|
||||
{
|
||||
this->index = index;
|
||||
}
|
||||
|
||||
int index;
|
||||
};
|
||||
|
||||
class font
|
||||
{
|
||||
enum class underline
|
||||
{
|
||||
none,
|
||||
double_,
|
||||
double_accounting,
|
||||
single,
|
||||
single_accounting
|
||||
};
|
||||
|
||||
/* std::string name = "Calibri";
|
||||
int size = 11;
|
||||
bool bold = false;
|
||||
bool italic = false;
|
||||
bool superscript = false;
|
||||
bool subscript = false;
|
||||
underline underline = underline::none;
|
||||
bool strikethrough = false;
|
||||
color color = color::black;*/
|
||||
};
|
||||
|
||||
class fill
|
||||
{
|
||||
public:
|
||||
enum class type
|
||||
{
|
||||
none,
|
||||
solid,
|
||||
gradient_linear,
|
||||
gradient_path,
|
||||
pattern_darkdown,
|
||||
pattern_darkgray,
|
||||
pattern_darkgrid,
|
||||
pattern_darkhorizontal,
|
||||
pattern_darktrellis,
|
||||
pattern_darkup,
|
||||
pattern_darkvertical,
|
||||
pattern_gray0625,
|
||||
pattern_gray125,
|
||||
pattern_lightdown,
|
||||
pattern_lightgray,
|
||||
pattern_lightgrid,
|
||||
pattern_lighthorizontal,
|
||||
pattern_lighttrellis,
|
||||
pattern_lightup,
|
||||
pattern_lightvertical,
|
||||
pattern_mediumgray,
|
||||
};
|
||||
|
||||
type type_ = type::none;
|
||||
int rotation = 0;
|
||||
color start_color = color::white;
|
||||
color end_color = color::black;
|
||||
};
|
||||
|
||||
class borders
|
||||
{
|
||||
struct border
|
||||
{
|
||||
enum class style
|
||||
{
|
||||
none,
|
||||
dashdot,
|
||||
dashdotdot,
|
||||
dashed,
|
||||
dotted,
|
||||
double_,
|
||||
hair,
|
||||
medium,
|
||||
mediumdashdot,
|
||||
mediumdashdotdot,
|
||||
mediumdashed,
|
||||
slantdashdot,
|
||||
thick,
|
||||
thin
|
||||
};
|
||||
|
||||
style style_ = style::none;
|
||||
color color_ = color::black;
|
||||
};
|
||||
|
||||
enum class diagonal_direction
|
||||
{
|
||||
none,
|
||||
up,
|
||||
down,
|
||||
both
|
||||
};
|
||||
|
||||
border left;
|
||||
border right;
|
||||
border top;
|
||||
border bottom;
|
||||
border diagonal;
|
||||
// diagonal_direction diagonal_direction = diagonal_direction::none;
|
||||
border all_borders;
|
||||
border outline;
|
||||
border inside;
|
||||
border vertical;
|
||||
border horizontal;
|
||||
};
|
||||
|
||||
class protection
|
||||
{
|
||||
public:
|
||||
enum class type
|
||||
{
|
||||
inherit,
|
||||
protected_,
|
||||
unprotected
|
||||
};
|
||||
|
||||
type locked;
|
||||
type hidden;
|
||||
};
|
||||
|
||||
class style
|
||||
{
|
||||
public:
|
||||
style(bool static_ = false) : static_(static_) {}
|
||||
|
||||
style copy() const;
|
||||
|
||||
font get_font() const;
|
||||
void set_font(font font);
|
||||
|
||||
fill get_fill() const;
|
||||
void set_fill(fill fill);
|
||||
|
||||
borders get_borders() const;
|
||||
void set_borders(borders borders);
|
||||
|
||||
alignment get_alignment() const;
|
||||
void set_alignment(alignment alignment);
|
||||
|
||||
number_format &get_number_format() { return number_format_; }
|
||||
const number_format &get_number_format() const { return number_format_; }
|
||||
void set_number_format(number_format number_format);
|
||||
|
||||
protection get_protection() const;
|
||||
void set_protection(protection protection);
|
||||
|
||||
private:
|
||||
style(const style &rhs);
|
||||
|
||||
bool static_ = false;
|
||||
font font_;
|
||||
fill fill_;
|
||||
borders borders_;
|
||||
alignment alignment_;
|
||||
number_format number_format_;
|
||||
protection protection_;
|
||||
};
|
||||
|
||||
} // namespace xlnt
|
36
include/xlnt/style_writer.h
Normal file
36
include/xlnt/style_writer.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "style.h"
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
class workbook;
|
||||
|
||||
class style_writer
|
||||
{
|
||||
public:
|
||||
style_writer(workbook &wb);
|
||||
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_;
|
||||
};
|
||||
|
||||
} // namespace xlnt
|
|
@ -115,8 +115,10 @@ public:
|
|||
void remove_named_range(const std::string &name);
|
||||
|
||||
//serialization
|
||||
void save(const std::string &filename);
|
||||
void load(const std::string &filename);
|
||||
bool save(std::vector<unsigned char> &data);
|
||||
bool save(const std::string &filename);
|
||||
bool load(const std::vector<unsigned char> &data);
|
||||
bool load(const std::string &filename);
|
||||
|
||||
bool operator==(const workbook &rhs) const;
|
||||
|
||||
|
|
|
@ -21,6 +21,18 @@ class workbook;
|
|||
namespace detail {
|
||||
struct worksheet_impl;
|
||||
} // namespace detail
|
||||
|
||||
class row_properties
|
||||
{
|
||||
public:
|
||||
void set_height(int height) { this->height = height; }
|
||||
int row_index;
|
||||
int height;
|
||||
bool visible;
|
||||
int outline_level;
|
||||
bool collapsed;
|
||||
int style_index;
|
||||
};
|
||||
|
||||
struct page_setup
|
||||
{
|
||||
|
@ -145,6 +157,8 @@ public:
|
|||
const cell get_cell(const cell_reference &reference) const;
|
||||
range get_range(const range_reference &reference);
|
||||
const range get_range(const range_reference &reference) const;
|
||||
row_properties &get_row_properties(row_t row);
|
||||
const row_properties &get_row_properties(row_t row) const;
|
||||
range rows() const;
|
||||
range columns() const;
|
||||
std::list<cell> get_cell_collection();
|
||||
|
@ -200,8 +214,8 @@ public:
|
|||
|
||||
// auto filter
|
||||
range_reference get_auto_filter() const;
|
||||
void set_auto_filter(const xlnt::range &range);
|
||||
void set_auto_filter(const range_reference &reference);
|
||||
void auto_filter(const xlnt::range &range);
|
||||
void auto_filter(const range_reference &reference);
|
||||
void unset_auto_filter();
|
||||
bool has_auto_filter() const;
|
||||
|
||||
|
|
|
@ -5,16 +5,22 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
class workbook;
|
||||
class worksheet;
|
||||
|
||||
class writer
|
||||
{
|
||||
public:
|
||||
static std::string write_workbook(const workbook &wb);
|
||||
static std::string write_worksheet(worksheet ws);
|
||||
static std::string write_worksheet(worksheet ws, const std::vector<std::string> &string_table);
|
||||
static std::string write_worksheet(worksheet ws, const std::vector<std::string> &string_table, const std::unordered_map<std::size_t, std::string> &style_table);
|
||||
static std::string write_theme();
|
||||
static std::string write_content_types(const std::pair<std::unordered_map<std::string, std::string>, std::unordered_map<std::string, std::string>> &content_types);
|
||||
static std::string write_relationships(const std::unordered_map<std::string, std::pair<std::string, std::string>> &relationships);
|
||||
static std::string write_workbook_rels(const workbook &wb);
|
||||
static std::string write_worksheet_rels(worksheet ws, int n);
|
||||
static std::string write_string_table(const std::unordered_map<std::string, int> &string_table);
|
||||
};
|
||||
|
||||
} // namespace xlnt
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "range_reference.h"
|
||||
#include "relationship.h"
|
||||
#include "string_table.h"
|
||||
#include "style_writer.h"
|
||||
#include "workbook.h"
|
||||
#include "worksheet.h"
|
||||
#include "writer.h"
|
||||
|
|
|
@ -337,6 +337,20 @@ cell &cell::operator=(double value)
|
|||
return *this;
|
||||
}
|
||||
|
||||
cell &cell::operator=(long int value)
|
||||
{
|
||||
d_->type_ = type::numeric;
|
||||
d_->numeric_value = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cell &cell::operator=(long double value)
|
||||
{
|
||||
d_->type_ = type::numeric;
|
||||
d_->numeric_value = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
cell &cell::operator=(bool value)
|
||||
{
|
||||
d_->type_ = type::boolean;
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
namespace xlnt {
|
||||
namespace detail {
|
||||
|
||||
cell_impl::cell_impl() : type_(cell::type::null), column(0), row(0)
|
||||
cell_impl::cell_impl() : type_(cell::type::null), column(0), row(0), style_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
cell_impl::cell_impl(int column_index, int row_index) : type_(cell::type::null), column(column_index), row(row_index)
|
||||
cell_impl::cell_impl(int column_index, int row_index) : type_(cell::type::null), column(column_index), row(row_index), style_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ struct worksheet_impl
|
|||
}
|
||||
|
||||
workbook *parent_;
|
||||
std::unordered_map<row_t, row_properties> row_properties_;
|
||||
std::string title_;
|
||||
cell_reference freeze_panes_;
|
||||
std::unordered_map<int, std::unordered_map<int, cell_impl>> cell_map_;
|
||||
|
|
15
source/style_writer.cpp
Normal file
15
source/style_writer.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#include "style_writer.h"
|
||||
|
||||
namespace xlnt {
|
||||
|
||||
style_writer::style_writer(xlnt::workbook &wb) : wb_(wb)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::unordered_map<std::size_t, std::string> style_writer::get_style_by_hash() const
|
||||
{
|
||||
return std::unordered_map<std::size_t, std::string>();
|
||||
}
|
||||
|
||||
} // namespace xlnt
|
|
@ -1,4 +1,5 @@
|
|||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
|
@ -227,7 +228,19 @@ range workbook::get_named_range(const std::string &name)
|
|||
throw std::runtime_error("named range not found");
|
||||
}
|
||||
|
||||
void workbook::load(const std::string &filename)
|
||||
bool workbook::load(const std::vector<unsigned char> &data)
|
||||
{
|
||||
std::ofstream tmp;
|
||||
tmp.open("/tmp/xlnt.xlsx", std::ios::out);
|
||||
for(auto c : data)
|
||||
{
|
||||
tmp.put(c);
|
||||
}
|
||||
load("/tmp/xlnt.xlsx");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool workbook::load(const std::string &filename)
|
||||
{
|
||||
zip_file f(filename, file_mode::open);
|
||||
//auto core_properties = read_core_properties();
|
||||
|
@ -266,6 +279,8 @@ void workbook::load(const std::string &filename)
|
|||
sheet_filename += workbook_relationships[relation_id].second;
|
||||
xlnt::reader::read_worksheet(ws, f.get_file_contents(sheet_filename).c_str(), shared_strings);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void workbook::remove_sheet(worksheet ws)
|
||||
|
@ -372,7 +387,19 @@ void workbook::clear()
|
|||
d_->worksheets_.clear();
|
||||
}
|
||||
|
||||
void workbook::save(const std::string &filename)
|
||||
bool workbook::save(std::vector<unsigned char> &data)
|
||||
{
|
||||
save("/tmp/xlnt.xlsx");
|
||||
std::ifstream tmp;
|
||||
tmp.open("/tmp/xlnt.xlsx");
|
||||
auto char_data = std::vector<char>((std::istreambuf_iterator<char>(tmp)),
|
||||
std::istreambuf_iterator<char>());
|
||||
data = std::vector<unsigned char>(char_data.begin(), char_data.end());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool workbook::save(const std::string &filename)
|
||||
{
|
||||
zip_file f(filename, file_mode::create, file_access::write);
|
||||
|
||||
|
@ -432,6 +459,8 @@ void workbook::save(const std::string &filename)
|
|||
doc.save(ss);
|
||||
|
||||
f.set_file_contents("xl/workbook.xml", ss.str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool workbook::operator==(const workbook &rhs) const
|
||||
|
|
|
@ -55,14 +55,14 @@ margins &worksheet::get_page_margins()
|
|||
return d_->page_margins_;
|
||||
}
|
||||
|
||||
void worksheet::set_auto_filter(const range_reference &reference)
|
||||
void worksheet::auto_filter(const range_reference &reference)
|
||||
{
|
||||
d_->auto_filter_ = reference;
|
||||
}
|
||||
|
||||
void worksheet::set_auto_filter(const xlnt::range &range)
|
||||
void worksheet::auto_filter(const xlnt::range &range)
|
||||
{
|
||||
set_auto_filter(range.get_reference());
|
||||
auto_filter(range.get_reference());
|
||||
}
|
||||
|
||||
range_reference worksheet::get_auto_filter() const
|
||||
|
@ -188,6 +188,11 @@ const cell worksheet::get_cell(const cell_reference &reference) const
|
|||
return cell(&d_->cell_map_.at(reference.get_row_index()).at(reference.get_column_index()));
|
||||
}
|
||||
|
||||
row_properties &worksheet::get_row_properties(row_t row)
|
||||
{
|
||||
return d_->row_properties_[row];
|
||||
}
|
||||
|
||||
range worksheet::get_named_range(const std::string &name)
|
||||
{
|
||||
if(!has_named_range(name))
|
||||
|
|
|
@ -14,7 +14,33 @@
|
|||
|
||||
namespace xlnt {
|
||||
|
||||
std::string writer::write_string_table(const std::unordered_map<std::string, int> &/*string_table*/)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string writer::write_workbook_rels(const workbook &/*wb*/)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string writer::write_worksheet_rels(worksheet /*ws*/, int)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
std::string writer::write_workbook(const workbook &/*wb*/)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
std::string writer::write_worksheet(worksheet ws, const std::vector<std::string> &string_table)
|
||||
{
|
||||
return write_worksheet(ws, string_table, {});
|
||||
}
|
||||
|
||||
std::string writer::write_worksheet(worksheet ws, const std::vector<std::string> &string_table, const std::unordered_map<std::size_t, std::string> &)
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
auto root_node = doc.append_child("worksheet");
|
||||
|
|
61
tests/Helper.h
Normal file
61
tests/Helper.h
Normal file
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
#include <sstream>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
#include "PathHelper.h"
|
||||
|
||||
class Helper
|
||||
{
|
||||
public:
|
||||
static bool EqualsFileContent(const std::string &reference_file, const std::string &fixture)
|
||||
{
|
||||
std::string fixture_content;
|
||||
|
||||
if(PathHelper::FileExists(fixture))
|
||||
{
|
||||
std::fstream fixture_file;
|
||||
fixture_file.open(fixture);
|
||||
std::stringstream ss;
|
||||
ss << fixture_file.rdbuf();
|
||||
fixture_content = ss.str();
|
||||
}
|
||||
else
|
||||
{
|
||||
fixture_content = fixture;
|
||||
}
|
||||
|
||||
std::string expected_content;
|
||||
|
||||
if(PathHelper::FileExists(reference_file))
|
||||
{
|
||||
std::fstream file;
|
||||
file.open(reference_file);
|
||||
std::stringstream ss;
|
||||
ss << file.rdbuf();
|
||||
expected_content = ss.str();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("file not found");
|
||||
}
|
||||
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
doc.load(fixture_content.c_str());
|
||||
std::stringstream ss;
|
||||
doc.save(ss);
|
||||
fixture_content = ss.str();
|
||||
}
|
||||
|
||||
{
|
||||
pugi::xml_document doc;
|
||||
doc.load(expected_content.c_str());
|
||||
std::stringstream ss;
|
||||
doc.save(ss);
|
||||
expected_content = ss.str();
|
||||
}
|
||||
|
||||
return expected_content == fixture_content;
|
||||
}
|
||||
};
|
|
@ -95,6 +95,11 @@ public:
|
|||
|
||||
dst << src.rdbuf();
|
||||
}
|
||||
|
||||
static void DeleteFile(const std::string &path)
|
||||
{
|
||||
std::remove(path.c_str());
|
||||
}
|
||||
|
||||
static bool FileExists(const std::string &path)
|
||||
{
|
||||
|
|
|
@ -238,13 +238,13 @@ public:
|
|||
{
|
||||
xlnt::worksheet ws(wb);
|
||||
|
||||
ws.set_auto_filter(ws.get_range("a1:f1"));
|
||||
ws.auto_filter(ws.get_range("a1:f1"));
|
||||
TS_ASSERT_EQUALS(ws.get_auto_filter(), "A1:F1");
|
||||
|
||||
ws.unset_auto_filter();
|
||||
TS_ASSERT_EQUALS(ws.has_auto_filter(), false);
|
||||
|
||||
ws.set_auto_filter("c1:g9");
|
||||
ws.auto_filter("c1:g9");
|
||||
TS_ASSERT_EQUALS(ws.get_auto_filter(), "C1:G9");
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include <xlnt/xlnt.h>
|
||||
#include "TemporaryFile.h"
|
||||
#include "PathHelper.h"
|
||||
#include "Helper.h"
|
||||
|
||||
class WriteTestSuite : public CxxTest::TestSuite
|
||||
{
|
||||
|
@ -17,142 +18,128 @@ public:
|
|||
|
||||
void test_write_empty_workbook()
|
||||
{
|
||||
TemporaryFile temp_file;
|
||||
xlnt::workbook wb;
|
||||
auto dest_filename = temp_file.GetFilename();
|
||||
wb.save(dest_filename);
|
||||
TS_ASSERT(PathHelper::FileExists(dest_filename));
|
||||
if(PathHelper::FileExists(temp_file.GetFilename()))
|
||||
{
|
||||
PathHelper::DeleteFile(temp_file.GetFilename());
|
||||
}
|
||||
|
||||
TS_ASSERT(!PathHelper::FileExists(temp_file.GetFilename()));
|
||||
wb.save(temp_file.GetFilename());
|
||||
TS_ASSERT(PathHelper::FileExists(temp_file.GetFilename()));
|
||||
}
|
||||
|
||||
void test_write_virtual_workbook()
|
||||
{
|
||||
/*xlnt::workbook old_wb;
|
||||
saved_wb = save_virtual_workbook(old_wb);
|
||||
new_wb = load_workbook(BytesIO(saved_wb));
|
||||
assert new_wb;*/
|
||||
xlnt::workbook old_wb;
|
||||
std::vector<unsigned char> saved_wb;
|
||||
TS_ASSERT(old_wb.save(saved_wb));
|
||||
xlnt::workbook new_wb;
|
||||
TS_ASSERT(new_wb.load(saved_wb));
|
||||
}
|
||||
|
||||
void test_write_workbook_rels()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
content = write_workbook_rels(wb);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"workbook.xml.rels"), content);*/
|
||||
xlnt::workbook wb;
|
||||
auto content = xlnt::writer::write_workbook_rels(wb);
|
||||
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/workbook.xml.rels", content));
|
||||
}
|
||||
|
||||
void test_write_workbook()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
content = write_workbook(wb);
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"workbook.xml"), content);*/
|
||||
xlnt::workbook wb;
|
||||
auto content = xlnt::writer::write_workbook(wb);
|
||||
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/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);*/
|
||||
std::unordered_map<std::string, int> table = {{"hello", 1}, {"world", 2}, {"nice", 3}};
|
||||
auto content = xlnt::writer::write_string_table(table);
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sharedStrings.xml", content));
|
||||
}
|
||||
|
||||
void test_write_worksheet()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F42") = "hello";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1.xml"), content);*/
|
||||
ws.get_cell("F42") = "hello";
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"hello", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1.xml", content));
|
||||
}
|
||||
|
||||
void test_write_hidden_worksheet()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.sheet_state = ws.SHEETSTATE_HIDDEN;
|
||||
ws.cell("F42") = "hello";
|
||||
content = write_worksheet(ws, {"hello": 0}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1.xml"), content);*/
|
||||
ws.get_page_setup().set_sheet_state(xlnt::page_setup::sheet_state::hidden);
|
||||
ws.get_cell("F42") = "hello";
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"hello", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1.xml", content));
|
||||
}
|
||||
|
||||
void test_write_bool()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F42") = False;
|
||||
ws.cell("F43") = True;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_bool.xml"), content);*/
|
||||
ws.get_cell("F42") = false;
|
||||
ws.get_cell("F43") = true;
|
||||
auto content = xlnt::writer::write_worksheet(ws, {}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_bool.xml", content));
|
||||
}
|
||||
|
||||
void test_write_formula()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F1") = 10;
|
||||
ws.cell("F2") = 32;
|
||||
ws.cell("F3") = "=F1+F2";
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"sheet1_formula.xml"), content);*/
|
||||
ws.get_cell("F1") = 10;
|
||||
ws.get_cell("F2") = 32;
|
||||
ws.get_cell("F3") = "=F1+F2";
|
||||
auto content = xlnt::writer::write_worksheet(ws, {}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_formula.xml", content));
|
||||
}
|
||||
|
||||
void test_write_style()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F1") = "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);*/
|
||||
ws.get_cell("F1") = "13%";
|
||||
auto style_id_by_hash = xlnt::style_writer(wb).get_style_by_hash();
|
||||
auto content = xlnt::writer::write_worksheet(ws, {}, style_id_by_hash);
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_style.xml", content));
|
||||
}
|
||||
|
||||
void test_write_height()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F1") = 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);*/
|
||||
ws.get_cell("F1") = 10;
|
||||
ws.get_row_properties(ws.get_cell("F1").get_row()).set_height(30);
|
||||
auto content = xlnt::writer::write_worksheet(ws, {}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_height.xml", content));
|
||||
}
|
||||
|
||||
void test_write_hyperlink()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("A1") = "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);*/
|
||||
ws.get_cell("A1") = "test";
|
||||
ws.get_cell("A1").set_hyperlink("http:test.com");
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"test", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml", content));
|
||||
}
|
||||
|
||||
void test_write_hyperlink_rels()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
TS_ASSERT_EQUALS(0, len(ws.relationships));
|
||||
ws.cell("A1") = "test";
|
||||
ws.cell("A1").hyperlink = "http:test.com/";
|
||||
TS_ASSERT_EQUALS(1, len(ws.relationships));
|
||||
ws.cell("A2") = "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);*/
|
||||
TS_ASSERT_EQUALS(0, ws.get_relationships().size());
|
||||
ws.get_cell("A1") = "test";
|
||||
ws.get_cell("A1").set_hyperlink("http:test.com/");
|
||||
TS_ASSERT_EQUALS(1, ws.get_relationships().size());
|
||||
ws.get_cell("A2") = "test";
|
||||
ws.get_cell("A2").set_hyperlink("http:test2.com/");
|
||||
TS_ASSERT_EQUALS(2, ws.get_relationships().size());
|
||||
auto content = xlnt::writer::write_worksheet_rels(ws, 1);
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml.rels", content));
|
||||
}
|
||||
|
||||
void test_hyperlink_value()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.get_cell("A1").set_hyperlink("http://test.com");
|
||||
TS_ASSERT_EQUALS("http://test.com", ws.get_cell("A1"));
|
||||
|
@ -162,79 +149,60 @@ public:
|
|||
|
||||
void test_write_auto_filter()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb[0];
|
||||
ws.cell("F42") = "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);
|
||||
auto ws = wb.create_sheet();
|
||||
ws.get_cell("F42") = "hello";
|
||||
ws.auto_filter("A1:F1");
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"hello", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/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 = xlnt::writer::write_workbook(wb);
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/workbook_auto_filter.xml", content));
|
||||
}
|
||||
|
||||
void test_freeze_panes_horiz()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F42") = "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);*/
|
||||
ws.get_cell("F42") = "hello";
|
||||
ws.freeze_panes("A4");
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"hello", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_horiz.xml", content));
|
||||
}
|
||||
|
||||
void test_freeze_panes_vert()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F42") = "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);*/
|
||||
ws.get_cell("F42") = "hello";
|
||||
ws.freeze_panes("D1");
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"hello", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_vert.xml", content));
|
||||
}
|
||||
|
||||
void test_freeze_panes_both()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("F42") = "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);*/
|
||||
ws.get_cell("F42") = "hello";
|
||||
ws.freeze_panes("D4");
|
||||
auto content = xlnt::writer::write_worksheet(ws, {{"hello", 0}}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_freeze_panes_both.xml", content));
|
||||
}
|
||||
|
||||
void test_long_number()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("A1") = 9781231231230;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"long_number.xml"), content);*/
|
||||
}
|
||||
|
||||
void test_decimal()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("A1") = decimal.Decimal("3.14");
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"decimal.xml"), content);*/
|
||||
ws.get_cell("A1") = 9781231231230;
|
||||
auto content = xlnt::writer::write_worksheet(ws, {}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/long_number.xml", content));
|
||||
}
|
||||
|
||||
void test_short_number()
|
||||
{
|
||||
/*xlnt::workbook wb;
|
||||
auto ws = wb.create_sheet();
|
||||
ws.cell("A1") = 1234567890;
|
||||
content = write_worksheet(ws, {}, {});
|
||||
assert_equals_file_content(os.path.join(DATADIR, "writer", "expected", \
|
||||
"short_number.xml"), content);*/
|
||||
ws.get_cell("A1") = 1234567890;
|
||||
auto content = xlnt::writer::write_worksheet(ws, {}, {});
|
||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/short_number.xml", content));
|
||||
}
|
||||
|
||||
private:
|
||||
TemporaryFile temp_file;
|
||||
xlnt::workbook wb;
|
||||
};
|
||||
|
|
|
@ -1124,47 +1124,47 @@ public:
|
|||
static WriteTestSuite suite_WriteTestSuite;
|
||||
|
||||
static CxxTest::List Tests_WriteTestSuite = { 0, 0 };
|
||||
CxxTest::StaticSuiteDescription suiteDescription_WriteTestSuite( "../../tests/WriteTestSuite.h", 10, "WriteTestSuite", suite_WriteTestSuite, Tests_WriteTestSuite );
|
||||
CxxTest::StaticSuiteDescription suiteDescription_WriteTestSuite( "../../tests/WriteTestSuite.h", 11, "WriteTestSuite", suite_WriteTestSuite, Tests_WriteTestSuite );
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_empty_workbook : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_empty_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 18, "test_write_empty_workbook" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_empty_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 19, "test_write_empty_workbook" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_empty_workbook(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_empty_workbook;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_virtual_workbook : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_virtual_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 27, "test_write_virtual_workbook" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_virtual_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 31, "test_write_virtual_workbook" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_virtual_workbook(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_virtual_workbook;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_workbook_rels : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_workbook_rels() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 35, "test_write_workbook_rels" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_workbook_rels() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 40, "test_write_workbook_rels" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_workbook_rels(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_workbook_rels;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_workbook : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 43, "test_write_workbook" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_workbook() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 48, "test_write_workbook" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_workbook(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_workbook;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_string_table : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_string_table() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 52, "test_write_string_table" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_string_table() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 57, "test_write_string_table" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_string_table(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_string_table;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_worksheet : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_worksheet() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 60, "test_write_worksheet" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_worksheet() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 64, "test_write_worksheet" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_worksheet(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_worksheet;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_hidden_worksheet : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_hidden_worksheet() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 70, "test_write_hidden_worksheet" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_hidden_worksheet() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 72, "test_write_hidden_worksheet" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_hidden_worksheet(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_hidden_worksheet;
|
||||
|
||||
|
@ -1176,79 +1176,73 @@ public:
|
|||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_formula : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_formula() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 92, "test_write_formula" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_formula() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 90, "test_write_formula" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_formula(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_formula;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_style : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_style() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 104, "test_write_style" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_style() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 100, "test_write_style" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_style(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_style;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_height : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_height() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 115, "test_write_height" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_height() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 109, "test_write_height" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_height(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_height;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_hyperlink : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_hyperlink() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 126, "test_write_hyperlink" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_hyperlink() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 118, "test_write_hyperlink" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_hyperlink(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_hyperlink;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_hyperlink_rels : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_hyperlink_rels() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 137, "test_write_hyperlink_rels" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_hyperlink_rels() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 127, "test_write_hyperlink_rels" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_hyperlink_rels(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_hyperlink_rels;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_hyperlink_value : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 153, "test_hyperlink_value" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 141, "test_hyperlink_value" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_hyperlink_value(); }
|
||||
} testDescription_suite_WriteTestSuite_test_hyperlink_value;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_write_auto_filter : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_write_auto_filter() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 163, "test_write_auto_filter" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_write_auto_filter() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 150, "test_write_auto_filter" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_write_auto_filter(); }
|
||||
} testDescription_suite_WriteTestSuite_test_write_auto_filter;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_freeze_panes_horiz : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_freeze_panes_horiz() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 178, "test_freeze_panes_horiz" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_freeze_panes_horiz() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 162, "test_freeze_panes_horiz" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_freeze_panes_horiz(); }
|
||||
} testDescription_suite_WriteTestSuite_test_freeze_panes_horiz;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_freeze_panes_vert : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_freeze_panes_vert() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 189, "test_freeze_panes_vert" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_freeze_panes_vert() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 171, "test_freeze_panes_vert" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_freeze_panes_vert(); }
|
||||
} testDescription_suite_WriteTestSuite_test_freeze_panes_vert;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_freeze_panes_both : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_freeze_panes_both() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 200, "test_freeze_panes_both" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_freeze_panes_both() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 180, "test_freeze_panes_both" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_freeze_panes_both(); }
|
||||
} testDescription_suite_WriteTestSuite_test_freeze_panes_both;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_long_number : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_long_number() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 211, "test_long_number" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_long_number() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 189, "test_long_number" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_long_number(); }
|
||||
} testDescription_suite_WriteTestSuite_test_long_number;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_decimal : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_decimal() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 221, "test_decimal" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_decimal(); }
|
||||
} testDescription_suite_WriteTestSuite_test_decimal;
|
||||
|
||||
static class TestDescription_suite_WriteTestSuite_test_short_number : public CxxTest::RealTestDescription {
|
||||
public:
|
||||
TestDescription_suite_WriteTestSuite_test_short_number() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 231, "test_short_number" ) {}
|
||||
TestDescription_suite_WriteTestSuite_test_short_number() : CxxTest::RealTestDescription( Tests_WriteTestSuite, suiteDescription_WriteTestSuite, 197, "test_short_number" ) {}
|
||||
void runTest() { suite_WriteTestSuite.test_short_number(); }
|
||||
} testDescription_suite_WriteTestSuite_test_short_number;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user