Repository: zhiburt/tabled
Pull request #85 (2022-03-15 05:46:05)

Add an option to set the character for the padding 
#81 Add an option to set the character for the padding 
#83 Rename tabled::Indent to Padding

zhiburt: Could you fix `clippy` warnings?

Patch:
diff --git a/benches/table_build.rs b/benches/table_build.rs
index 4db8261..3faa1f5 100644
--- a/benches/table_build.rs
+++ b/benches/table_build.rs
@@ -1,5 +1,5 @@
 use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
-use tabled::{Alignment, Full, Indent, Modify, Style, TableIteratorExt, Tabled};
+use tabled::{Alignment, Full, Modify, Padding, Style, TableIteratorExt, Tabled};
 
 macro_rules! table_bench {
     ($name:ident, $table:expr, $( $modificator:expr ),*) => {
@@ -50,7 +50,7 @@ table_bench!(
     Modify::new(Full)
         .with(Alignment::left())
         .with(Alignment::top())
-        .with(Indent::new(1, 1, 0, 2))
+        .with(Padding::new(1, 1, 0, 2))
 );
 
 table_bench!(big_table, { [0; 16] });
diff --git a/examples/inline.rs b/examples/inline.rs
index d66096c..f9cf099 100644
--- a/examples/inline.rs
+++ b/examples/inline.rs
@@ -2,7 +2,7 @@
 //! `cargo run --example inline`
 
 use tabled::{
-    Alignment, AlignmentHorizontal, Full, Head, Indent, Modify, Row, Style, Table, Tabled,
+    Alignment, AlignmentHorizontal, Full, Head, Modify, Padding, Row, Style, Table, Tabled,
 };
 
 fn main() {
@@ -41,7 +41,7 @@ fn main() {
 
     let table = Table::new(&data)
         .with(Style::modern())
-        .with(Modify::new(Full).with(Indent::new(1, 1, 0, 0)))
+        .with(Modify::new(Full).with(Padding::new(1, 1, 0, 0)))
         .with(Modify::new(Head).with(Alignment::Horizontal(AlignmentHorizontal::Left)))
         .with(Modify::new(Row(1..)).with(Alignment::Horizontal(AlignmentHorizontal::Center)));
 
diff --git a/examples/rotate.rs b/examples/rotate.rs
index ea4147b..c4f2d7f 100644
--- a/examples/rotate.rs
+++ b/examples/rotate.rs
@@ -1,4 +1,4 @@
-use tabled::{Full, Indent, Modify, Rotate, Style, Table, Tabled};
+use tabled::{Full, Modify, Padding, Rotate, Style, Table, Tabled};
 
 #[derive(Tabled)]
 struct Linux {
@@ -29,7 +29,7 @@ fn main() {
     let table = Table::new(&data)
         .with(Rotate::Left)
         .with(Style::blank())
-        .with(Modify::new(Full).with(Indent::new(1, 1, 0, 0)));
+        .with(Modify::new(Full).with(Padding::new(1, 1, 0, 0)));
 
     println!("{}", table);
 }
diff --git a/papergrid/src/lib.rs b/papergrid/src/lib.rs
index 951d5fe..e85e09b 100644
--- a/papergrid/src/lib.rs
+++ b/papergrid/src/lib.rs
@@ -44,6 +44,8 @@ const DEFAULT_SPLIT_BORDER_CHAR: char = ' ';
 
 const DEFAULT_SPLIT_INTERSECTION_CHAR: char = ' ';
 
+pub const DEFAULT_INDENT_FILL_CHAR: char = ' ';
+
 /// Grid provides a set of methods for building a text-based table
 pub struct Grid {
     size: (usize, usize),
@@ -115,8 +117,8 @@ impl Grid {
             self.set_text(entity, text);
         }
 
-        if let Some(indent) = settings.indent {
-            self.style_mut(entity).indent = indent;
+        if let Some(padding) = settings.padding {
+            self.style_mut(entity).padding = padding;
         }
 
         if let Some(alignment_h) = settings.alignment_h {
@@ -296,11 +298,11 @@ impl Grid {
             .alignment(style.alignment_h)
             .vertical_alignment(style.alignment_v)
             .span(style.span)
-            .indent(
-                style.indent.left,
-                style.indent.right,
-                style.indent.top,
-                style.indent.bottom,
+            .padding(
+                style.padding.left,
+                style.padding.right,
+                style.padding.top,
+                style.padding.bottom,
             )
             .border(border)
     }
@@ -653,7 +655,7 @@ impl EntityFrame {
 
 #[derive(Debug, Clone)]
 pub struct Style {
-    pub indent: Indent,
+    pub padding: Padding,
     pub alignment_h: AlignmentHorizontal,
     pub alignment_v: AlignmentVertical,
     pub span: usize,
@@ -664,23 +666,39 @@ impl Default for Style {
         Self {
             alignment_h: AlignmentHorizontal::Left,
             alignment_v: AlignmentVertical::Top,
-            indent: Indent {
-                bottom: 0,
-                left: 0,
-                right: 0,
-                top: 0,
-            },
+            padding: Padding::default(),
             span: 1,
         }
     }
 }
 
-#[derive(Debug, Clone)]
+#[derive(Default, Debug, Clone, Copy)]
+pub struct Padding {
+    pub top: Indent,
+    pub bottom: Indent,
+    pub left: Indent,
+    pub right: Indent,
+}
+
+#[derive(Debug, Clone, Copy)]
 pub struct Indent {
-    pub top: usize,
-    pub bottom: usize,
-    pub left: usize,
-    pub right: usize,
+    pub fill: char,
+    pub size: usize,
+}
+
+impl Default for Indent {
+    fn default() -> Self {
+        Self {
+            fill: DEFAULT_INDENT_FILL_CHAR,
+            size: 0,
+        }
+    }
+}
+
+impl Indent {
+    pub fn new(size: usize, fill: char) -> Self {
+        Self { size, fill }
+    }
 }
 
 /// AlignmentHorizontal represents an horizontal aligment of a cell content.
@@ -745,7 +763,7 @@ impl AlignmentVertical {
 #[derive(Debug, Clone, Default)]
 pub struct Settings {
     text: Option<String>,
-    indent: Option<Indent>,
+    padding: Option<Padding>,
     alignment_h: Option<AlignmentHorizontal>,
     alignment_v: Option<AlignmentVertical>,
     span: Option<usize>,
@@ -765,9 +783,9 @@ impl Settings {
         self
     }
 
-    /// Indent method sets indent for a cell
-    pub fn indent(mut self, left: usize, right: usize, top: usize, bottom: usize) -> Self {
-        self.indent = Some(Indent {
+    /// padding method sets padding for a cell
+    pub fn padding(mut self, left: Indent, right: Indent, top: Indent, bottom: Indent) -> Self {
+        self.padding = Some(Padding {
             top,
             bottom,
             left,
@@ -941,14 +959,14 @@ fn build_row_internal_line(
 ) -> fmt::Result {
     let top_indent = top_indent(cell, style, height);
     if top_indent > line_index {
-        return empty_line(f, width);
+        return repeat_char(f, style.padding.top.fill, width);
     }
 
     let cell_line_index = line_index - top_indent;
     let cell_has_this_line = cell.len() > cell_line_index;
     // happen when other cells have bigger height
     if !cell_has_this_line {
-        return empty_line(f, width);
+        return repeat_char(f, style.padding.bottom.fill, width);
     }
 
     let line_text = cell[cell_line_index];
@@ -956,42 +974,40 @@ fn build_row_internal_line(
         f,
         line_text,
         width,
-        style.indent.left,
-        style.indent.right,
+        style.padding.left,
+        style.padding.right,
         style.alignment_h,
     )
 }
 
 fn top_indent(cell: &[&str], style: &Style, height: usize) -> usize {
-    let height = height - style.indent.top;
-    let content_height = cell_height(cell, style) - style.indent.top - style.indent.bottom;
+    let height = height - style.padding.top.size;
+    let content_height =
+        cell_height(cell, style) - style.padding.top.size - style.padding.bottom.size;
     let indent = style.alignment_v.top_ident(height, content_height);
-    indent + style.indent.top
-}
-
-fn empty_line(f: &mut std::fmt::Formatter<'_>, n: usize) -> fmt::Result {
-    write!(f, "{:1$}", "", n)
+    indent + style.padding.top.size
 }
 
 fn repeat_char(f: &mut std::fmt::Formatter<'_>, c: char, n: usize) -> fmt::Result {
     if n > 0 {
-        write!(f, "{:1$}", c, n)
-    } else {
-        Ok(())
+        for _ in 0..n {
+            write!(f, "{}", c)?;
+        }
     }
+    Ok(())
 }
 
 fn line(
     f: &mut std::fmt::Formatter<'_>,
     text: &str,
     width: usize,
-    left_indent: usize,
-    right_indent: usize,
+    left_indent: Indent,
+    right_indent: Indent,
     alignment: AlignmentHorizontal,
 ) -> fmt::Result {
-    repeat_char(f, ' ', left_indent)?;
-    alignment.align(f, text, width - left_indent - right_indent)?;
-    repeat_char(f, ' ', right_indent)?;
+    repeat_char(f, left_indent.fill, left_indent.size)?;
+    alignment.align(f, text, width - left_indent.size - right_indent.size)?;
+    repeat_char(f, right_indent.fill, right_indent.size)?;
     Ok(())
 }
 
@@ -1383,7 +1399,7 @@ fn inc_cells_width(
 
 fn cell_width(cell: &[&str], style: &Style) -> usize {
     let content_width = cell.iter().map(|l| string_width(l)).max().unwrap_or(0);
-    content_width + style.indent.left + style.indent.right
+    content_width + style.padding.left.size + style.padding.right.size
 }
 
 fn rows_height(
@@ -1417,7 +1433,7 @@ fn rows_height(
 
 fn cell_height(cell: &[&str], style: &Style) -> usize {
     let content_height = cell.len();
-    content_height + style.indent.top + style.indent.bottom
+    content_height + style.padding.top.size + style.padding.bottom.size
 }
 
 fn normalized_width(
diff --git a/src/builder.rs b/src/builder.rs
index 46c8856..f884ba3 100644
--- a/src/builder.rs
+++ b/src/builder.rs
@@ -3,7 +3,7 @@
 
 use std::{fmt::Display, iter::FromIterator};
 
-use papergrid::{AlignmentHorizontal, Entity, Grid, Settings};
+use papergrid::{AlignmentHorizontal, Entity, Grid, Indent, Settings, DEFAULT_INDENT_FILL_CHAR};
 
 use crate::{Style, Table};
 
@@ -232,7 +232,12 @@ fn create_table_from_grid(mut grid: Grid) -> Table {
     grid.set(
         &Entity::Global,
         Settings::new()
-            .indent(1, 1, 0, 0)
+            .padding(
+                Indent::new(1, DEFAULT_INDENT_FILL_CHAR),
+                Indent::new(1, DEFAULT_INDENT_FILL_CHAR),
+                Indent::new(0, DEFAULT_INDENT_FILL_CHAR),
+                Indent::new(0, DEFAULT_INDENT_FILL_CHAR),
+            )
             .alignment(AlignmentHorizontal::Center),
     );
 
diff --git a/src/indent.rs b/src/indent.rs
deleted file mode 100644
index deede1e..0000000
--- a/src/indent.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-use crate::CellOption;
-use papergrid::{Entity, Grid, Settings};
-
-/// Indent is responsible for a left/right/top/bottom indent of particular cells.
-///
-/// ```rust,no_run
-///   # use tabled::{Style, Indent, Row, Table, Modify};
-///   # let data: Vec<&'static str> = Vec::new();
-///     let table = Table::new(&data).with(Modify::new(Row(..1)).with(Indent::new(0, 0, 1, 1)));
-/// ```
-#[derive(Debug)]
-pub struct Indent(usize, usize, usize, usize);
-
-impl Indent {
-    /// Construct's an Indent object.
-    pub fn new(left: usize, right: usize, top: usize, bottom: usize) -> Self {
-        Self(left, right, top, bottom)
-    }
-}
-
-impl CellOption for Indent {
-    fn change_cell(&mut self, grid: &mut Grid, row: usize, column: usize) {
-        grid.set(
-            &Entity::Cell(row, column),
-            Settings::new().indent(self.0, self.1, self.2, self.3),
-        )
-    }
-}
diff --git a/src/lib.rs b/src/lib.rs
index 1c51f76..7f4542e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -158,8 +158,8 @@ mod concat;
 mod disable;
 mod formating;
 mod highlight;
-mod indent;
 mod object;
+mod padding;
 mod panel;
 mod rotate;
 mod span;
@@ -171,7 +171,7 @@ pub mod display;
 pub mod style;
 
 pub use crate::{
-    alignment::*, concat::*, disable::*, formating::*, highlight::*, indent::*, object::*,
+    alignment::*, concat::*, disable::*, formating::*, highlight::*, object::*, padding::*,
     panel::*, rotate::*, span::*, style::Style, table::*, width::*,
 };
 
diff --git a/src/padding.rs b/src/padding.rs
new file mode 100644
index 0000000..dda848b
--- /dev/null
+++ b/src/padding.rs
@@ -0,0 +1,40 @@
+use crate::CellOption;
+use papergrid::{Entity, Grid, Settings, DEFAULT_INDENT_FILL_CHAR};
+
+/// Padding is responsible for a left/right/top/bottom indent of particular and fill one set characters.
+///
+/// ```rust,no_run
+///   # use tabled::{Style, Padding, Row, Table, Modify};
+///   # let data: Vec<&'static str> = Vec::new();
+///     let table = Table::new(&data).with(Modify::new(Row(..1)).with(Padding::new(0, 0, 1, 1).set_fill('>', '<', '^', 'V')));
+/// ```
+pub struct Padding(papergrid::Padding);
+
+impl Padding {
+    /// Construct's an Padding object.
+    pub fn new(left: usize, right: usize, top: usize, bottom: usize) -> Self {
+        Self(papergrid::Padding {
+            top: papergrid::Indent::new(top, DEFAULT_INDENT_FILL_CHAR),
+            bottom: papergrid::Indent::new(bottom, DEFAULT_INDENT_FILL_CHAR),
+            left: papergrid::Indent::new(left, DEFAULT_INDENT_FILL_CHAR),
+            right: papergrid::Indent::new(right, DEFAULT_INDENT_FILL_CHAR),
+        })
+    }
+
+    pub fn set_fill(mut self, left: char, right: char, top: char, bottom: char) -> Self {
+        self.0.left.fill = left;
+        self.0.right.fill = right;
+        self.0.top.fill = top;
+        self.0.bottom.fill = bottom;
+        self
+    }
+}
+
+impl CellOption for Padding {
+    fn change_cell(&mut self, grid: &mut Grid, row: usize, column: usize) {
+        grid.set(
+            &Entity::Cell(row, column),
+            Settings::new().padding(self.0.left, self.0.right, self.0.top, self.0.bottom),
+        )
+    }
+}


Test patch:
diff --git a/papergrid/tests/render.rs b/papergrid/tests/render.rs
index d178a14..d0267db 100644
--- a/papergrid/tests/render.rs
+++ b/papergrid/tests/render.rs
@@ -11,7 +11,8 @@
 // copies or substantial portions of the Software.
 
 use papergrid::{
-    AlignmentHorizontal, AlignmentVertical, Entity, Grid, Settings, DEFAULT_CELL_STYLE,
+    AlignmentHorizontal, AlignmentVertical, Entity, Grid, Indent, Settings, DEFAULT_CELL_STYLE,
+    DEFAULT_INDENT_FILL_CHAR,
 };
 
 #[test]
@@ -308,7 +309,12 @@ fn render_row_span_with_horizontal_ident() {
     grid.set(&Entity::Cell(0, 0), Settings::new().text("0-0").span(2));
     grid.set(
         &Entity::Cell(1, 0),
-        Settings::new().text("1-0").indent(4, 4, 0, 0),
+        Settings::new().text("1-0").padding(
+            Indent::new(4, DEFAULT_INDENT_FILL_CHAR),
+            Indent::new(4, DEFAULT_INDENT_FILL_CHAR),
+            Indent::default(),
+            Indent::default(),
+        ),
     );
     grid.set(&Entity::Cell(1, 1), Settings::new().text("1-1"));
     grid.set(&Entity::Cell(2, 0), Settings::new().text("2-0"));
diff --git a/papergrid/tests/styling.rs b/papergrid/tests/styling.rs
index d4b55c6..947c1e6 100644
--- a/papergrid/tests/styling.rs
+++ b/papergrid/tests/styling.rs
@@ -1,4 +1,7 @@
-use papergrid::{AlignmentHorizontal, Border, Entity, Grid, Settings, DEFAULT_CELL_STYLE};
+use papergrid::{
+    AlignmentHorizontal, Border, Entity, Grid, Indent, Settings, DEFAULT_CELL_STYLE,
+    DEFAULT_INDENT_FILL_CHAR,
+};
 
 #[test]
 fn grid_2x2_custom_frame_test() {
@@ -147,9 +150,22 @@ fn grid_2x2_indent_test() {
 
     grid.set(
         &Entity::Global,
-        Settings::new().text("asd").indent(1, 1, 1, 1),
+        Settings::new().text("asd").padding(
+            Indent::new(1, DEFAULT_INDENT_FILL_CHAR),
+            Indent::new(1, DEFAULT_INDENT_FILL_CHAR),
+            Indent::new(1, DEFAULT_INDENT_FILL_CHAR),
+            Indent::new(1, DEFAULT_INDENT_FILL_CHAR),
+        ),
+    );
+    grid.set(
+        &Entity::Column(0),
+        Settings::new().padding(
+            Indent::default(),
+            Indent::default(),
+            Indent::default(),
+            Indent::default(),
+        ),
     );
-    grid.set(&Entity::Column(0), Settings::new().indent(0, 0, 0, 0));
     let str = grid.to_string();
 
     assert_eq!(
diff --git a/tests/alignment_test.rs b/tests/alignment_test.rs
index 2e94b63..bb14dec 100644
--- a/tests/alignment_test.rs
+++ b/tests/alignment_test.rs
@@ -1,5 +1,5 @@
 use crate::util::create_vector;
-use tabled::{Alignment, Column, Full, Head, Indent, Modify, Row, Style, Table};
+use tabled::{Alignment, Column, Full, Head, Modify, Padding, Row, Style, Table};
 
 mod util;
 
@@ -104,7 +104,7 @@ fn vertical_alignment_test() {
 }
 
 #[test]
-fn alignment_doesnt_change_indent() {
+fn alignment_doesnt_change_padding() {
     let data = create_vector::<3, 3>();
 
     let expected = concat!(
@@ -117,7 +117,7 @@ fn alignment_doesnt_change_indent() {
 
     let table = Table::new(&data)
         .with(Style::psql())
-        .with(Modify::new(Full).with(Indent::new(3, 0, 0, 0)))
+        .with(Modify::new(Full).with(Padding::new(3, 0, 0, 0)))
         .with(Modify::new(Full).with(Alignment::left()))
         .to_string();
 
diff --git a/tests/format_test.rs b/tests/format_test.rs
index cc176a7..1150130 100644
--- a/tests/format_test.rs
+++ b/tests/format_test.rs
@@ -1,7 +1,7 @@
 use crate::util::create_vector;
 use tabled::{
-    multiline, Alignment, Cell, Column, Format, FormatFrom, FormatWithIndex, Full, Head, Indent,
-    Modify, Object, Row, Style, Table,
+    multiline, Alignment, Cell, Column, Format, FormatFrom, FormatWithIndex, Full, Head, Modify,
+    Object, Padding, Row, Style, Table,
 };
 
 mod util;
@@ -324,11 +324,11 @@ mod color {
 }
 
 #[test]
-fn format_doesnt_change_indent() {
+fn format_doesnt_change_padding() {
     let data = create_vector::<3, 3>();
     let table = Table::new(&data)
         .with(Modify::new(Full).with(Alignment::left()))
-        .with(Modify::new(Full).with(Indent::new(3, 1, 0, 0)))
+        .with(Modify::new(Full).with(Padding::new(3, 1, 0, 0)))
         .with(Modify::new(Full).with(Format(|s| format!("[{}]", s))))
         .to_string();
 
diff --git a/tests/indent_test.rs b/tests/padding_test.rs
similarity index 56%
rename from tests/indent_test.rs
rename to tests/padding_test.rs
index e3b76a4..4f171c9 100644
--- a/tests/indent_test.rs
+++ b/tests/padding_test.rs
@@ -1,15 +1,15 @@
 use crate::util::create_vector;
-use tabled::{Alignment, Full, Indent, Modify, Row, Style, Table};
+use tabled::{Alignment, Full, Modify, Padding, Row, Style, Table};
 
 mod util;
 
 #[test]
-fn indent() {
+fn padding() {
     let data = create_vector::<3, 3>();
     let table = Table::new(&data)
         .with(Style::psql())
         .with(Modify::new(Full).with(Alignment::left()))
-        .with(Modify::new(Row(1..)).with(Indent::new(1, 1, 0, 2)))
+        .with(Modify::new(Row(1..)).with(Padding::new(1, 1, 0, 2)))
         .to_string();
 
     let expected = concat!(
@@ -30,11 +30,57 @@ fn indent() {
 }
 
 #[test]
-fn indent_multiline() {
+fn padding_with_set_characters() {
     let data = create_vector::<3, 3>();
     let table = Table::new(&data)
         .with(Style::psql())
-        .with(Modify::new(Row(1..)).with(Indent::new(1, 1, 1, 1)))
+        .with(Modify::new(Full).with(Padding::new(1, 2, 1, 1).set_fill('>', '<', 'V', '^')))
+        .to_string();
+
+    let expected = concat!(
+        "VVVV|VVVVVVVVVVV|VVVVVVVVVVV|VVVVVVVVVVV\n",
+        ">N<<|>column 0<<|>column 1<<|>column 2<<\n",
+        "^^^^|^^^^^^^^^^^|^^^^^^^^^^^|^^^^^^^^^^^\n",
+        "----+-----------+-----------+-----------\n",
+        "VVVV|VVVVVVVVVVV|VVVVVVVVVVV|VVVVVVVVVVV\n",
+        ">0<<|>  0-0   <<|>  0-1   <<|>  0-2   <<\n",
+        "^^^^|^^^^^^^^^^^|^^^^^^^^^^^|^^^^^^^^^^^\n",
+        "VVVV|VVVVVVVVVVV|VVVVVVVVVVV|VVVVVVVVVVV\n",
+        ">1<<|>  1-0   <<|>  1-1   <<|>  1-2   <<\n",
+        "^^^^|^^^^^^^^^^^|^^^^^^^^^^^|^^^^^^^^^^^\n",
+        "VVVV|VVVVVVVVVVV|VVVVVVVVVVV|VVVVVVVVVVV\n",
+        ">2<<|>  2-0   <<|>  2-1   <<|>  2-2   <<\n",
+        "^^^^|^^^^^^^^^^^|^^^^^^^^^^^|^^^^^^^^^^^\n",
+    );
+
+    assert_eq!(table, expected);
+}
+
+#[test]
+fn padding_with_set_characters_and_zero_ident() {
+    let data = create_vector::<3, 3>();
+    let table = Table::new(&data)
+        .with(Style::psql())
+        .with(Modify::new(Full).with(Padding::new(0, 0, 0, 0).set_fill('>', '<', '^', 'V')))
+        .to_string();
+
+    let expected = concat!(
+        "N|column 0|column 1|column 2\n",
+        "-+--------+--------+--------\n",
+        "0|  0-0   |  0-1   |  0-2   \n",
+        "1|  1-0   |  1-1   |  1-2   \n",
+        "2|  2-0   |  2-1   |  2-2   \n",
+    );
+
+    assert_eq!(table, expected);
+}
+
+#[test]
+fn padding_multiline() {
+    let data = create_vector::<3, 3>();
+    let table = Table::new(&data)
+        .with(Style::psql())
+        .with(Modify::new(Row(1..)).with(Padding::new(1, 1, 1, 1)))
         .to_string();
 
     let expected = concat!(
@@ -55,7 +101,7 @@ fn indent_multiline() {
 }
 
 #[test]
-fn indent_multiline_with_vertical_alignment() {
+fn padding_multiline_with_vertical_alignment() {
     let data = create_vector::<3, 3>();
     let table = Table::new(&data)
         .with(Style::psql())
@@ -64,7 +110,7 @@ fn indent_multiline_with_vertical_alignment() {
                 .with(Alignment::center_horizontal())
                 .with(Alignment::center_vertical()),
         )
-        .with(Modify::new(Row(1..)).with(Indent::new(1, 1, 1, 1)))
+        .with(Modify::new(Row(1..)).with(Padding::new(1, 1, 1, 1)))
         .to_string();
 
     let expected = concat!(
diff --git a/tests/span_test.rs b/tests/span_test.rs
index 3c2c4cb..eb1fdaf 100644
--- a/tests/span_test.rs
+++ b/tests/span_test.rs
@@ -1,5 +1,5 @@
 use crate::util::create_vector;
-use tabled::{Alignment, Cell, Column, Full, Indent, Modify, Span, Style, Table};
+use tabled::{Alignment, Cell, Column, Full, Modify, Padding, Span, Style, Table};
 
 mod util;
 
@@ -353,7 +353,7 @@ fn indent_works_in_spaned_columns() {
 
     let table = Table::new(&data)
         .with(Style::psql())
-        .with(Modify::new(Full).with(Indent::new(3, 0, 0, 0)))
+        .with(Modify::new(Full).with(Padding::new(3, 0, 0, 0)))
         .with(Modify::new(Full).with(Alignment::left()))
         .with(Modify::new(Cell(1, 1)).with(Span::column(3)))
         .with(Modify::new(Cell(3, 1)).with(Span::column(3)))
diff --git a/tests/style_test.rs b/tests/style_test.rs
index d8497a7..1f35213 100644
--- a/tests/style_test.rs
+++ b/tests/style_test.rs
@@ -1,6 +1,6 @@
 use crate::util::create_vector;
 use tabled::style::TopBorderText;
-use tabled::{Full, Indent, Modify, Style, Table, TableIteratorExt};
+use tabled::{Full, Modify, Padding, Style, Table, TableIteratorExt};
 
 mod util;
 
@@ -317,7 +317,7 @@ fn empty_style() {
     let data = create_vector::<3, 3>();
     let table = Table::new(&data)
         .with(Style::empty())
-        .with(Modify::new(Full).with(Indent::new(0, 0, 0, 0)))
+        .with(Modify::new(Full).with(Padding::new(0, 0, 0, 0)))
         .to_string();
 
     let expected = concat!(