Replace exception by error in log (#6133)

* Replace exception by error in log

* Separate tests for new behaviour

---------

Co-authored-by: Kim Kulling <kim.kulling@draeger.com>
This commit is contained in:
Kim Kulling
2025-05-05 14:07:52 +02:00
committed by GitHub
co-authored by Kim Kulling
parent b0e0ce5a28
commit d1b73dffec
3 changed files with 30 additions and 6 deletions
+24 -2
View File
@@ -933,8 +933,8 @@ TEST_F(utglTF2ImportExport, wrongTypes) {
TUPLE("/glTF2/wrongTypes/badString.gltf", "string", "name", "scenes[0]"),
TUPLE("/glTF2/wrongTypes/badUint.gltf", "uint", "index", "materials[0]"),
TUPLE("/glTF2/wrongTypes/badNumber.gltf", "number", "scale", "materials[0]"),
TUPLE("/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]"),
TUPLE("/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]")
//TUPLE("/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]"),
//TUPLE("/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]")
#undef TUPLE
};
for (const auto& tuple : wrongTypes)
@@ -952,6 +952,28 @@ TEST_F(utglTF2ImportExport, wrongTypes) {
}
}
TEST_F(utglTF2ImportExport, wrongObject) {
// Deliberately broken version of the BoxTextured.gltf asset.
using tup_T = std::tuple<std::string, std::string, std::string, std::string>;
std::vector<tup_T> wrongTypes = {
#ifdef __cpp_lib_constexpr_tuple
#define TUPLE(x, y, z, w) \
{ x, y, z, w }
#else
#define TUPLE(x, y, z, w) tup_T(x, y, z, w)
#endif
TUPLE("/glTF2/wrongTypes/badObject.gltf", "object", "pbrMetallicRoughness", "materials[0]"),
TUPLE("/glTF2/wrongTypes/badExtension.gltf", "object", "KHR_texture_transform", "materials[0]")
#undef TUPLE
};
for (const auto &tuple : wrongTypes) {
const auto &file = std::get<0>(tuple);
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR + file, aiProcess_ValidateDataStructure);
ASSERT_NE(scene, nullptr);
}
}
namespace {
/// This class provides a fake schema to the GLTF importer.
/// It just checks that the file has a top-level "scene" property which is an integer.