Commit fc6ad8eb authored by Jan Möbius's avatar Jan Möbius

Added basic smoother compile test

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@1263 fdac6126-5c0c-442c-9429-916003d36597
parent 61ad320d
#include <gtest/gtest.h>
#include <Unittests/unittests_common.hh>
#include <OpenMesh/Tools/Smoother/JacobiLaplaceSmootherT.hh>
namespace {
class OpenMeshSmoother_Poly : public OpenMeshBasePoly {
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...
}
// Member already defined in OpenMeshBase
//Mesh mesh_;
};
class OpenMeshSmoother_Triangle : public OpenMeshBase {
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...
}
// Member already defined in OpenMeshBase
//Mesh mesh_;
};
/*
* ====================================================================
* Define tests below
* ====================================================================
*/
/*
*/
TEST_F(OpenMeshSmoother_Triangle, Smoother_Poly_Laplace) {
mesh_.clear();
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off");
ASSERT_TRUE(ok);
// Check setup
EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices";
EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces";
// Initialize subdivider
OpenMesh::Smoother::JacobiLaplaceSmootherT<Mesh> smoother(mesh_);
// Just call function to instanciate template
smoother.set_absolute_local_error(0.5);
// Set an error
smoother.set_relative_local_error(0.1);
// Run algorithm with 5 steps
smoother.smooth(5);
EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices after smoothing?";
EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces after smoothing?";
}
/*
* ====================================================================
* Define tests below
* ====================================================================
*/
/*
*/
TEST_F(OpenMeshSmoother_Poly, Smoother_Triangle_Laplace) {
mesh_.clear();
bool ok = OpenMesh::IO::read_mesh(mesh_, "cube1.off");
ASSERT_TRUE(ok);
// Check setup
EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices";
EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces";
// Initialize subdivider
OpenMesh::Smoother::JacobiLaplaceSmootherT<PolyMesh> smoother(mesh_);;
// Just call function to instantiate template
smoother.set_absolute_local_error(0.5);
// Set an error
smoother.set_relative_local_error(0.1);
// Run algorithm with 5 steps
smoother.smooth(5);
EXPECT_EQ(7526u, mesh_.n_vertices() ) << "Wrong number of vertices after smoothing?";
EXPECT_EQ(15048u, mesh_.n_faces() ) << "Wrong number of faces after smoothing?";
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment