Files
speckle-sharp-sdk/tests/Speckle.Objects.Tests.Unit/Geometry/MeshTests.cs
T
Adam Hathcock 6f5f044095 Adam/cxpla 6 kill remaining kit code in core (#59)
* compiles with relevant deletions

* Test fixes

* fix type loading

* type load for tests

* speckle objects renamespace

* rename Core to Sdk

* Fix test references

* tests renaming

* rename logging

* fmt

* start of adding an attribute to all base types

* convert all types and do basic test

* Fix most tests

* fix more tests

* fmt

* Build fix

* add changes and more tests

* Fix tests

* Fix integration tests
2024-08-08 10:52:19 +01:00

45 lines
1.3 KiB
C#

using NUnit.Framework;
using Speckle.Objects.Geometry;
namespace 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 }
};
}
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 }
};
}
}