mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 00:07:58 +01:00
* POC * View.DrawFrame now uses LineCanvas * Fixes #2531. Toplevel should redraw only if it's needed. * Fix toplevel when mdi is enabled preventing clear the screen twice. * Massive LineCanvis updates * Fixes #2534. Bounds isn't updating when the Frame is changed. * Almost everything works! * Had to disable a few tests but all unit test now pass again * Deleted ConsoleDriver.DrawWindowFrame; hacked ProgressBar * Deleted ConsoleDriver.DrawWindowTitle; moved to Frame.DrawTitle * Renames BorderFrame to Border * Removed old commented code * Tweaked scenario * Added auto convert \r\n to Enviornment.NewLine in TestHelpers.AssertEqual * Fix merge errors. * Fix AssertEqual newlines to platform-specific. * Refactored frames drawing; view adds to its lineview, superview renders them * New titlebar style based on Border.Top size; fixed bugs * wzard bug --------- Co-authored-by: BDisp <bd.bdisp@gmail.com>
92 lines
2.8 KiB
C#
92 lines
2.8 KiB
C#
using NStack;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Terminal.Gui.DrawingTests {
|
|
public class StraightLineTests {
|
|
|
|
readonly ITestOutputHelper output;
|
|
|
|
public StraightLineTests (ITestOutputHelper output)
|
|
{
|
|
this.output = output;
|
|
}
|
|
|
|
[InlineData (Orientation.Horizontal, 0, 0, 0,
|
|
0, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, 0, 1,
|
|
0, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, 0, 2,
|
|
0, 0, 2, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, 0, 3,
|
|
0, 0, 3, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, 0, -1,
|
|
0, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, 0, -2,
|
|
-1, 0, 2, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, 0, -3,
|
|
-2, 0, 3, 1)]
|
|
|
|
[InlineData (Orientation.Horizontal, 1, 0, 0,
|
|
1, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 1, 0, 1,
|
|
1, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 1, 0, 2,
|
|
1, 0, 2, 1)]
|
|
[InlineData (Orientation.Horizontal, 1, 0, 3,
|
|
1, 0, 3, 1)]
|
|
[InlineData (Orientation.Horizontal, 1, 0, -1,
|
|
1, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 1, 0, -2,
|
|
0, 0, 2, 1)]
|
|
[InlineData (Orientation.Horizontal, 1, 0, -3,
|
|
-1, 0, 3, 1)]
|
|
|
|
[InlineData (Orientation.Horizontal, -1, 0, 0,
|
|
-1, 0, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, 0, -1, 1,
|
|
0, -1, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, -1, -1, 1,
|
|
-1, -1, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, -1, -1, 2,
|
|
-1, -1, 2, 1)]
|
|
[InlineData (Orientation.Horizontal, -10, -10, 10,
|
|
-10, -10, 10, 1)]
|
|
|
|
[InlineData (Orientation.Horizontal, 0, -1, -1,
|
|
0, -1, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, -1, -1, -1,
|
|
-1, -1, 1, 1)]
|
|
[InlineData (Orientation.Horizontal, -1, -1, -2,
|
|
-2, -1, 2, 1)]
|
|
[InlineData (Orientation.Horizontal, -10, -10, -10,
|
|
-19, -10, 10, 1)]
|
|
|
|
[InlineData (Orientation.Vertical, 0, 0, 0,
|
|
0, 0, 1, 1)]
|
|
[InlineData (Orientation.Vertical, 0, 0, 1,
|
|
0, 0, 1, 1)]
|
|
[InlineData (Orientation.Vertical, 0, 0, 2,
|
|
0, 0, 1, 2)]
|
|
[InlineData (Orientation.Vertical, 0, 0, 3,
|
|
0, 0, 1, 3)]
|
|
[InlineData (Orientation.Vertical, 0, 0, -1,
|
|
0, 0, 1, 1)]
|
|
[InlineData (Orientation.Vertical, 0, 0, -2,
|
|
0, -1, 1, 2)]
|
|
[InlineData (Orientation.Vertical, 0, 0, -3,
|
|
0, -2, 1, 3)]
|
|
[Theory, SetupFakeDriver]
|
|
public void Bounds (Orientation orientation, int x, int y, int length, int expectedX, int expectedY, int expectedWidth, int expectedHeight)
|
|
{
|
|
var sl = new LineCanvas.StraightLine (new Point (x, y), length, orientation, LineStyle.Single);
|
|
|
|
Assert.Equal (new Rect (expectedX, expectedY, expectedWidth, expectedHeight), sl.Bounds);
|
|
}
|
|
|
|
}
|
|
}
|