diff --git a/data/tests/mesh.obj b/data/tests/mesh.obj new file mode 100644 index 0000000000..c1e0c075db --- /dev/null +++ b/data/tests/mesh.obj @@ -0,0 +1,29 @@ +# Cube +v -5. -5. -5. +v 5. -5. -5. +v 5. -5. 5. +v -5. -5. 5. +v -5. 5. -5. +v 5. 5. 5. +v 5. 5. -5. +v -5. 5. 5. +vt 0.645815 0.980689 +vt 0.549235 0.9999 +vt 0.5 0.5 +vt 0.450764 0.9999 +vt 0.354185 0.980689 +vt 0.263209 0.943006 +vt 0.181332 0.888298 +vt 0.111702 0.818668 +f 1/1 2/2 3/3 +f 1/1 3/3 4/4 +f 5/5 6/6 7/7 +f 5/5 8/8 6/6 +f 1/1 8/8 5/5 +f 1/1 4/4 8/8 +f 2/2 7/7 6/6 +f 2/2 6/6 3/3 +f 1/1 5/5 7/7 +f 1/1 7/7 2/2 +f 4/4 6/6 8/8 +f 4/4 3/3 6/6 diff --git a/tests/src/Mod/Mesh/App/Importer.cpp b/tests/src/Mod/Mesh/App/Importer.cpp index 76157a6128..31f4e5c793 100644 --- a/tests/src/Mod/Mesh/App/Importer.cpp +++ b/tests/src/Mod/Mesh/App/Importer.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -37,4 +38,17 @@ TEST_F(ImporterTest, Test3MF) EXPECT_EQ(mesh2.CountEdges(), 1950); EXPECT_EQ(mesh2.CountFacets(), 1300); } + +TEST_F(ImporterTest, TestOBJ) +{ + std::string file(DATADIR); + file.append("/tests/mesh.obj"); + + MeshCore::MeshKernel kernel; + MeshCore::ReaderOBJ reader(kernel, nullptr); + EXPECT_EQ(reader.Load(file), true); + + EXPECT_EQ(kernel.CountPoints(), 8); + EXPECT_EQ(kernel.CountFacets(), 12); +} // NOLINTEND(cppcoreguidelines-*,readability-*)