Tests: Add test case for ReaderOBJ

This commit is contained in:
wmayer
2025-08-22 12:32:42 +02:00
committed by Yorik van Havre
parent 9c63b7032b
commit 96f6b6ce3c
2 changed files with 43 additions and 0 deletions

29
data/tests/mesh.obj Normal file
View File

@@ -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

View File

@@ -1,6 +1,7 @@
#include <gtest/gtest.h>
#include <Base/FileInfo.h>
#include <Mod/Mesh/App/Core/IO/Reader3MF.h>
#include <Mod/Mesh/App/Core/IO/ReaderOBJ.h>
#include <xercesc/util/PlatformUtils.hpp>
#include <zipios++/fcoll.h>
@@ -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-*)