Merge pull request #8518 from sloriot/PS3-fix_copy

Point_set_3: copy properties correctly
This commit is contained in:
Sébastien Loriot 2024-10-14 09:42:10 +02:00
commit bed76bd094
2 changed files with 25 additions and 3 deletions

View File

@ -245,8 +245,8 @@ public:
m_base = ps.m_base;
m_indices = this->property_map<Index> ("index").value();
m_points = this->property_map<Point> ("point").value();
m_normals = this->property_map<Vector> ("normal").value();
m_nb_removed = ps.m_nb_removed;
copy_properties(ps);
return *this;
}
@ -257,7 +257,7 @@ public:
m_base = ps.m_base;
m_indices = this->property_map<Index> ("index").value();
m_points = this->property_map<Point> ("point").value();
m_normals = this->property_map<Vector> ("normal").value();
copy_properties(ps);
m_nb_removed = ps.m_nb_removed;
}
/// \endcond

View File

@ -28,6 +28,26 @@ void test (bool expr, const char* msg)
++ nb_success;
}
bool copy_and_assignement()
{
Point_set ps1;
ps1.add_property_map("prop", int(3));
ps1.add_normal_map();
Point_set ps2 = ps1;
if (!ps2.has_property_map<int>("prop")) return false;
if (!ps2.has_normal_map()) return false;
Point_set ps3(ps1);
if (!ps3.has_property_map<int>("prop")) return false;
if (!ps3.has_normal_map()) return false;
ps1=Point_set();
Point_set ps4 = ps1;
if (ps4.has_property_map<int>("prop")) return false;
if (ps4.has_normal_map()) return false;
Point_set ps5(ps1);
if (ps5.has_property_map<int>("prop")) return false;
if (ps5.has_normal_map()) return false;
return true;
}
int main (int, char**)
{
@ -130,7 +150,9 @@ int main (int, char**)
std::unordered_set<Point_set::Index> std_hash;
boost::unordered_set<Point_set::Index> boost_hash;
test(copy_and_assignement(), "copy and assignement");
std::cerr << nb_success << "/" << nb_test << " test(s) succeeded." << std::endl;
return EXIT_SUCCESS;
return nb_success==nb_test ? EXIT_SUCCESS : EXIT_FAILURE;
}