diff --git a/tests/integration_tests/pybinds_tests/test_pybind_units.py b/tests/integration_tests/pybinds_tests/test_pybind_units.py index 4b518d02..f906c561 100644 --- a/tests/integration_tests/pybinds_tests/test_pybind_units.py +++ b/tests/integration_tests/pybinds_tests/test_pybind_units.py @@ -75,6 +75,18 @@ def test_DFPointCloud_properties(create_DFPointCloudSampleRoof): assert pc.has_colors() == False, "has_colors() should return False" assert pc.has_normals() == False, "has_normals() should return False" +def test_DFPointCloud_add_points(): + point_pc_1 = [(0, 0, 0)] + point_pc_2 = [(1, 1, 1)] + normal_pc_1 = [(0, 0, 1)] + normal_pc_2 = [(1, 0, 0)] + color_pc_1 = [(255, 0, 0)] + color_pc_2 = [(0, 255, 0)] + pc_1 = dfb.dfb_geometry.DFPointCloud(point_pc_1, normal_pc_1, color_pc_1) + pc_2 = dfb.dfb_geometry.DFPointCloud(point_pc_2, normal_pc_2, color_pc_2) + pc_1.add_points(pc_2) + assert pc_1.points.__len__() == 2, "two pointclouds of 1 pt combined into one should have 2 pts" + def test_DFPointCloud_apply_color(create_DFPointCloudSampleRoof): pc = create_DFPointCloudSampleRoof pc.apply_color(255, 0, 0) diff --git a/tests/unit_tests/DFPointCloudTest.cc b/tests/unit_tests/DFPointCloudTest.cc index d33cd2e9..d2ea167b 100644 --- a/tests/unit_tests/DFPointCloudTest.cc +++ b/tests/unit_tests/DFPointCloudTest.cc @@ -117,6 +117,13 @@ TEST_F(DFPointCloudTestFixture, ComputeDistance) { EXPECT_EQ(distances.size(), 7379); } +TEST_F(DFPointCloudTestFixture, AddPoints) { + std::shared_ptr dfPointCloud2 = std::make_shared(); + dfPointCloud2->LoadFromPLY(diffCheck::io::GetRoofQuarterPlyPath()); + dfPointCloud.AddPoints(*dfPointCloud2); + EXPECT_EQ(dfPointCloud.GetNumPoints(), 7379 * 2); +} + TEST_F(DFPointCloudTestFixture, ComputeAABB) { std::vector bbox = dfPointCloud.ComputeBoundingBox(); EXPECT_EQ(bbox.size(), 2);