Browse Source

SceneTools: improve test robustness for when the plugin ABI breaks.

These should all get skipped if the system-installed plugins cannot be
loaded.
pull/168/merge
Vladimír Vondruš 2 years ago
parent
commit
4c65e22acc
  1. 11
      src/Magnum/SceneTools/Test/SceneConverterTest.cpp

11
src/Magnum/SceneTools/Test/SceneConverterTest.cpp

@ -65,7 +65,7 @@ const struct {
{"importer", {InPlaceInit, { {"importer", {InPlaceInit, {
"--info-importer", "-i", "someOption=yes" "--info-importer", "-i", "someOption=yes"
}}, }},
"AnySceneImporter", nullptr, nullptr, nullptr, nullptr, nullptr,
"info-importer.txt"}, "info-importer.txt"},
{"converter", {InPlaceInit, { {"converter", {InPlaceInit, {
"-C", "AnySceneConverter", "--info-converter", "-c", "someOption=yes" "-C", "AnySceneConverter", "--info-converter", "-c", "someOption=yes"
@ -1145,6 +1145,7 @@ const struct {
"ObjImporter", nullptr, nullptr, nullptr, "ObjImporter", nullptr, nullptr, nullptr,
"Utility::parseNumberSequence(): unrecognized character L in LOLNEIN\n"}, "Utility::parseNumberSequence(): unrecognized character L in LOLNEIN\n"},
{"can't load converter plugin", {InPlaceInit, { {"can't load converter plugin", {InPlaceInit, {
"-I", "ObjImporter",
"-C", "NonexistentSceneConverter", "-C", "NonexistentSceneConverter",
Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/point.obj"), Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/point.obj"),
Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.ply") Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.ply")
@ -1208,6 +1209,7 @@ const struct {
"ObjImporter", nullptr, "StanfordSceneConverter", nullptr, "ObjImporter", nullptr, "StanfordSceneConverter", nullptr,
"StanfordSceneConverter doesn't support importer conversion, only ConvertMeshToData\n"}, "StanfordSceneConverter doesn't support importer conversion, only ConvertMeshToData\n"},
{"can't load mesh converter plugin", {InPlaceInit, { {"can't load mesh converter plugin", {InPlaceInit, {
"-I", "ObjImporter",
"-M", "NonexistentSceneConverter", "-M", "NonexistentSceneConverter",
Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/point.obj"), Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/point.obj"),
Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.ply") Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.ply")
@ -1393,12 +1395,10 @@ const struct {
added directly */ added directly */
"-I", "GltfImporter", "--remove-duplicate-materials", "-I", "GltfImporter", "--remove-duplicate-materials",
"-C", "GltfSceneConverter", "-C", "GltfSceneConverter",
/* The input file makes no sense for PrimitiveImporter, it just has
to be something that exists */
Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/two-scenes.gltf"), Utility::Path::join(SCENETOOLS_TEST_DIR, "SceneConverterTestFiles/two-scenes.gltf"),
Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.gltf") Utility::Path::join(SCENETOOLS_TEST_OUTPUT_DIR, "SceneConverterTestFiles/whatever.gltf")
}}, }},
"PrimitiveImporter", nullptr, "GltfSceneConverter", "GltfImporter", nullptr, "GltfSceneConverter",
nullptr, nullptr,
/** @todo find some better case for this, this will pass once /** @todo find some better case for this, this will pass once
GltfSceneConverter has multi-scene support */ GltfSceneConverter has multi-scene support */
@ -1462,6 +1462,9 @@ void SceneConverterTest::info() {
CORRADE_SKIP(data.requiresConverter << "plugin can't be loaded."); CORRADE_SKIP(data.requiresConverter << "plugin can't be loaded.");
if(data.requiresImageConverter && !(imageConverterManager.load(data.requiresImageConverter) & PluginManager::LoadState::Loaded)) if(data.requiresImageConverter && !(imageConverterManager.load(data.requiresImageConverter) & PluginManager::LoadState::Loaded))
CORRADE_SKIP(data.requiresImageConverter << "plugin can't be loaded."); CORRADE_SKIP(data.requiresImageConverter << "plugin can't be loaded.");
/* AnySceneImporter is required implicitly for simplicity */
if(!(importerManager.load("AnySceneImporter") & PluginManager::LoadState::Loaded))
CORRADE_SKIP("AnySceneImporter plugin can't be loaded.");
CORRADE_VERIFY(true); /* capture correct function name */ CORRADE_VERIFY(true); /* capture correct function name */

Loading…
Cancel
Save