Fix build and test

pull/4111/head
Malcolm Tyrrell 2021-10-07 09:29:56 +01:00
parent ceddfe19d8
commit 5a1bcc6aa5
1 changed files with 4 additions and 4 deletions

View File

@ -785,7 +785,7 @@ namespace {
rapidjson::Document schemaDoc; rapidjson::Document schemaDoc;
schemaDoc.Parse(R"==({"properties":{"scene" : { "type" : "integer" }}, "required": [ "scene" ]})=="); schemaDoc.Parse(R"==({"properties":{"scene" : { "type" : "integer" }}, "required": [ "scene" ]})==");
EXPECT_FALSE(schemaDoc.HasParseError()); EXPECT_FALSE(schemaDoc.HasParseError());
m_schema = std::make_unique<const rapidjson::SchemaDocument>(schemaDoc, m_schemaName.c_str(), static_cast<rapidjson::SizeType>(m_schemaName.size()), this); m_schema.reset(new rapidjson::SchemaDocument(schemaDoc, m_schemaName.c_str(), static_cast<rapidjson::SizeType>(m_schemaName.size()), this));
} }
const rapidjson::SchemaDocument* GetRemoteDocument(const char* uri, rapidjson::SizeType) override { const rapidjson::SchemaDocument* GetRemoteDocument(const char* uri, rapidjson::SizeType) override {
@ -805,7 +805,7 @@ TEST_F(utglTF2ImportExport, schemaCheckPass) {
FakeSchemaProvider schemaProvider("glTF.schema.json"); FakeSchemaProvider schemaProvider("glTF.schema.json");
Assimp::Importer importer; Assimp::Importer importer;
importer.SetPropertyPointer(AI_CONFIG_IMPORT_SCHEMA_DOCUMENT_PROVIDER, &schemaProvider); importer.SetPropertyPointer(AI_CONFIG_IMPORT_SCHEMA_DOCUMENT_PROVIDER, &schemaProvider);
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/gltf2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(scene, nullptr); EXPECT_NE(scene, nullptr);
EXPECT_STREQ(importer.GetErrorString(), ""); EXPECT_STREQ(importer.GetErrorString(), "");
} }
@ -814,7 +814,7 @@ TEST_F(utglTF2ImportExport, schemaCheckFail) {
FakeSchemaProvider schemaProvider("glTF.schema.json"); FakeSchemaProvider schemaProvider("glTF.schema.json");
Assimp::Importer importer; Assimp::Importer importer;
importer.SetPropertyPointer(AI_CONFIG_IMPORT_SCHEMA_DOCUMENT_PROVIDER, &schemaProvider); importer.SetPropertyPointer(AI_CONFIG_IMPORT_SCHEMA_DOCUMENT_PROVIDER, &schemaProvider);
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/gltf2/SchemaFailures/sceneWrongType.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/SchemaFailures/sceneWrongType.gltf", aiProcess_ValidateDataStructure);
EXPECT_EQ(scene, nullptr); EXPECT_EQ(scene, nullptr);
const std::string errorString = importer.GetErrorString(); const std::string errorString = importer.GetErrorString();
EXPECT_NE(errorString.find("The JSON document did not satisfy the glTF2 schema"), std::string::npos); EXPECT_NE(errorString.find("The JSON document did not satisfy the glTF2 schema"), std::string::npos);
@ -826,7 +826,7 @@ TEST_F(utglTF2ImportExport, noSchemaFound) {
FakeSchemaProvider schemaProvider("missingSchema.json"); FakeSchemaProvider schemaProvider("missingSchema.json");
Assimp::Importer importer; Assimp::Importer importer;
importer.SetPropertyPointer(AI_CONFIG_IMPORT_SCHEMA_DOCUMENT_PROVIDER, &schemaProvider); importer.SetPropertyPointer(AI_CONFIG_IMPORT_SCHEMA_DOCUMENT_PROVIDER, &schemaProvider);
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/gltf2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure); const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/glTF2/BoxTextured-glTF/BoxTextured.gltf", aiProcess_ValidateDataStructure);
EXPECT_NE(scene, nullptr); EXPECT_NE(scene, nullptr);
EXPECT_STREQ(importer.GetErrorString(), ""); EXPECT_STREQ(importer.GetErrorString(), "");
} }