1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00
openrw/tests/test_loaderdff.cpp

42 lines
945 B
C++
Raw Normal View History

2014-02-10 13:09:16 +01:00
#include <boost/test/unit_test.hpp>
#include <data/Model.hpp>
2016-09-09 22:13:22 +02:00
#include "test_globals.hpp"
2014-02-10 13:09:16 +01:00
BOOST_AUTO_TEST_SUITE(LoaderDFFTests)
#if RW_TEST_WITH_DATA
2016-09-09 22:13:22 +02:00
BOOST_AUTO_TEST_CASE(test_load_dff) {
{
auto d = Global::get().e->data->index.openFile("landstal.dff");
2014-06-04 12:53:11 +02:00
2016-09-09 22:13:22 +02:00
LoaderDFF loader;
2014-06-04 12:53:11 +02:00
2016-09-09 22:13:22 +02:00
Model* m = loader.loadFromMemory(d);
2014-06-04 12:53:11 +02:00
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE(m != nullptr);
2014-06-04 12:53:11 +02:00
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE_EQUAL(m->frames.size(), 40);
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE_EQUAL(m->geometries.size(), 16);
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE_EQUAL(m->geometries[0]->subgeom.size(), 5);
2016-09-09 22:13:22 +02:00
for (auto& g : m->geometries) {
BOOST_CHECK_GT(g->geometryBounds.radius, 0.f);
}
2016-09-09 22:13:22 +02:00
BOOST_REQUIRE(m->atomics.size() > 0);
2016-09-09 22:13:22 +02:00
for (Model::Atomic& a : m->atomics) {
BOOST_CHECK(a.frame < m->frames.size());
BOOST_CHECK(a.geometry < m->geometries.size());
}
2014-06-04 12:53:11 +02:00
2016-09-09 22:13:22 +02:00
delete m;
}
2014-06-04 12:53:11 +02:00
}
#endif
2014-02-10 13:09:16 +01:00
BOOST_AUTO_TEST_SUITE_END()