mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Add Style.ShowHeaders to TableView (#2514)
* Add Style.HideHeaders to TableView * Revisions to TableView HideHeaders from review Also add to UICatalog TableEditor Scenario * Allow ShowHorizontalHeaderUnderline to draw top border even when HideHeaders is enabled; AlwaysShowHeader will keep it there on scroll * Add Unit Tests for TableView.Style.HideHeaders * Rename HideHeaders to ShowHeaders and simplify logic --------- Co-authored-by: tznind <tznind@dundee.ac.uk>
This commit is contained in:
@@ -444,6 +444,86 @@ namespace Terminal.Gui.ViewsTests {
|
||||
Assert.Equal (new Point (8, 3), selected [5]);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void TableView_ShowHeadersFalse_AndNoHeaderLines ()
|
||||
{
|
||||
var tv = GetABCDEFTableView (out _);
|
||||
tv.Bounds = new Rect (0, 0, 5, 5);
|
||||
|
||||
tv.Style.ShowHeaders = false;
|
||||
tv.Style.ShowHorizontalHeaderOverline = false;
|
||||
tv.Style.ShowHorizontalHeaderUnderline = false;
|
||||
|
||||
tv.Redraw (tv.Bounds);
|
||||
|
||||
string expected = @"
|
||||
│1│2│
|
||||
";
|
||||
TestHelpers.AssertDriverContentsAre (expected, output);
|
||||
}
|
||||
[Fact, AutoInitShutdown]
|
||||
public void TableView_ShowHeadersFalse_OverlineTrue ()
|
||||
{
|
||||
var tv = GetABCDEFTableView (out _);
|
||||
tv.Bounds = new Rect (0, 0, 5, 5);
|
||||
|
||||
tv.Style.ShowHeaders = false;
|
||||
tv.Style.ShowHorizontalHeaderOverline = true;
|
||||
tv.Style.ShowHorizontalHeaderUnderline = false;
|
||||
|
||||
tv.Redraw (tv.Bounds);
|
||||
|
||||
string expected = @"
|
||||
┌─┬─┐
|
||||
│1│2│
|
||||
";
|
||||
TestHelpers.AssertDriverContentsAre (expected, output);
|
||||
}
|
||||
[Fact, AutoInitShutdown]
|
||||
public void TableView_ShowHeadersFalse_UnderlineTrue ()
|
||||
{
|
||||
var tv = GetABCDEFTableView (out _);
|
||||
tv.Bounds = new Rect (0, 0, 5, 5);
|
||||
|
||||
tv.Style.ShowHeaders = false;
|
||||
tv.Style.ShowHorizontalHeaderOverline = false;
|
||||
tv.Style.ShowHorizontalHeaderUnderline = true;
|
||||
// Horizontal scrolling option is part of the underline
|
||||
tv.Style.ShowHorizontalScrollIndicators = true;
|
||||
|
||||
|
||||
tv.Redraw (tv.Bounds);
|
||||
|
||||
string expected = @"
|
||||
├─┼─►
|
||||
│1│2│
|
||||
";
|
||||
TestHelpers.AssertDriverContentsAre (expected, output);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void TableView_ShowHeadersFalse_AllLines ()
|
||||
{
|
||||
var tv = GetABCDEFTableView (out _);
|
||||
tv.Bounds = new Rect (0, 0, 5, 5);
|
||||
|
||||
tv.Style.ShowHeaders = false;
|
||||
tv.Style.ShowHorizontalHeaderOverline = true;
|
||||
tv.Style.ShowHorizontalHeaderUnderline = true;
|
||||
// Horizontal scrolling option is part of the underline
|
||||
tv.Style.ShowHorizontalScrollIndicators = true;
|
||||
|
||||
|
||||
tv.Redraw (tv.Bounds);
|
||||
|
||||
string expected = @"
|
||||
┌─┬─┐
|
||||
├─┼─►
|
||||
│1│2│
|
||||
";
|
||||
TestHelpers.AssertDriverContentsAre (expected, output);
|
||||
}
|
||||
|
||||
[Fact, AutoInitShutdown]
|
||||
public void TableView_ExpandLastColumn_True ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user