1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#![cfg(feature = "std")]
use tabled::settings::{Shadow, Style};
use crate::matrix::Matrix;
use testing_table::test_table;
#[cfg(feature = "color")]
use ::{owo_colors::OwoColorize, std::convert::TryFrom, tabled::settings::Color};
test_table!(
test_shadow_bottom_right_0,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Style::psql()).with(Shadow::new(1)),
" i32 | i32 | i32 "
"-----+-----+-----▒"
" 123 | 456 | 789 ▒"
" 234 | 567 | 891 ▒"
" ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
);
test_table!(
test_shadow_bottom_left_0,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Style::psql()).with(Shadow::new(1).set_left()),
" i32 | i32 | i32 "
"▒-----+-----+-----"
"▒ 123 | 456 | 789 "
"▒ 234 | 567 | 891 "
"▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ "
);
test_table!(
test_shadow_top_right_0,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Style::psql()).with(Shadow::new(1).set_top()),
" ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
" i32 | i32 | i32 ▒"
"-----+-----+-----▒"
" 123 | 456 | 789 ▒"
" 234 | 567 | 891 "
);
test_table!(
test_shadow_top_left_0,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Style::psql()).with(Shadow::new(1).set_top().set_left()),
"▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ "
"▒ i32 | i32 | i32 "
"▒-----+-----+-----"
"▒ 123 | 456 | 789 "
" 234 | 567 | 891 "
);
test_table!(
test_shadow_set_fill,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Shadow::new(1).set_fill('▓')),
"+-----+-----+-----+ "
"| i32 | i32 | i32 |▓"
"+-----+-----+-----+▓"
"| 123 | 456 | 789 |▓"
"+-----+-----+-----+▓"
"| 234 | 567 | 891 |▓"
"+-----+-----+-----+▓"
" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
);
test_table!(
test_shadow_size_1,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Shadow::new(2).set_fill('▓')),
"+-----+-----+-----+ "
"| i32 | i32 | i32 |▓▓"
"+-----+-----+-----+▓▓"
"| 123 | 456 | 789 |▓▓"
"+-----+-----+-----+▓▓"
"| 234 | 567 | 891 |▓▓"
"+-----+-----+-----+▓▓"
" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
" ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓"
);
test_table!(
test_shadow_set_offset_0,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Shadow::new(2).set_offset(3)),
"+-----+-----+-----+ "
"| i32 | i32 | i32 | "
"+-----+-----+-----+ "
"| 123 | 456 | 789 |▒▒"
"+-----+-----+-----+▒▒"
"| 234 | 567 | 891 |▒▒"
"+-----+-----+-----+▒▒"
" ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
" ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒"
);
#[cfg(feature = "color")]
test_table!(
test_shadow_set_color_0,
Matrix::iter([(123, 456, 789), (234, 567, 891)]).with(Shadow::new(2).set_offset(3).set_color(Color::try_from(' '.red().to_string()).unwrap())),
"+-----+-----+-----+ "
"| i32 | i32 | i32 | "
"+-----+-----+-----+ "
"| 123 | 456 | 789 |\u{1b}[31m▒▒\u{1b}[39m"
"+-----+-----+-----+\u{1b}[31m▒▒\u{1b}[39m"
"| 234 | 567 | 891 |\u{1b}[31m▒▒\u{1b}[39m"
"+-----+-----+-----+\u{1b}[31m▒▒\u{1b}[39m"
" \u{1b}[31m▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒\u{1b}[39m"
" \u{1b}[31m▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒\u{1b}[39m"
);
|