mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* tweaked version # for v1.0.0-beta.10 * tweaked version # for v1.0.0-beta.11 * Updated readme and revision history for 1.0 * excluding test results * Added support for viewing code coverage results with Fine Code Coverage * add generating CC to CI/CD * refactored unit test namespaces * more refactoring. commented out failing test. * Removed UnitTests and UICatalog from code coverage reporting * made Application and test more deterministic * disabled Multi_Thread_Toplevels because it is currently broken and don't understand why * updated threading test per @bdisp * testing cc badge stuff * another test * using coverlet.settings * trying copy * trying cp. duh. * trying mv. * wrong path * print * chaging badge output for testing * yaml error * fixed code coverage * moved dimtests to core
79 lines
1.5 KiB
C#
79 lines
1.5 KiB
C#
using System;
|
|
using Xunit;
|
|
|
|
namespace Terminal.Gui.Types {
|
|
public class PointTests {
|
|
[Fact]
|
|
public void Point_New ()
|
|
{
|
|
var point = new Point ();
|
|
Assert.True (point.IsEmpty);
|
|
|
|
point = new Point (new Size ());
|
|
Assert.True (point.IsEmpty);
|
|
|
|
point = new Point (1, 2);
|
|
Assert.False (point.IsEmpty);
|
|
|
|
point = new Point (-1, -2);
|
|
Assert.False (point.IsEmpty);
|
|
}
|
|
|
|
[Fact]
|
|
public void Point_SetsValue ()
|
|
{
|
|
var point = new Point () {
|
|
X = 0,
|
|
Y = 0
|
|
};
|
|
Assert.True (point.IsEmpty);
|
|
|
|
point = new Point () {
|
|
X = 1,
|
|
Y = 2
|
|
};
|
|
Assert.False (point.IsEmpty);
|
|
|
|
point = new Point () {
|
|
X = -1,
|
|
Y = -2
|
|
};
|
|
Assert.False (point.IsEmpty);
|
|
}
|
|
|
|
[Fact]
|
|
public void Point_Equals ()
|
|
{
|
|
var point1 = new Point ();
|
|
var point2 = new Point ();
|
|
Assert.Equal (point1, point2);
|
|
|
|
point1 = new Point (1, 2);
|
|
point2 = new Point (1, 2);
|
|
Assert.Equal (point1, point2);
|
|
|
|
point1 = new Point (1, 2);
|
|
point2 = new Point (0, 2);
|
|
Assert.NotEqual (point1, point2);
|
|
|
|
point1 = new Point (1, 2);
|
|
point2 = new Point (0, 3);
|
|
Assert.NotEqual (point1, point2);
|
|
}
|
|
|
|
[Fact]
|
|
public void Point_Size ()
|
|
{
|
|
var point = new Point (1, 2);
|
|
var size = (Size)point;
|
|
Assert.False (size.IsEmpty);
|
|
|
|
point = new Point (-1, 2);
|
|
Action action = () => size = (Size)point;
|
|
var ex = Assert.Throws<ArgumentException> (action);
|
|
Assert.Equal ("Either Width and Height must be greater or equal to 0.", ex.Message);
|
|
|
|
}
|
|
}
|
|
}
|