Browse Source

Refactor test.

pull/7402/head
Jan-Peter Zurek 5 years ago
parent
commit
30f99c847a
  1. 7
      tests/Avalonia.Visuals.UnitTests/MatrixTests.cs

7
tests/Avalonia.Visuals.UnitTests/MatrixTests.cs

@ -12,11 +12,6 @@ namespace Avalonia.Visuals.UnitTests;
/// </summary> /// </summary>
public class MatrixTests public class MatrixTests
{ {
private double ReducePrecision(double input)
{
return Math.Truncate(input * 10000);
}
/// <summary> /// <summary>
/// Because Avalonia is working internally with doubles, but System.Numerics Vector and Matrix implementations /// Because Avalonia is working internally with doubles, but System.Numerics Vector and Matrix implementations
/// only make use of floats, we need to reduce precision, comparing them. It should be sufficient to compare /// only make use of floats, we need to reduce precision, comparing them. It should be sufficient to compare
@ -26,6 +21,8 @@ public class MatrixTests
/// <param name="actual">The actual transformed point</param> /// <param name="actual">The actual transformed point</param>
private void AssertCoordinatesEqualWithReducedPrecision(Vector2 expected, Point actual) private void AssertCoordinatesEqualWithReducedPrecision(Vector2 expected, Point actual)
{ {
double ReducePrecision(double input) => Math.Truncate(input * 10000);
var expectedX = ReducePrecision(expected.X); var expectedX = ReducePrecision(expected.X);
var expectedY = ReducePrecision(expected.Y); var expectedY = ReducePrecision(expected.Y);

Loading…
Cancel
Save