Move everything to sections of one big "gltf" test case

This commit is contained in:
Lars Mueller 2024-06-08 02:02:11 +02:00
parent 59a173b51b
commit 451978dc2c

@ -60,12 +60,14 @@ class ScopedMesh
using v3f = irr::core::vector3df; using v3f = irr::core::vector3df;
using v2f = irr::core::vector2df; using v2f = irr::core::vector2df;
TEST_CASE("load empty gltf file") { TEST_CASE("gltf") {
SECTION("load empty gltf file") {
ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "empty.gltf"); ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "empty.gltf");
CHECK(sm.getMesh() == nullptr); CHECK(sm.getMesh() == nullptr);
} }
TEST_CASE("minimal triangle") { SECTION("minimal triangle") {
auto path = GENERATE( auto path = GENERATE(
XSTR(UNITTEST_ASSETS_DIRECTORY) "minimal_triangle.gltf", XSTR(UNITTEST_ASSETS_DIRECTORY) "minimal_triangle.gltf",
XSTR(UNITTEST_ASSETS_DIRECTORY) "triangle_with_vertex_stride.gltf", XSTR(UNITTEST_ASSETS_DIRECTORY) "triangle_with_vertex_stride.gltf",
@ -95,7 +97,7 @@ TEST_CASE("minimal triangle") {
} }
} }
TEST_CASE("blender cube") { SECTION("blender cube") {
ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "blender_cube.gltf"); ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "blender_cube.gltf");
REQUIRE(sm.getMesh() != nullptr); REQUIRE(sm.getMesh() != nullptr);
REQUIRE(sm.getMesh()->getMeshBufferCount() == 1); REQUIRE(sm.getMesh()->getMeshBufferCount() == 1);
@ -148,17 +150,17 @@ TEST_CASE("blender cube") {
} }
} }
TEST_CASE("mesh loader returns nullptr when given null file pointer") { SECTION("mesh loader returns nullptr when given null file pointer") {
ScopedMesh sm(nullptr); ScopedMesh sm(nullptr);
CHECK(sm.getMesh() == nullptr); CHECK(sm.getMesh() == nullptr);
} }
TEST_CASE("invalid JSON returns nullptr") { SECTION("invalid JSON returns nullptr") {
ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "json_missing_brace.gltf"); ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "json_missing_brace.gltf");
CHECK(sm.getMesh() == nullptr); CHECK(sm.getMesh() == nullptr);
} }
TEST_CASE("blender cube scaled") { SECTION("blender cube scaled") {
ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "blender_cube_scaled.gltf"); ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "blender_cube_scaled.gltf");
REQUIRE(sm.getMesh() != nullptr); REQUIRE(sm.getMesh() != nullptr);
REQUIRE(sm.getMesh()->getMeshBufferCount() == 1); REQUIRE(sm.getMesh()->getMeshBufferCount() == 1);
@ -179,7 +181,7 @@ TEST_CASE("blender cube scaled") {
} }
} }
TEST_CASE("blender cube matrix transform") { SECTION("blender cube matrix transform") {
ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "blender_cube_matrix_transform.gltf"); ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "blender_cube_matrix_transform.gltf");
REQUIRE(sm.getMesh() != nullptr); REQUIRE(sm.getMesh() != nullptr);
REQUIRE(sm.getMesh()->getMeshBufferCount() == 1); REQUIRE(sm.getMesh()->getMeshBufferCount() == 1);
@ -205,7 +207,7 @@ TEST_CASE("blender cube matrix transform") {
} }
} }
TEST_CASE("snow man") { SECTION("snow man") {
ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "snow_man.gltf"); ScopedMesh sm(XSTR(UNITTEST_ASSETS_DIRECTORY) "snow_man.gltf");
REQUIRE(sm.getMesh() != nullptr); REQUIRE(sm.getMesh() != nullptr);
REQUIRE(sm.getMesh()->getMeshBufferCount() == 3); REQUIRE(sm.getMesh()->getMeshBufferCount() == 3);
@ -357,3 +359,5 @@ TEST_CASE("snow man") {
} }
} }
} }
}