Repository: spectreconsole/spectre.console (csharp)

Issue:
Panel not respecting IOverflowable
Given this

```csharp
var markup = new Markup("[yellow]foo[/] [red]pneumonoultramicroscopicsilicovolcanoconiosis[/] [blue]bar qux[/]")
    .Overflow(Overflow.Ellipsis);
var panel = new Panel(markup)
{
    Width = 20,
};

// When
AnsiConsole.Write(panel);
```

I'm seeing

```
┌───────────────────────────────────────────────────────────┐
│ foo pneumonoultramicroscopicsilicovolcanoconiosis bar qux │
└───────────────────────────────────────────────────────────┘
```

Expected
```
┌──────────────────┐
│ foo              │
│ pneumonoultrami… │
│ bar qux          │
└──────────────────┘
```

I have a fix, just want to make sure this is an actual bug or designed behavior with panels

Pull request:
Open to other suggestions on how to resolve, but feels like this is right. While I was in there I added some other tests around Grid and Table with IOverflowable because I wasn't sure about their behavior either.

Resolves #1940

Patch:
diff --git a/src/Spectre.Console/Widgets/Panel.cs b/src/Spectre.Console/Widgets/Panel.cs
index 7a34d9592..7fd0620b8 100644
--- a/src/Spectre.Console/Widgets/Panel.cs
+++ b/src/Spectre.Console/Widgets/Panel.cs
@@ -83,12 +83,13 @@ private Measurement Measure(RenderOptions options, int maxWidth, IRenderable chi
         if (Width != null)
         {
             var width = Width.Value - edgeWidth;
-            if (width > childWidth.Max)
-            {
-                childWidth = new Measurement(
-                    childWidth.Min,
-                    width);
-            }
+
+            // If Width is specified, constrain or expand the measurement
+            // to exactly the specified width (clamped by maxWidth)
+            var constrainedWidth = Math.Min(width, maxWidth - edgeWidth);
+            childWidth = new Measurement(
+                Math.Min(childWidth.Min, constrainedWidth),
+                constrainedWidth);
         }
 
         return new Measurement(


Test patch:
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Markup_Overflow.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Markup_Overflow.Output.verified.txt
new file mode 100644
index 000000000..5cc383515
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Markup_Overflow.Output.verified.txt
@@ -0,0 +1,3 @@
+﻿foo                 Short text     
+pneumonoultramicr…                 
+bar                                
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Crop.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Crop.Output.verified.txt
new file mode 100644
index 000000000..f1f82d196
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Crop.Output.verified.txt
@@ -0,0 +1,3 @@
+﻿foo              Short text     
+pneumonoultrami                 
+bar                             
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Ellipsis.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Ellipsis.Output.verified.txt
new file mode 100644
index 000000000..127535510
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Ellipsis.Output.verified.txt
@@ -0,0 +1,3 @@
+﻿foo              Short text     
+pneumonoultram…                 
+bar                             
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Fold.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Fold.Output.verified.txt
new file mode 100644
index 000000000..b04f31311
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_Fold.Output.verified.txt
@@ -0,0 +1,5 @@
+﻿foo              Short text     
+pneumonoultrami                 
+croscopicsilico                 
+volcanoconiosis                 
+bar                             
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_With_NoWrap.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_With_NoWrap.Output.verified.txt
new file mode 100644
index 000000000..127535510
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Grid/Render_Cell_Overflow_With_NoWrap.Output.verified.txt
@@ -0,0 +1,3 @@
+﻿foo              Short text     
+pneumonoultram…                 
+bar                             
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Markup_Overflow_Ellipsis.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Markup_Overflow_Ellipsis.Output.verified.txt
new file mode 100644
index 000000000..b73f65d10
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Markup_Overflow_Ellipsis.Output.verified.txt
@@ -0,0 +1,5 @@
+﻿┌──────────────────┐
+│ foo              │
+│ pneumonoultrami… │
+│ bar qux          │
+└──────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Nested_Panel_With_Overflow.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Nested_Panel_With_Overflow.Output.verified.txt
new file mode 100644
index 000000000..3a6e9b27a
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Nested_Panel_With_Overflow.Output.verified.txt
@@ -0,0 +1,7 @@
+﻿┌───────────────────────┐
+│ ┌─────────────┐       │
+│ │ foo         │       │
+│ │ pneumonoult │       │
+│ │ bar qux     │       │
+│ └─────────────┘       │
+└───────────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Crop.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Crop.Output.verified.txt
new file mode 100644
index 000000000..079270650
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Crop.Output.verified.txt
@@ -0,0 +1,5 @@
+﻿┌──────────────────┐
+│ foo              │
+│ pneumonoultramic │
+│ bar qux          │
+└──────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Ellipsis.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Ellipsis.Output.verified.txt
new file mode 100644
index 000000000..b73f65d10
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Ellipsis.Output.verified.txt
@@ -0,0 +1,5 @@
+﻿┌──────────────────┐
+│ foo              │
+│ pneumonoultrami… │
+│ bar qux          │
+└──────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Fold.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Fold.Output.verified.txt
new file mode 100644
index 000000000..8f0c51fb0
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_Fold.Output.verified.txt
@@ -0,0 +1,7 @@
+﻿┌──────────────────┐
+│ foo              │
+│ pneumonoultramic │
+│ roscopicsilicovo │
+│ lcanoconiosis    │
+│ bar qux          │
+└──────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_With_Padding.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_With_Padding.Output.verified.txt
new file mode 100644
index 000000000..6f4fa4d96
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Panel/Render_Text_Overflow_With_Padding.Output.verified.txt
@@ -0,0 +1,5 @@
+﻿┌───────────────────────┐
+│  foo                  │
+│  pneumonoultramicro…  │
+│  bar qux              │
+└───────────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Markup_Overflow.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Markup_Overflow.Output.verified.txt
new file mode 100644
index 000000000..1fb1ad3f6
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Markup_Overflow.Output.verified.txt
@@ -0,0 +1,7 @@
+﻿┌────────────────────┬─────────────────┐
+│ Column1            │ Column2         │
+├────────────────────┼─────────────────┤
+│ foo                │ Short text      │
+│ pneumonoultramicr… │                 │
+│ bar                │                 │
+└────────────────────┴─────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Crop.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Crop.Output.verified.txt
new file mode 100644
index 000000000..d73678d37
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Crop.Output.verified.txt
@@ -0,0 +1,7 @@
+﻿┌─────────────────┬─────────────────┐
+│ Column1         │ Column2         │
+├─────────────────┼─────────────────┤
+│ foo             │ Short text      │
+│ pneumonoultrami │                 │
+│ bar             │                 │
+└─────────────────┴─────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Ellipsis.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Ellipsis.Output.verified.txt
new file mode 100644
index 000000000..69623fbbe
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Ellipsis.Output.verified.txt
@@ -0,0 +1,7 @@
+﻿┌─────────────────┬─────────────────┐
+│ Column1         │ Column2         │
+├─────────────────┼─────────────────┤
+│ foo             │ Short text      │
+│ pneumonoultram… │                 │
+│ bar             │                 │
+└─────────────────┴─────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Fold.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Fold.Output.verified.txt
new file mode 100644
index 000000000..a20cf4889
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Fold.Output.verified.txt
@@ -0,0 +1,9 @@
+﻿┌─────────────────┬─────────────────┐
+│ Column1         │ Column2         │
+├─────────────────┼─────────────────┤
+│ foo             │ Short text      │
+│ pneumonoultrami │                 │
+│ croscopicsilico │                 │
+│ volcanoconiosis │                 │
+│ bar             │                 │
+└─────────────────┴─────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Multiple_Rows.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Multiple_Rows.Output.verified.txt
new file mode 100644
index 000000000..65711330e
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_Multiple_Rows.Output.verified.txt
@@ -0,0 +1,11 @@
+﻿┌─────────────────┬─────────────────┐
+│ Column1         │ Column2         │
+├─────────────────┼─────────────────┤
+│ foo             │ First row       │
+│ pneumonoultrami │                 │
+│ bar             │ Second row      │
+│ supercalifragi… │                 │
+│ qux             │ Third row       │
+│ antidisestablis │                 │
+│ hmentarianism   │                 │
+└─────────────────┴─────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_With_NoWrap.Output.verified.txt b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_With_NoWrap.Output.verified.txt
new file mode 100644
index 000000000..69623fbbe
--- /dev/null
+++ b/src/Tests/Spectre.Console.Tests/Expectations/Widgets/Table/Render_Cell_Overflow_With_NoWrap.Output.verified.txt
@@ -0,0 +1,7 @@
+﻿┌─────────────────┬─────────────────┐
+│ Column1         │ Column2         │
+├─────────────────┼─────────────────┤
+│ foo             │ Short text      │
+│ pneumonoultram… │                 │
+│ bar             │                 │
+└─────────────────┴─────────────────┘
diff --git a/src/Tests/Spectre.Console.Tests/Unit/Widgets/GridTests.cs b/src/Tests/Spectre.Console.Tests/Unit/Widgets/GridTests.cs
index 4644790c8..3a25db3f7 100644
--- a/src/Tests/Spectre.Console.Tests/Unit/Widgets/GridTests.cs
+++ b/src/Tests/Spectre.Console.Tests/Unit/Widgets/GridTests.cs
@@ -192,4 +192,104 @@ public Task Should_Render_Explicit_Grid_Column_Padding_Correctly()
         // Then
         return Verifier.Verify(console.Output);
     }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Crop")]
+    public Task Should_Respect_Cell_Content_Overflow_Crop()
+    {
+        // Given
+        var console = new TestConsole().Width(40);
+        var grid = new Grid();
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Crop),
+            new Text("Short text"));
+
+        // When
+        console.Write(grid);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Ellipsis")]
+    public Task Should_Respect_Cell_Content_Overflow_Ellipsis()
+    {
+        // Given
+        var console = new TestConsole().Width(40);
+        var grid = new Grid();
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Ellipsis),
+            new Text("Short text"));
+
+        // When
+        console.Write(grid);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Fold")]
+    public Task Should_Respect_Cell_Content_Overflow_Fold()
+    {
+        // Given
+        var console = new TestConsole().Width(40);
+        var grid = new Grid();
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Fold),
+            new Text("Short text"));
+
+        // When
+        console.Write(grid);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Markup_Overflow")]
+    public Task Should_Respect_Markup_Content_Overflow_In_Cell()
+    {
+        // Given
+        var console = new TestConsole().Width(40);
+        var grid = new Grid();
+        grid.AddColumn(new GridColumn { Width = 18 });
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddRow(
+            new Markup("[yellow]foo[/] [red]pneumonoultramicroscopicsilicovolcanoconiosis[/] [blue]bar[/]").Overflow(Overflow.Ellipsis),
+            new Markup("[green]Short text[/]"));
+
+        // When
+        console.Write(grid);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_With_NoWrap")]
+    public Task Should_Respect_Cell_Content_Overflow_With_NoWrap_Column()
+    {
+        // Given
+        var console = new TestConsole().Width(40);
+        var grid = new Grid();
+        grid.AddColumn(new GridColumn { Width = 15, NoWrap = true });
+        grid.AddColumn(new GridColumn { Width = 15 });
+        grid.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Ellipsis),
+            new Text("Short text"));
+
+        // When
+        console.Write(grid);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
 }
diff --git a/src/Tests/Spectre.Console.Tests/Unit/Widgets/PanelTests.cs b/src/Tests/Spectre.Console.Tests/Unit/Widgets/PanelTests.cs
index 3d042fae4..e698aecb2 100644
--- a/src/Tests/Spectre.Console.Tests/Unit/Widgets/PanelTests.cs
+++ b/src/Tests/Spectre.Console.Tests/Unit/Widgets/PanelTests.cs
@@ -366,4 +366,129 @@ public Task Should_Wrap_Table_With_CJK_Tables_In_Panel_Correctly()
         // Then
         return Verifier.Verify(console.Output);
     }
+
+    [Fact]
+    [Expectation("Render_Text_Overflow_Crop")]
+    public Task Should_Respect_Text_Overflow_Crop_In_Panel()
+    {
+        // Given
+        var console = new TestConsole();
+        var text = new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar qux")
+            .Overflow(Overflow.Crop);
+        var panel = new Panel(text)
+        {
+            Width = 20,
+        };
+
+        // When
+        console.Write(panel);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Text_Overflow_Ellipsis")]
+    public Task Should_Respect_Text_Overflow_Ellipsis_In_Panel()
+    {
+        // Given
+        var console = new TestConsole();
+        var text = new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar qux")
+            .Overflow(Overflow.Ellipsis);
+        var panel = new Panel(text)
+        {
+            Width = 20,
+        };
+
+        // When
+        console.Write(panel);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Text_Overflow_Fold")]
+    public Task Should_Respect_Text_Overflow_Fold_In_Panel()
+    {
+        // Given
+        var console = new TestConsole();
+        var text = new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar qux")
+            .Overflow(Overflow.Fold);
+        var panel = new Panel(text)
+        {
+            Width = 20,
+        };
+
+        // When
+        console.Write(panel);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Markup_Overflow_Ellipsis")]
+    public Task Should_Respect_Markup_Overflow_Ellipsis_In_Panel()
+    {
+        // Given
+        var console = new TestConsole();
+        var markup = new Markup("[yellow]foo[/] [red]pneumonoultramicroscopicsilicovolcanoconiosis[/] [blue]bar qux[/]")
+            .Overflow(Overflow.Ellipsis);
+        var panel = new Panel(markup)
+        {
+            Width = 20,
+        };
+
+        // When
+        console.Write(panel);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Text_Overflow_With_Padding")]
+    public Task Should_Respect_Text_Overflow_In_Panel_With_Padding()
+    {
+        // Given
+        var console = new TestConsole();
+        var text = new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar qux")
+            .Overflow(Overflow.Ellipsis);
+        var panel = new Panel(text)
+        {
+            Width = 25,
+            Padding = new Padding(2, 0, 2, 0),
+        };
+
+        // When
+        console.Write(panel);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Nested_Panel_With_Overflow")]
+    public Task Should_Respect_Text_Overflow_In_Nested_Panel()
+    {
+        // Given
+        var console = new TestConsole();
+        var text = new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar qux")
+            .Overflow(Overflow.Crop);
+        var innerPanel = new Panel(text)
+        {
+            Width = 15,
+        };
+        var outerPanel = new Panel(innerPanel)
+        {
+            Width = 25,
+        };
+
+        // When
+        console.Write(outerPanel);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
 }
diff --git a/src/Tests/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs b/src/Tests/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
index 18379bdcd..4c26b7aa0 100644
--- a/src/Tests/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
+++ b/src/Tests/Spectre.Console.Tests/Unit/Widgets/Table/TableTests.cs
@@ -631,4 +631,130 @@ public Task Should_Render_Empty_Column_Correctly()
         // Then
         return Verifier.Verify(console.Output);
     }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Crop")]
+    public Task Should_Respect_Cell_Content_Overflow_Crop()
+    {
+        // Given
+        var console = new TestConsole();
+        var table = new Table();
+        table.AddColumn(new TableColumn("Column1").Width(15));
+        table.AddColumn(new TableColumn("Column2").Width(15));
+        table.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Crop),
+            new Text("Short text"));
+
+        // When
+        console.Write(table);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Ellipsis")]
+    public Task Should_Respect_Cell_Content_Overflow_Ellipsis()
+    {
+        // Given
+        var console = new TestConsole();
+        var table = new Table();
+        table.AddColumn(new TableColumn("Column1").Width(15));
+        table.AddColumn(new TableColumn("Column2").Width(15));
+        table.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Ellipsis),
+            new Text("Short text"));
+
+        // When
+        console.Write(table);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Fold")]
+    public Task Should_Respect_Cell_Content_Overflow_Fold()
+    {
+        // Given
+        var console = new TestConsole();
+        var table = new Table();
+        table.AddColumn(new TableColumn("Column1").Width(15));
+        table.AddColumn(new TableColumn("Column2").Width(15));
+        table.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Fold),
+            new Text("Short text"));
+
+        // When
+        console.Write(table);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Markup_Overflow")]
+    public Task Should_Respect_Markup_Content_Overflow_In_Cell()
+    {
+        // Given
+        var console = new TestConsole();
+        var table = new Table();
+        table.AddColumn(new TableColumn("Column1").Width(18));
+        table.AddColumn(new TableColumn("Column2").Width(15));
+        table.AddRow(
+            new Markup("[yellow]foo[/] [red]pneumonoultramicroscopicsilicovolcanoconiosis[/] [blue]bar[/]").Overflow(Overflow.Ellipsis),
+            new Markup("[green]Short text[/]"));
+
+        // When
+        console.Write(table);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_Multiple_Rows")]
+    public Task Should_Respect_Cell_Content_Overflow_In_Multiple_Rows()
+    {
+        // Given
+        var console = new TestConsole();
+        var table = new Table();
+        table.AddColumn(new TableColumn("Column1").Width(15));
+        table.AddColumn(new TableColumn("Column2").Width(15));
+        table.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis").Overflow(Overflow.Crop),
+            new Text("First row"));
+        table.AddRow(
+            new Text("bar supercalifragilisticexpialidocious").Overflow(Overflow.Ellipsis),
+            new Text("Second row"));
+        table.AddRow(
+            new Text("qux antidisestablishmentarianism").Overflow(Overflow.Fold),
+            new Text("Third row"));
+
+        // When
+        console.Write(table);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
+
+    [Fact]
+    [Expectation("Render_Cell_Overflow_With_NoWrap")]
+    public Task Should_Respect_Cell_Content_Overflow_With_NoWrap_Column()
+    {
+        // Given
+        var console = new TestConsole();
+        var table = new Table();
+        table.AddColumn(new TableColumn("Column1").Width(15).NoWrap());
+        table.AddColumn(new TableColumn("Column2").Width(15));
+        table.AddRow(
+            new Text("foo pneumonoultramicroscopicsilicovolcanoconiosis bar").Overflow(Overflow.Ellipsis),
+            new Text("Short text"));
+
+        // When
+        console.Write(table);
+
+        // Then
+        return Verifier.Verify(console.Output);
+    }
 }