From 6e71f1bd57bb521035860f2501dfacd6b19b7c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 23 Nov 2015 10:57:30 +0100 Subject: [PATCH] Added Unittest for vec2i and trimesh --- src/Unittests/unittests_trimesh_vec2i.cc | 84 ++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 src/Unittests/unittests_trimesh_vec2i.cc diff --git a/src/Unittests/unittests_trimesh_vec2i.cc b/src/Unittests/unittests_trimesh_vec2i.cc new file mode 100644 index 00000000..66533ce3 --- /dev/null +++ b/src/Unittests/unittests_trimesh_vec2i.cc @@ -0,0 +1,84 @@ +#include +#include + +#include + +struct CustomTraitsVec2i : OpenMesh::DefaultTraits +{ + typedef OpenMesh::Vec2i Point; +}; + + +typedef OpenMesh::TriMesh_ArrayKernelT TriMeshVec2i; + + +/* + * OpenMesh Triangular with Vec2i + */ + +class OpenMeshBaseTriVec2i : public testing::Test { + + protected: + + // This function is called before each test is run + virtual void SetUp() { + + // Do some initial stuff with the member data here... + } + + // This function is called after all tests are through + virtual void TearDown() { + + // Do some final stuff with the member data here... + } + + // This member will be accessible in all tests + TriMeshVec2i mesh_; +}; + + +namespace { + +/* + * ==================================================================== + * Define tests below + * ==================================================================== + */ + +/* + * Checking for feature edges based on angle + */ +TEST_F(OpenMeshBaseTriVec2i, Instance_Vec2i_Mesh) { + + mesh_.clear(); + + // Add some vertices + TriMeshVec2i::VertexHandle vhandle[4]; + + vhandle[0] = mesh_.add_vertex(TriMeshVec2i::Point(0, 0)); + vhandle[1] = mesh_.add_vertex(TriMeshVec2i::Point(0, 1)); + vhandle[2] = mesh_.add_vertex(TriMeshVec2i::Point(1, 1)); + + // Add face + std::vector face_vhandles; + + face_vhandles.push_back(vhandle[0]); + face_vhandles.push_back(vhandle[1]); + face_vhandles.push_back(vhandle[2]); + mesh_.add_face(face_vhandles); + + // =============================================== + // Setup complete + // =============================================== + + // Check one Request only vertex normals + // Face normals are required for vertex and halfedge normals, so + // that prevent access to non existing properties are in place + + mesh_.request_vertex_normals(); + mesh_.request_halfedge_normals(); + mesh_.request_face_normals(); + +} + +}