2018-11-21 18:50:56 +01:00
|
|
|
#include "fort.hpp"
|
|
|
|
#include "tests.h"
|
|
|
|
|
|
|
|
|
2019-09-28 10:02:34 +02:00
|
|
|
bool set_cpp_test_props_for_table(fort::char_table *table)
|
2018-11-21 18:50:56 +01:00
|
|
|
{
|
|
|
|
assert_true(table->set_cell_bottom_padding(1));
|
|
|
|
assert_true(table->set_cell_top_padding(1));
|
|
|
|
assert_true(table->set_cell_left_padding(1));
|
|
|
|
assert_true(table->set_cell_right_padding(1));
|
|
|
|
assert_true(table->set_cell_empty_str_height(1));
|
|
|
|
|
|
|
|
struct ft_border_style brdr_style;
|
|
|
|
brdr_style.border_chs.top_border_ch = "-";
|
|
|
|
brdr_style.border_chs.separator_ch = "-";
|
|
|
|
brdr_style.border_chs.bottom_border_ch = "-";
|
|
|
|
brdr_style.border_chs.side_border_ch = "|";
|
|
|
|
brdr_style.border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.border_chs.in_intersect_ch = "+";
|
|
|
|
|
|
|
|
brdr_style.header_border_chs.top_border_ch = "-";
|
|
|
|
brdr_style.header_border_chs.separator_ch = "-";
|
|
|
|
brdr_style.header_border_chs.bottom_border_ch = "-";
|
|
|
|
brdr_style.header_border_chs.side_border_ch = "|";
|
|
|
|
brdr_style.header_border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.header_border_chs.in_intersect_ch = "+";
|
|
|
|
|
|
|
|
brdr_style.hor_separator_char = "=";
|
|
|
|
table->set_border_style(&brdr_style);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-09-28 10:02:34 +02:00
|
|
|
fort::char_table create_cpp_test_int_table(int set_test_opts)
|
2018-11-21 18:50:56 +01:00
|
|
|
{
|
2019-09-28 10:02:34 +02:00
|
|
|
fort::char_table table;
|
2018-11-21 18:50:56 +01:00
|
|
|
|
|
|
|
if (set_test_opts) {
|
|
|
|
assert_true(set_cpp_test_props_for_table(&table) == true);
|
|
|
|
}
|
|
|
|
|
|
|
|
table[0].set_cell_row_type(fort::row_type::header);
|
|
|
|
assert(table.write_ln("3", "4", "55", "67"));
|
|
|
|
assert(table.write_ln("3", "4", "55", "67"));
|
|
|
|
assert(table.write_ln("3", "4", "55", "67"));
|
|
|
|
|
|
|
|
return table;
|
|
|
|
}
|
2018-11-24 21:14:26 +01:00
|
|
|
|
|
|
|
|
|
|
|
int set_test_properties_as_default(void)
|
|
|
|
{
|
|
|
|
bool status = true;
|
|
|
|
|
2019-09-28 10:02:34 +02:00
|
|
|
status = status && fort::char_table::default_props().set_cell_min_width(0);
|
|
|
|
status = status && fort::char_table::default_props().set_cell_text_align(fort::text_align::right);
|
2018-11-24 21:14:26 +01:00
|
|
|
|
2019-09-28 10:02:34 +02:00
|
|
|
status = status && fort::char_table::default_props().set_cell_bottom_padding(1);
|
|
|
|
status = status && fort::char_table::default_props().set_cell_top_padding(1);
|
|
|
|
status = status && fort::char_table::default_props().set_cell_left_padding(1);
|
|
|
|
status = status && fort::char_table::default_props().set_cell_right_padding(1);
|
|
|
|
status = status && fort::char_table::default_props().set_cell_empty_str_height(1);
|
2018-11-24 21:14:26 +01:00
|
|
|
|
|
|
|
assert_true(status == true);
|
|
|
|
|
|
|
|
struct ft_border_style brdr_style;
|
|
|
|
brdr_style.border_chs.top_border_ch = "-";
|
|
|
|
brdr_style.border_chs.separator_ch = "-";
|
|
|
|
brdr_style.border_chs.bottom_border_ch = "-";
|
|
|
|
brdr_style.border_chs.side_border_ch = "|";
|
|
|
|
brdr_style.border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.border_chs.in_intersect_ch = "+";
|
|
|
|
|
|
|
|
brdr_style.header_border_chs.top_border_ch = "-";
|
|
|
|
brdr_style.header_border_chs.separator_ch = "-";
|
|
|
|
brdr_style.header_border_chs.bottom_border_ch = "-";
|
|
|
|
brdr_style.header_border_chs.side_border_ch = "|";
|
|
|
|
brdr_style.header_border_chs.out_intersect_ch = "+";
|
|
|
|
brdr_style.header_border_chs.in_intersect_ch = "+";
|
|
|
|
|
|
|
|
brdr_style.hor_separator_char = "=";
|
|
|
|
|
|
|
|
return fort::set_default_border_style(&brdr_style);
|
|
|
|
}
|