Merge branch 'peristent_property_manager' into CustomProperties
# Conflicts: # src/OpenMesh/Core/IO/writer/OMWriter.cc # src/Unittests/unittests_read_write_OM.cc
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include (ACGCommon)
|
||||
include (VCICommon)
|
||||
|
||||
include_directories (
|
||||
..
|
||||
@@ -17,7 +17,7 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
|
||||
enable_testing()
|
||||
|
||||
find_package(EIGEN3)
|
||||
find_package(Eigen3)
|
||||
|
||||
# Set correct include paths so that the compiler can find the headers
|
||||
include_directories(${GTEST_INCLUDE_DIRS} )
|
||||
@@ -27,9 +27,11 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
link_directories(${GTEST_LIBRARY_DIR} )
|
||||
|
||||
|
||||
if (EIGEN3_FOUND)
|
||||
if (TARGET Eigen3::Eigen)
|
||||
add_definitions( -DENABLE_EIGEN3_TEST )
|
||||
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||
link_libraries(Eigen3::Eigen)
|
||||
else()
|
||||
message(WARNING "Eigen3 not found! This will skip the Eigen3 Unittests. You can point cmake to Eigen3 by setting Eigen3_DIR to the cmake files of Eigen3")
|
||||
endif()
|
||||
|
||||
if ( CMAKE_GENERATOR MATCHES "^Visual Studio 11.*" )
|
||||
@@ -39,13 +41,13 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
# Create new target named unittests_hexmeshing
|
||||
FILE(GLOB UNITTEST_SRC *.cc)
|
||||
# Create unittest executable
|
||||
acg_add_executable(unittests ${UNITTEST_SRC})
|
||||
acg_add_executable(unittests_customvec ${UNITTEST_SRC})
|
||||
acg_add_executable(unittests_doublevec ${UNITTEST_SRC})
|
||||
vci_add_executable(unittests ${UNITTEST_SRC})
|
||||
vci_add_executable(unittests_customvec ${UNITTEST_SRC})
|
||||
vci_add_executable(unittests_doublevec ${UNITTEST_SRC})
|
||||
target_compile_definitions(unittests_customvec PRIVATE TEST_CUSTOM_TRAITS)
|
||||
target_compile_definitions(unittests_doublevec PRIVATE TEST_DOUBLE_TRAITS)
|
||||
|
||||
# For the unittest we don't want the install rpath as set by acg_add_executable
|
||||
# For the unittest we don't want the install rpath as set by vci_add_executable
|
||||
set_target_properties ( unittests PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
|
||||
set_target_properties ( unittests_customvec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
|
||||
set_target_properties ( unittests_doublevec PROPERTIES BUILD_WITH_INSTALL_RPATH 0 )
|
||||
@@ -120,9 +122,9 @@ if ( OPENMESH_BUILD_UNIT_TESTS )
|
||||
endforeach(TAR)
|
||||
endif()
|
||||
|
||||
acg_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
acg_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
acg_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
vci_copy_after_build(unittests ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
vci_copy_after_build(unittests_customvec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
vci_copy_after_build(unittests_doublevec ${CMAKE_CURRENT_SOURCE_DIR}/TestFiles ${CMAKE_BINARY_DIR}/Unittests/)
|
||||
|
||||
add_test(NAME AllTestsIn_OpenMesh_tests WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests")
|
||||
add_test(NAME AllTestsIn_OpenMesh_tests_with_minimal_vector WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Unittests" COMMAND "${CMAKE_BINARY_DIR}/Unittests/unittests_customvec")
|
||||
|
||||
@@ -1810,6 +1810,61 @@ TEST_F(OpenMeshReadWriteOM, PropertyFromString)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Try to write and load bool property
|
||||
*/
|
||||
TEST_F(OpenMeshReadWriteOM, WriteAndLoadBoolCheckSpaces) {
|
||||
|
||||
typedef OpenMesh::PolyMesh_ArrayKernelT<OpenMesh::DefaultTraitsDouble> DoublePolyMesh;
|
||||
|
||||
DoublePolyMesh mesh;
|
||||
|
||||
OpenMesh::VPropHandleT<bool> prop;
|
||||
mesh.add_property(prop,"VBProp");
|
||||
mesh.property(prop).set_persistent(true);
|
||||
|
||||
|
||||
// Generate a bool property which will be packed into a space character
|
||||
|
||||
std::vector<OpenMesh::VertexHandle> vertices;
|
||||
for (unsigned int i = 0; i < 8; ++i)
|
||||
{
|
||||
vertices.push_back(mesh.add_vertex(DoublePolyMesh::Point(0.0, 0.0, 0.0)));
|
||||
|
||||
if ( i == 5)
|
||||
mesh.property(prop,vertices[i]) = true;
|
||||
else
|
||||
mesh.property(prop,vertices[i]) = false;
|
||||
}
|
||||
|
||||
std::string file_name = "bool-space-test.om";
|
||||
|
||||
OpenMesh::IO::Options opt = OpenMesh::IO::Options::Default;
|
||||
ASSERT_TRUE(OpenMesh::IO::write_mesh(mesh, file_name, opt)) << "Could not write file " << file_name;
|
||||
|
||||
|
||||
// ====================================================
|
||||
// Now read it back
|
||||
// ====================================================
|
||||
|
||||
DoublePolyMesh mesh2;
|
||||
OpenMesh::VPropHandleT<bool> prop2;
|
||||
mesh2.add_property(prop2,"VBProp");
|
||||
mesh2.property(prop2).set_persistent(true);
|
||||
|
||||
ASSERT_TRUE(OpenMesh::IO::read_mesh(mesh2, file_name, opt)) << "Could not read file " << file_name;
|
||||
|
||||
// Check if the property is still ok
|
||||
for (unsigned int i = 0; i < 8; ++i)
|
||||
{
|
||||
if ( i == 5)
|
||||
EXPECT_TRUE( mesh.property(prop,mesh2.vertex_handle((i)) ) );
|
||||
else
|
||||
EXPECT_FALSE(mesh.property(prop,mesh2.vertex_handle((i))));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
OM_REGISTER_PROPERTY_TYPE(std::vector<float>)
|
||||
|
||||
Reference in New Issue
Block a user