diff --git a/src/OpenMesh/Core/Utils/PropertyManager.hh b/src/OpenMesh/Core/Utils/PropertyManager.hh index cc462fd5..1ec4a6af 100644 --- a/src/OpenMesh/Core/Utils/PropertyManager.hh +++ b/src/OpenMesh/Core/Utils/PropertyManager.hh @@ -140,7 +140,7 @@ class PropertyManager { * @see PropertyManager::getOrMakeProperty, PropertyManager::getProperty, * PropertyManager::makeTemporaryProperty */ - OM_DEPRECATED("Use the constructor without parameter 'existing' instead. Check for existance with hasProperty") + OM_DEPRECATED("Use the constructor without parameter 'existing' instead. Check for existance with hasProperty") // As long as this overload exists, initial value must be first parameter due to ambiguity for properties of type bool PropertyManager(PolyConnectivity& mesh, const char *propname, bool existing) : mesh_(mesh), retain_(existing), name_(propname) { if (existing) { if (!mesh_.get_property_handle(prop_, propname)) { @@ -171,13 +171,13 @@ class PropertyManager { * Constructor. * * Asks for a property with name propname and creates one if none exists. Lifetime is not managed. - * If the property is created it is initialized with \p initial_value * + * @param initial_value If the proeprty is newly created, it will be initialized with intial_value. + * If the property already existed, nothing is changes. * @param mesh The mesh on which to create the property. - * @param initial_value * @param propname The name of the property. */ - PropertyManager(PolyConnectivity& mesh, const char *propname, const Value& intial_value) : mesh_(mesh), retain_(true), name_(propname) { + PropertyManager(const Value& intial_value, PolyConnectivity& mesh, const char *propname) : mesh_(mesh), retain_(true), name_(propname) { if (!mesh_.get_property_handle(prop_, propname)) { mesh_.add_property(prop_, propname); set_range(mesh_.all_elements(), intial_value); @@ -199,11 +199,11 @@ class PropertyManager { * Constructor. * * Create an anonymous property. Lifetime is managed. - * If the property is created it is initialized with \p initial_value * + * @param initial_value The property will be initialized with intial_value. * @param mesh The mesh on which to create the property. */ - PropertyManager(PolyConnectivity& mesh, const Value& intial_value) : mesh_(mesh), retain_(false), name_("") { + PropertyManager(const Value& intial_value, PolyConnectivity& mesh) : mesh_(mesh), retain_(false), name_("") { mesh_.add_property(prop_, name_); set_range(mesh_.all_elements(), intial_value); } diff --git a/src/Unittests/unittests_propertymanager.cc b/src/Unittests/unittests_propertymanager.cc index 8263fcd5..ea7e82f7 100644 --- a/src/Unittests/unittests_propertymanager.cc +++ b/src/Unittests/unittests_propertymanager.cc @@ -266,8 +266,8 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { // unnamed to unnamed { - auto prop1 = OpenMesh::VProp(mesh_, 3); - auto prop2 = OpenMesh::VProp(mesh_, 0); + auto prop1 = OpenMesh::VProp(3, mesh_); + auto prop2 = OpenMesh::VProp(0, mesh_); EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], 3) << "Property not initialized correctly"; EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; @@ -292,7 +292,7 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { // unnamed to named { auto prop1 = OpenMesh::VProp(mesh_); - auto prop2 = OpenMesh::VProp(mesh_, "ids", 0); + auto prop2 = OpenMesh::VProp(0, mesh_, "ids"); EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; for (auto vh : mesh_.vertices()) @@ -385,6 +385,16 @@ TEST_F(OpenMeshPropertyManager, property_copying_same_mesh) { auto prop3 = OpenMesh::VProp(mesh_, "ids5"); EXPECT_EQ(prop3[OpenMesh::VertexHandle(0)], 42) << "Property not copied correctly"; } + + { + auto prop1 = OpenMesh::MProp(mesh_); + *prop1 = 43; + auto prop2 = prop1; + + prop2 = prop1; + + prop2 = std::move(prop1); + } } @@ -530,8 +540,8 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { // unnamed to unnamed { - auto prop1 = OpenMesh::VProp(mesh_, 3); - auto prop2 = OpenMesh::VProp(copy, 0); + auto prop1 = OpenMesh::VProp(3, mesh_); + auto prop2 = OpenMesh::VProp(0, copy); EXPECT_EQ(prop1[OpenMesh::VertexHandle(0)], 3) << "Property not initialized correctly"; EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; @@ -557,7 +567,7 @@ TEST_F(OpenMeshPropertyManager, property_copying_different_mesh) { // unnamed to named { auto prop1 = OpenMesh::VProp(mesh_); - auto prop2 = OpenMesh::VProp(copy, "ids", 0); + auto prop2 = OpenMesh::VProp(0, copy, "ids"); EXPECT_EQ(prop2[OpenMesh::VertexHandle(0)], 0) << "Property not initialized correctly"; for (auto vh : mesh_.vertices()) @@ -762,6 +772,9 @@ TEST_F(OpenMeshPropertyManager, property_moving_different_mesh) { auto prop1 = OpenMesh::VProp(mesh_, "ids5"); auto prop2 = OpenMesh::VProp(copy, "ids5"); + auto prop6 = OpenMesh::Prop(mesh_); + prop6 = prop1; + for (auto vh : mesh_.vertices()) prop1[vh] = vh.idx()*2-13;