summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 15:12:25 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2021-02-20 15:12:25 +0000
commite85db91c6b6a326e3339020bc434063db6c957f9 (patch)
treeafbed715e697fd265d14c58b8fbd2b077334e697 /test
parentFix constness of Mesh constructor params (diff)
downloadilt-e85db91c6b6a326e3339020bc434063db6c957f9.tar.bz2
ilt-e85db91c6b6a326e3339020bc434063db6c957f9.tar.xz
ilt-e85db91c6b6a326e3339020bc434063db6c957f9.zip
Fix test-obj by splitting mesh processing
Don't invoke GL parts from test code
Diffstat (limited to 'test')
-rw-r--r--test/test-obj.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test-obj.cpp b/test/test-obj.cpp
index 0d53691..4adc961 100644
--- a/test/test-obj.cpp
+++ b/test/test-obj.cpp
@@ -3,6 +3,8 @@
#include <boost/test/unit_test.hpp>
#include <gfx/models/obj.h>
+#include <gfx/models/vertex.hpp>
+#include <glm/glm.hpp>
#include <memory>
#include <utility>
#include <vector>
@@ -10,7 +12,6 @@
BOOST_AUTO_TEST_CASE(objparse)
{
ObjParser op {"/home/randomdan/dev/game/res/brush47.obj"};
- BOOST_REQUIRE_EQUAL(0, op.yylex());
BOOST_CHECK_EQUAL(48, op.vertices.size());
BOOST_CHECK_EQUAL(104, op.texCoords.size());
BOOST_CHECK_EQUAL(25, op.normals.size());
@@ -26,6 +27,11 @@ BOOST_AUTO_TEST_CASE(objparse)
BOOST_AUTO_TEST_CASE(create_meshes)
{
ObjParser op {"/home/randomdan/dev/game/res/brush47.obj"};
- const auto ms = op.createMeshes();
+ const auto ms = op.createMeshData();
BOOST_REQUIRE_EQUAL(3, ms.size());
+ BOOST_REQUIRE_EQUAL("Body", ms.front().first);
+ BOOST_REQUIRE_EQUAL(76, ms.front().second.first.size());
+ const auto & v = ms.front().second.first.front();
+ BOOST_REQUIRE_CLOSE(1.345, v.pos.x, 1);
+ BOOST_REQUIRE_EQUAL(120, ms.front().second.second.size());
}