ccb4f54550
* Sdk * Objects * Supressed IDE warnings via editor config instead of nowarn * Nullability and other warnings * using * Required keyword on lines and meshes * Fixed test project * fixed tests * Proxies * Fixed equality of Point * IEquatable * Fixed issue with serialization of detached lists * Added tests for jsonIgnore affecting id calc * removed comments * Fixed issue with fallback to double on large values * Fixed undocumented large number support
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using NUnit.Framework;
|
|
using Speckle.Objects.Geometry;
|
|
using Speckle.Sdk.Common;
|
|
|
|
namespace Speckle.Objects.Tests.Unit.Geometry;
|
|
|
|
[TestFixture, TestOf(typeof(Mesh))]
|
|
public class MeshTests
|
|
{
|
|
private static Mesh[] s_testCaseSource = { CreateBlenderStylePolygon(), CreateRhinoStylePolygon() };
|
|
|
|
[Test, TestCaseSource(nameof(s_testCaseSource))]
|
|
public void CanAlignVertices(Mesh inPolygon)
|
|
{
|
|
inPolygon.AlignVerticesWithTexCoordsByIndex();
|
|
|
|
Assert.That(inPolygon.VerticesCount, Is.EqualTo(inPolygon.TextureCoordinatesCount));
|
|
|
|
var expectedPolygon = CreateRhinoStylePolygon();
|
|
|
|
Assert.That(inPolygon.vertices, Is.EquivalentTo(expectedPolygon.vertices));
|
|
Assert.That(inPolygon.faces, Is.EquivalentTo(expectedPolygon.faces));
|
|
Assert.That(inPolygon.textureCoordinates, Is.EquivalentTo(expectedPolygon.textureCoordinates));
|
|
}
|
|
|
|
private static Mesh CreateRhinoStylePolygon()
|
|
{
|
|
return new Mesh
|
|
{
|
|
vertices = [0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0],
|
|
faces = [3, 0, 1, 2, 3, 3, 4, 5],
|
|
textureCoordinates = [0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
|
units = Units.Meters,
|
|
};
|
|
}
|
|
|
|
private static Mesh CreateBlenderStylePolygon()
|
|
{
|
|
return new Mesh
|
|
{
|
|
vertices = [0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0],
|
|
faces = [3, 0, 1, 2, 3, 0, 2, 3],
|
|
textureCoordinates = [0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
|
|
units = Units.Meters,
|
|
};
|
|
}
|
|
}
|