Test that minimal triangle has correct vertices

This commit is contained in:
JosiahWI
2022-10-17 07:34:19 -05:00
parent 4f5588e7e8
commit 336aa204fb
2 changed files with 31 additions and 6 deletions

View File

@ -7,22 +7,30 @@
TEST_CASE("load empty gltf file") {
irr::IrrlichtDevice* device { irr::createDevice(irr::video::EDT_NULL) };
irr::scene::ISceneManager* smgr { device->getSceneManager() };
irr::io::InMemoryFile filebuf {"test.gltf", ""};
auto* mesh { smgr->getMesh(&filebuf) };
CHECK(mesh == nullptr);
device->drop();
}
TEST_CASE("load minimal triangle") {
TEST_CASE("minimal triangle has correct vertices") {
irr::IrrlichtDevice* device { irr::createDevice(irr::video::EDT_NULL) };
irr::scene::ISceneManager* smgr { device->getSceneManager() };
auto* mesh { smgr->getMesh(
"source/Irrlicht/tests/assets/minimal_triangle.gltf", "") };
REQUIRE(mesh != nullptr);
REQUIRE(mesh->getMeshBufferCount() == 1);
auto* meshbuf { mesh->getMeshBuffer(0) };
REQUIRE(meshbuf->getVertexCount() == 3);
irr::video::S3DVertex* vertices {
reinterpret_cast<irr::video::S3DVertex*>(
meshbuf->getVertices()) };
CHECK(vertices[0].Pos == irr::core::vector3df {0.0f, 0.0f, 0.0f});
CHECK(vertices[1].Pos == irr::core::vector3df {1.0f, 0.0f, 0.0f});
CHECK(vertices[2].Pos == irr::core::vector3df {1.0f, 1.0f, 0.0f});
device->drop();
}