Skip to content

Commit 69ca054

Browse files
authored
Merge pull request #63 from diffCheckOrg/test_suite_cpp_addpoint
test for AddPoints() in DFPointCloud
2 parents b379924 + c4c395a commit 69ca054

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/integration_tests/pybinds_tests/test_pybind_units.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ def test_DFPointCloud_properties(create_DFPointCloudSampleRoof):
7575
assert pc.has_colors() == False, "has_colors() should return False"
7676
assert pc.has_normals() == False, "has_normals() should return False"
7777

78+
def test_DFPointCloud_add_points():
79+
point_pc_1 = [(0, 0, 0)]
80+
point_pc_2 = [(1, 1, 1)]
81+
normal_pc_1 = [(0, 0, 1)]
82+
normal_pc_2 = [(1, 0, 0)]
83+
color_pc_1 = [(255, 0, 0)]
84+
color_pc_2 = [(0, 255, 0)]
85+
pc_1 = dfb.dfb_geometry.DFPointCloud(point_pc_1, normal_pc_1, color_pc_1)
86+
pc_2 = dfb.dfb_geometry.DFPointCloud(point_pc_2, normal_pc_2, color_pc_2)
87+
pc_1.add_points(pc_2)
88+
assert pc_1.points.__len__() == 2, "two pointclouds of 1 pt combined into one should have 2 pts"
89+
7890
def test_DFPointCloud_apply_color(create_DFPointCloudSampleRoof):
7991
pc = create_DFPointCloudSampleRoof
8092
pc.apply_color(255, 0, 0)

tests/unit_tests/DFPointCloudTest.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ TEST_F(DFPointCloudTestFixture, ComputeDistance) {
117117
EXPECT_EQ(distances.size(), 7379);
118118
}
119119

120+
TEST_F(DFPointCloudTestFixture, AddPoints) {
121+
std::shared_ptr<diffCheck::geometry::DFPointCloud> dfPointCloud2 = std::make_shared<diffCheck::geometry::DFPointCloud>();
122+
dfPointCloud2->LoadFromPLY(diffCheck::io::GetRoofQuarterPlyPath());
123+
dfPointCloud.AddPoints(*dfPointCloud2);
124+
EXPECT_EQ(dfPointCloud.GetNumPoints(), 7379 * 2);
125+
}
126+
120127
TEST_F(DFPointCloudTestFixture, ComputeAABB) {
121128
std::vector<Eigen::Vector3d> bbox = dfPointCloud.ComputeBoundingBox();
122129
EXPECT_EQ(bbox.size(), 2);

0 commit comments

Comments
 (0)