mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Fixes #2981. LegendAnnotation: 'Frame.DrawFrame(Rect, bool)' is obsolete: 'This method is obsolete in v2. Use use LineCanvas or Frame (#2982)
* Fixes #2981. LegendAnnotation: 'Frame.DrawFrame(Rect, bool)' is obsolete: 'This method is obsolete in v2. Use use LineCanvas or Frame * Fixes #2983. View need a alternative DrawFrame for the v2. * Use new DrawFrame method. * Add a view for the legend annotations. * Prefix with underscore. * Change LegendAnnotation class to derived from View. * The Bounds isn't needed, it's enough to set the Pos/Dim. * Fix unit test to differentiate Bounds from Frame. * Add DrawIncompleteFrame method and unit tests. * Add more unit tests to LineCanvas. * Fix newline conflict errors. * Add DrawIncompleteFrame method and unit tests. * Add more unit tests to LineCanvas. * Fix newline conflict errors. * I will never rely on zero-location-based unit test again. * Fix TestTreeViewColor unit test fail. * Add BorderStyle option to the menu. * Revert "I will never rely on zero-location-based unit test again." This reverts commit62adf6f285. * Revert "Fix newline conflict errors." This reverts commit4acf72612d. * Revert "Add more unit tests to LineCanvas." This reverts commit66bc6f514e. * Revert "Add DrawIncompleteFrame method and unit tests." This reverts commit680ba264e1. * Revert "Fixes #2983. View need a alternative DrawFrame for the v2." This reverts commitdade9fd767. * Removed resharper settings from editorconfig * Rename to OnDrawAdornments. * Added diagnostics as a double-check. Code cleanup. API doc improvements. * Fix typo for retest again. * Increase the graph size. --------- Co-authored-by: Tig <tig@users.noreply.github.com> Co-authored-by: Tig Kindel <tig@kindel.com>
This commit is contained in:
@@ -1252,6 +1252,26 @@ namespace Terminal.Gui.ViewsTests {
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructors_Defaults ()
|
||||
{
|
||||
var legend = new LegendAnnotation ();
|
||||
Assert.Equal (Rect.Empty, legend.Bounds);
|
||||
Assert.Equal (Rect.Empty, legend.Frame);
|
||||
Assert.Equal (LineStyle.Single, legend.BorderStyle);
|
||||
Assert.False (legend.BeforeSeries);
|
||||
|
||||
var bounds = new Rect (1, 2, 10, 3);
|
||||
legend = new LegendAnnotation (bounds);
|
||||
Assert.Equal (new Rect (0, 0, 8, 1), legend.Bounds);
|
||||
Assert.Equal (bounds, legend.Frame);
|
||||
Assert.Equal (LineStyle.Single, legend.BorderStyle);
|
||||
Assert.False (legend.BeforeSeries);
|
||||
legend.BorderStyle = LineStyle.None;
|
||||
Assert.Equal (new Rect (0, 0, 10, 3), legend.Bounds);
|
||||
Assert.Equal (bounds, legend.Frame);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LegendNormalUsage_WithBorder ()
|
||||
{
|
||||
@@ -1286,7 +1306,7 @@ namespace Terminal.Gui.ViewsTests {
|
||||
legend.AddEntry (new GraphCellToRender ((Rune)'B'), "?"); // this will exercise pad
|
||||
legend.AddEntry (new GraphCellToRender ((Rune)'C'), "Cat");
|
||||
legend.AddEntry (new GraphCellToRender ((Rune)'H'), "Hattter"); // not enough space for this oen
|
||||
legend.Border = false;
|
||||
legend.BorderStyle = LineStyle.None;
|
||||
|
||||
gv.Annotations.Add (legend);
|
||||
gv.Draw ();
|
||||
|
||||
Reference in New Issue
Block a user