Skip to content

Commit

Permalink
#5383: Add unit test asserting the LWO and ASE poly count after loading
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 8, 2020
1 parent 54d6632 commit 2034a9d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ drtest_SOURCES = math/Matrix4.cpp \
FacePlane.cpp \
Materials.cpp \
MapExport.cpp \
Models.cpp \
ModelExport.cpp \
ModelScale.cpp \
SelectionAlgorithm.cpp \
Expand Down
28 changes: 28 additions & 0 deletions test/Models.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "RadiantTest.h"

#include "imodelcache.h"

namespace test
{

using ModelTest = RadiantTest;

TEST_F(ModelTest, LwoPolyCount)
{
auto model = GlobalModelCache().getModel("models/darkmod/test/unit_cube.lwo");
EXPECT_TRUE(model);

// The unit cube should have 12 polys (6 quads = 12 tris)
EXPECT_EQ(model->getPolyCount(), 12);
}

TEST_F(ModelTest, AsePolyCount)
{
auto model = GlobalModelCache().getModel("models/darkmod/test/unit_cube.ase");
EXPECT_TRUE(model);

// The unit cube should have 12 polys (6 quads = 12 tris)
EXPECT_EQ(model->getPolyCount(), 12);
}

}
1 change: 1 addition & 0 deletions tools/msvc/Tests/Tests.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<ClCompile Include="..\..\..\test\math\Quaternion.cpp" />
<ClCompile Include="..\..\..\test\math\Vector3.cpp" />
<ClCompile Include="..\..\..\test\ModelExport.cpp" />
<ClCompile Include="..\..\..\test\Models.cpp" />
<ClCompile Include="..\..\..\test\ModelScale.cpp" />
<ClCompile Include="..\..\..\test\SelectionAlgorithm.cpp" />
<ClCompile Include="..\..\..\test\VFS.cpp" />
Expand Down
1 change: 1 addition & 0 deletions tools/msvc/Tests/Tests.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
</ClCompile>
<ClCompile Include="..\..\..\test\ModelExport.cpp" />
<ClCompile Include="..\..\..\test\MapExport.cpp" />
<ClCompile Include="..\..\..\test\Models.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\test\HeadlessOpenGLContext.h" />
Expand Down

0 comments on commit 2034a9d

Please sign in to comment.