mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-27 16:27:55 +01:00
* Remove NStack and replace ustring to string.
* Add unit test and improving some code.
* Adjust code and fix all unit tests errors.
* Add XML Document and move the Rune folder into the Text folder.
* Improve unit tests with byte array on DecodeRune and DecodeLastRune.
* Fix unit test.
* 😂Code review
* Reduce unit tests code.
* Change StringExtensions.Make to StringExtensions.ToString and added some more unit tests.
* Fix merge errors.
* Remove GetTextWidth and calls replaced with StringExtensions.GetColumns.
* Hack to use UseSystemConsole passed in the command line arguments.
* Revert "Hack to use UseSystemConsole passed in the command line arguments."
This reverts commit b74d11c786.
* Remove Application.UseSystemConsole from the config file.
* Fix errors related by removing UseSystemConsole from the config file.
* Fixes #2633. DecodeEscSeq throw an exception if cki is null.
* Fix an exception if SelectedItem is -1.
* Set SelectedItem to 0 and remove unnecessary ToString.
* Using a unique ToString method for Rune and other for byte.
* Fix a bug where a wider rune is added with only a width of 1.
* Force the SelectedGlyph is the one that was typed after jumpList is executed.
* Added more InlineData to RuneTests.
* Reducing significantly the code by using Theory attribute in the TextFormatterTests.
* Override PositionCursor to handle the CharMap cursor position.
* Fix merge errors.
* Minor tweaks to API docs
---------
Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
91 lines
2.7 KiB
C#
91 lines
2.7 KiB
C#
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);
|
|
}
|
|
|
|
}
|
|
}
|