Browse Source

Trade: provide less useless OOB assert messages.

If this would be there yesterday already, it would made my debugging
session of `image2D(-1)` immediately obvious (instead of wasting 20
minutes).
findsdl-include-root
Vladimír Vondruš 7 years ago
parent
commit
387a12c329
  1. 52
      src/Magnum/Trade/AbstractImporter.cpp
  2. 156
      src/Magnum/Trade/Test/AbstractImporterTest.cpp

52
src/Magnum/Trade/AbstractImporter.cpp

@ -224,7 +224,7 @@ Int AbstractImporter::doSceneForName(const std::string&) { return -1; }
std::string AbstractImporter::sceneName(const UnsignedInt id) { std::string AbstractImporter::sceneName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::sceneName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::sceneName(): no file opened", {});
CORRADE_ASSERT(id < doSceneCount(), "Trade::AbstractImporter::sceneName(): index out of range", {}); CORRADE_ASSERT(id < doSceneCount(), "Trade::AbstractImporter::sceneName(): index" << id << "out of range for" << doSceneCount() << "entries", {});
return doSceneName(id); return doSceneName(id);
} }
@ -232,7 +232,7 @@ std::string AbstractImporter::doSceneName(UnsignedInt) { return {}; }
Containers::Optional<SceneData> AbstractImporter::scene(const UnsignedInt id) { Containers::Optional<SceneData> AbstractImporter::scene(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::scene(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::scene(): no file opened", {});
CORRADE_ASSERT(id < doSceneCount(), "Trade::AbstractImporter::scene(): index out of range", {}); CORRADE_ASSERT(id < doSceneCount(), "Trade::AbstractImporter::scene(): index" << id << "out of range for" << doSceneCount() << "entries", {});
return doScene(id); return doScene(id);
} }
@ -256,7 +256,7 @@ Int AbstractImporter::doAnimationForName(const std::string&) { return -1; }
std::string AbstractImporter::animationName(const UnsignedInt id) { std::string AbstractImporter::animationName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::animationName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::animationName(): no file opened", {});
CORRADE_ASSERT(id < doAnimationCount(), "Trade::AbstractImporter::animationName(): index out of range", {}); CORRADE_ASSERT(id < doAnimationCount(), "Trade::AbstractImporter::animationName(): index" << id << "out of range for" << doAnimationCount() << "entries", {});
return doAnimationName(id); return doAnimationName(id);
} }
@ -264,7 +264,7 @@ std::string AbstractImporter::doAnimationName(UnsignedInt) { return {}; }
Containers::Optional<AnimationData> AbstractImporter::animation(const UnsignedInt id) { Containers::Optional<AnimationData> AbstractImporter::animation(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::animation(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::animation(): no file opened", {});
CORRADE_ASSERT(id < doAnimationCount(), "Trade::AbstractImporter::animation(): index out of range", {}); CORRADE_ASSERT(id < doAnimationCount(), "Trade::AbstractImporter::animation(): index" << id << "out of range for" << doAnimationCount() << "entries", {});
return doAnimation(id); return doAnimation(id);
} }
@ -288,7 +288,7 @@ Int AbstractImporter::doLightForName(const std::string&) { return -1; }
std::string AbstractImporter::lightName(const UnsignedInt id) { std::string AbstractImporter::lightName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::lightName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::lightName(): no file opened", {});
CORRADE_ASSERT(id < doLightCount(), "Trade::AbstractImporter::lightName(): index out of range", {}); CORRADE_ASSERT(id < doLightCount(), "Trade::AbstractImporter::lightName(): index" << id << "out of range for" << doLightCount() << "entries", {});
return doLightName(id); return doLightName(id);
} }
@ -296,7 +296,7 @@ std::string AbstractImporter::doLightName(UnsignedInt) { return {}; }
Containers::Optional<LightData> AbstractImporter::light(const UnsignedInt id) { Containers::Optional<LightData> AbstractImporter::light(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::light(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::light(): no file opened", {});
CORRADE_ASSERT(id < doLightCount(), "Trade::AbstractImporter::light(): index out of range", {}); CORRADE_ASSERT(id < doLightCount(), "Trade::AbstractImporter::light(): index" << id << "out of range for" << doLightCount() << "entries", {});
return doLight(id); return doLight(id);
} }
@ -320,7 +320,7 @@ Int AbstractImporter::doCameraForName(const std::string&) { return -1; }
std::string AbstractImporter::cameraName(const UnsignedInt id) { std::string AbstractImporter::cameraName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::cameraName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::cameraName(): no file opened", {});
CORRADE_ASSERT(id < doCameraCount(), "Trade::AbstractImporter::cameraName(): index out of range", {}); CORRADE_ASSERT(id < doCameraCount(), "Trade::AbstractImporter::cameraName(): index" << id << "out of range for" << doCameraCount() << "entries", {});
return doCameraName(id); return doCameraName(id);
} }
@ -328,7 +328,7 @@ std::string AbstractImporter::doCameraName(UnsignedInt) { return {}; }
Containers::Optional<CameraData> AbstractImporter::camera(const UnsignedInt id) { Containers::Optional<CameraData> AbstractImporter::camera(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::camera(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::camera(): no file opened", {});
CORRADE_ASSERT(id < doCameraCount(), "Trade::AbstractImporter::camera(): index out of range", {}); CORRADE_ASSERT(id < doCameraCount(), "Trade::AbstractImporter::camera(): index" << id << "out of range for" << doCameraCount() << "entries", {});
return doCamera(id); return doCamera(id);
} }
@ -352,7 +352,7 @@ Int AbstractImporter::doObject2DForName(const std::string&) { return -1; }
std::string AbstractImporter::object2DName(const UnsignedInt id) { std::string AbstractImporter::object2DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object2DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object2DName(): no file opened", {});
CORRADE_ASSERT(id < doObject2DCount(), "Trade::AbstractImporter::object2DName(): index out of range", {}); CORRADE_ASSERT(id < doObject2DCount(), "Trade::AbstractImporter::object2DName(): index" << id << "out of range for" << doObject2DCount() << "entries", {});
return doObject2DName(id); return doObject2DName(id);
} }
@ -360,7 +360,7 @@ std::string AbstractImporter::doObject2DName(UnsignedInt) { return {}; }
Containers::Pointer<ObjectData2D> AbstractImporter::object2D(const UnsignedInt id) { Containers::Pointer<ObjectData2D> AbstractImporter::object2D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object2D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object2D(): no file opened", {});
CORRADE_ASSERT(id < doObject2DCount(), "Trade::AbstractImporter::object2D(): index out of range", {}); CORRADE_ASSERT(id < doObject2DCount(), "Trade::AbstractImporter::object2D(): index" << id << "out of range for" << doObject2DCount() << "entries", {});
return doObject2D(id); return doObject2D(id);
} }
@ -384,7 +384,7 @@ Int AbstractImporter::doObject3DForName(const std::string&) { return -1; }
std::string AbstractImporter::object3DName(const UnsignedInt id) { std::string AbstractImporter::object3DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object3DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object3DName(): no file opened", {});
CORRADE_ASSERT(id < doObject3DCount(), "Trade::AbstractImporter::object3DName(): index out of range", {}); CORRADE_ASSERT(id < doObject3DCount(), "Trade::AbstractImporter::object3DName(): index" << id << "out of range for" << doObject3DCount() << "entries", {});
return doObject3DName(id); return doObject3DName(id);
} }
@ -392,7 +392,7 @@ std::string AbstractImporter::doObject3DName(UnsignedInt) { return {}; }
Containers::Pointer<ObjectData3D> AbstractImporter::object3D(const UnsignedInt id) { Containers::Pointer<ObjectData3D> AbstractImporter::object3D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object3D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::object3D(): no file opened", {});
CORRADE_ASSERT(id < doObject3DCount(), "Trade::AbstractImporter::object3D(): index out of range", {}); CORRADE_ASSERT(id < doObject3DCount(), "Trade::AbstractImporter::object3D(): index" << id << "out of range for" << doObject3DCount() << "entries", {});
return doObject3D(id); return doObject3D(id);
} }
@ -416,7 +416,7 @@ Int AbstractImporter::doMesh2DForName(const std::string&) { return -1; }
std::string AbstractImporter::mesh2DName(const UnsignedInt id) { std::string AbstractImporter::mesh2DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh2DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh2DName(): no file opened", {});
CORRADE_ASSERT(id < doMesh2DCount(), "Trade::AbstractImporter::mesh2DName(): index out of range", {}); CORRADE_ASSERT(id < doMesh2DCount(), "Trade::AbstractImporter::mesh2DName(): index" << id << "out of range for" << doMesh2DCount() << "entries", {});
return doMesh2DName(id); return doMesh2DName(id);
} }
@ -424,7 +424,7 @@ std::string AbstractImporter::doMesh2DName(UnsignedInt) { return {}; }
Containers::Optional<MeshData2D> AbstractImporter::mesh2D(const UnsignedInt id) { Containers::Optional<MeshData2D> AbstractImporter::mesh2D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh2D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh2D(): no file opened", {});
CORRADE_ASSERT(id < doMesh2DCount(), "Trade::AbstractImporter::mesh2D(): index out of range", {}); CORRADE_ASSERT(id < doMesh2DCount(), "Trade::AbstractImporter::mesh2D(): index" << id << "out of range for" << doMesh2DCount() << "entries", {});
return doMesh2D(id); return doMesh2D(id);
} }
@ -448,7 +448,7 @@ Int AbstractImporter::doMesh3DForName(const std::string&) { return -1; }
std::string AbstractImporter::mesh3DName(const UnsignedInt id) { std::string AbstractImporter::mesh3DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh3DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh3DName(): no file opened", {});
CORRADE_ASSERT(id < doMesh3DCount(), "Trade::AbstractImporter::mesh3DName(): index out of range", {}); CORRADE_ASSERT(id < doMesh3DCount(), "Trade::AbstractImporter::mesh3DName(): index" << id << "out of range for" << doMesh3DCount() << "entries", {});
return doMesh3DName(id); return doMesh3DName(id);
} }
@ -456,7 +456,7 @@ std::string AbstractImporter::doMesh3DName(UnsignedInt) { return {}; }
Containers::Optional<MeshData3D> AbstractImporter::mesh3D(const UnsignedInt id) { Containers::Optional<MeshData3D> AbstractImporter::mesh3D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh3D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::mesh3D(): no file opened", {});
CORRADE_ASSERT(id < doMesh3DCount(), "Trade::AbstractImporter::mesh3D(): index out of range", {}); CORRADE_ASSERT(id < doMesh3DCount(), "Trade::AbstractImporter::mesh3D(): index" << id << "out of range for" << doMesh3DCount() << "entries", {});
return doMesh3D(id); return doMesh3D(id);
} }
@ -480,7 +480,7 @@ Int AbstractImporter::doMaterialForName(const std::string&) { return -1; }
std::string AbstractImporter::materialName(const UnsignedInt id) { std::string AbstractImporter::materialName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::materialName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::materialName(): no file opened", {});
CORRADE_ASSERT(id < doMaterialCount(), "Trade::AbstractImporter::materialName(): index out of range", {}); CORRADE_ASSERT(id < doMaterialCount(), "Trade::AbstractImporter::materialName(): index" << id << "out of range for" << doMaterialCount() << "entries", {});
return doMaterialName(id); return doMaterialName(id);
} }
@ -488,7 +488,7 @@ std::string AbstractImporter::doMaterialName(UnsignedInt) { return {}; }
Containers::Pointer<AbstractMaterialData> AbstractImporter::material(const UnsignedInt id) { Containers::Pointer<AbstractMaterialData> AbstractImporter::material(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::material(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::material(): no file opened", {});
CORRADE_ASSERT(id < doMaterialCount(), "Trade::AbstractImporter::material(): index out of range", {}); CORRADE_ASSERT(id < doMaterialCount(), "Trade::AbstractImporter::material(): index" << id << "out of range for" << doMaterialCount() << "entries", {});
return doMaterial(id); return doMaterial(id);
} }
@ -512,7 +512,7 @@ Int AbstractImporter::doTextureForName(const std::string&) { return -1; }
std::string AbstractImporter::textureName(const UnsignedInt id) { std::string AbstractImporter::textureName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::textureName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::textureName(): no file opened", {});
CORRADE_ASSERT(id < doTextureCount(), "Trade::AbstractImporter::textureName(): index out of range", {}); CORRADE_ASSERT(id < doTextureCount(), "Trade::AbstractImporter::textureName(): index" << id << "out of range for" << doTextureCount() << "entries", {});
return doTextureName(id); return doTextureName(id);
} }
@ -520,7 +520,7 @@ std::string AbstractImporter::doTextureName(UnsignedInt) { return {}; }
Containers::Optional<TextureData> AbstractImporter::texture(const UnsignedInt id) { Containers::Optional<TextureData> AbstractImporter::texture(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::texture(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::texture(): no file opened", {});
CORRADE_ASSERT(id < doTextureCount(), "Trade::AbstractImporter::texture(): index out of range", {}); CORRADE_ASSERT(id < doTextureCount(), "Trade::AbstractImporter::texture(): index" << id << "out of range for" << doTextureCount() << "entries", {});
return doTexture(id); return doTexture(id);
} }
@ -544,7 +544,7 @@ Int AbstractImporter::doImage1DForName(const std::string&) { return -1; }
std::string AbstractImporter::image1DName(const UnsignedInt id) { std::string AbstractImporter::image1DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image1DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image1DName(): no file opened", {});
CORRADE_ASSERT(id < doImage1DCount(), "Trade::AbstractImporter::image1DName(): index out of range", {}); CORRADE_ASSERT(id < doImage1DCount(), "Trade::AbstractImporter::image1DName(): index" << id << "out of range for" << doImage1DCount() << "entries", {});
return doImage1DName(id); return doImage1DName(id);
} }
@ -552,7 +552,7 @@ std::string AbstractImporter::doImage1DName(UnsignedInt) { return {}; }
Containers::Optional<ImageData1D> AbstractImporter::image1D(const UnsignedInt id) { Containers::Optional<ImageData1D> AbstractImporter::image1D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image1D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image1D(): no file opened", {});
CORRADE_ASSERT(id < doImage1DCount(), "Trade::AbstractImporter::image1D(): index out of range", {}); CORRADE_ASSERT(id < doImage1DCount(), "Trade::AbstractImporter::image1D(): index" << id << "out of range for" << doImage1DCount() << "entries", {});
return doImage1D(id); return doImage1D(id);
} }
@ -576,7 +576,7 @@ Int AbstractImporter::doImage2DForName(const std::string&) { return -1; }
std::string AbstractImporter::image2DName(const UnsignedInt id) { std::string AbstractImporter::image2DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image2DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image2DName(): no file opened", {});
CORRADE_ASSERT(id < doImage2DCount(), "Trade::AbstractImporter::image2DName(): index out of range", {}); CORRADE_ASSERT(id < doImage2DCount(), "Trade::AbstractImporter::image2DName(): index" << id << "out of range for" << doImage2DCount() << "entries", {});
return doImage2DName(id); return doImage2DName(id);
} }
@ -584,7 +584,7 @@ std::string AbstractImporter::doImage2DName(UnsignedInt) { return {}; }
Containers::Optional<ImageData2D> AbstractImporter::image2D(const UnsignedInt id) { Containers::Optional<ImageData2D> AbstractImporter::image2D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image2D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image2D(): no file opened", {});
CORRADE_ASSERT(id < doImage2DCount(), "Trade::AbstractImporter::image2D(): index out of range", {}); CORRADE_ASSERT(id < doImage2DCount(), "Trade::AbstractImporter::image2D(): index" << id << "out of range for" << doImage2DCount() << "entries", {});
return doImage2D(id); return doImage2D(id);
} }
@ -608,7 +608,7 @@ Int AbstractImporter::doImage3DForName(const std::string&) { return -1; }
std::string AbstractImporter::image3DName(const UnsignedInt id) { std::string AbstractImporter::image3DName(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image3DName(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image3DName(): no file opened", {});
CORRADE_ASSERT(id < image3DCount(), "Trade::AbstractImporter::image3DName(): index out of range", {}); CORRADE_ASSERT(id < doImage3DCount(), "Trade::AbstractImporter::image3DName(): index" << id << "out of range for" << doImage3DCount() << "entries", {});
return doImage3DName(id); return doImage3DName(id);
} }
@ -616,7 +616,7 @@ std::string AbstractImporter::doImage3DName(UnsignedInt) { return {}; }
Containers::Optional<ImageData3D> AbstractImporter::image3D(const UnsignedInt id) { Containers::Optional<ImageData3D> AbstractImporter::image3D(const UnsignedInt id) {
CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image3D(): no file opened", {}); CORRADE_ASSERT(isOpened(), "Trade::AbstractImporter::image3D(): no file opened", {});
CORRADE_ASSERT(id < doImage3DCount(), "Trade::AbstractImporter::image3D(): index out of range", {}); CORRADE_ASSERT(id < doImage3DCount(), "Trade::AbstractImporter::image3D(): index" << id << "out of range for" << doImage3DCount() << "entries", {});
return doImage3D(id); return doImage3D(id);
} }

156
src/Magnum/Trade/Test/AbstractImporterTest.cpp

@ -1069,13 +1069,15 @@ void AbstractImporterTest::sceneNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doSceneCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.sceneName(0); importer.sceneName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::sceneName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::sceneName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::sceneNotImplemented() { void AbstractImporterTest::sceneNotImplemented() {
@ -1113,13 +1115,15 @@ void AbstractImporterTest::sceneOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doSceneCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.scene(0); importer.scene(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::scene(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::scene(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::animation() { void AbstractImporterTest::animation() {
@ -1234,13 +1238,15 @@ void AbstractImporterTest::animationNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doAnimationCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.animationName(0); importer.animationName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animationName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animationName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::animationNotImplemented() { void AbstractImporterTest::animationNotImplemented() {
@ -1278,13 +1284,15 @@ void AbstractImporterTest::animationOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doAnimationCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.animation(0); importer.animation(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animation(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::animation(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::light() { void AbstractImporterTest::light() {
@ -1399,13 +1407,15 @@ void AbstractImporterTest::lightNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doLightCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.lightName(0); importer.lightName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::lightName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::lightName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::lightNotImplemented() { void AbstractImporterTest::lightNotImplemented() {
@ -1443,13 +1453,15 @@ void AbstractImporterTest::lightOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doLightCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.light(0); importer.light(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::light(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::light(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::camera() { void AbstractImporterTest::camera() {
@ -1564,13 +1576,15 @@ void AbstractImporterTest::cameraNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doCameraCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.cameraName(0); importer.cameraName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::cameraName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::cameraName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::cameraNotImplemented() { void AbstractImporterTest::cameraNotImplemented() {
@ -1608,13 +1622,15 @@ void AbstractImporterTest::cameraOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doCameraCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.camera(0); importer.camera(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::camera(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::camera(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::object2D() { void AbstractImporterTest::object2D() {
@ -1729,13 +1745,15 @@ void AbstractImporterTest::object2DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doObject2DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.object2DName(0); importer.object2DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::object2DNotImplemented() { void AbstractImporterTest::object2DNotImplemented() {
@ -1773,13 +1791,15 @@ void AbstractImporterTest::object2DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doObject2DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.object2D(0); importer.object2D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object2D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::object3D() { void AbstractImporterTest::object3D() {
@ -1894,13 +1914,15 @@ void AbstractImporterTest::object3DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doObject3DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.object3DName(0); importer.object3DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::object3DNotImplemented() { void AbstractImporterTest::object3DNotImplemented() {
@ -1938,13 +1960,15 @@ void AbstractImporterTest::object3DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doObject3DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.object3D(0); importer.object3D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::object3D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::mesh2D() { void AbstractImporterTest::mesh2D() {
@ -2059,13 +2083,15 @@ void AbstractImporterTest::mesh2DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doMesh2DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.mesh2DName(0); importer.mesh2DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::mesh2DNotImplemented() { void AbstractImporterTest::mesh2DNotImplemented() {
@ -2103,13 +2129,15 @@ void AbstractImporterTest::mesh2DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doMesh2DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.mesh2D(0); importer.mesh2D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh2D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::mesh3D() { void AbstractImporterTest::mesh3D() {
@ -2224,13 +2252,15 @@ void AbstractImporterTest::mesh3DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doMesh3DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.mesh3DName(0); importer.mesh3DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::mesh3DNotImplemented() { void AbstractImporterTest::mesh3DNotImplemented() {
@ -2268,13 +2298,15 @@ void AbstractImporterTest::mesh3DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doMesh3DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.mesh3D(0); importer.mesh3D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::mesh3D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::material() { void AbstractImporterTest::material() {
@ -2389,13 +2421,15 @@ void AbstractImporterTest::materialNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doMaterialCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.materialName(0); importer.materialName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::materialName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::materialName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::materialNotImplemented() { void AbstractImporterTest::materialNotImplemented() {
@ -2433,13 +2467,15 @@ void AbstractImporterTest::materialOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doMaterialCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.material(0); importer.material(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::material(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::material(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::texture() { void AbstractImporterTest::texture() {
@ -2554,13 +2590,15 @@ void AbstractImporterTest::textureNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doTextureCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.textureName(0); importer.textureName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::textureName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::textureName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::textureNotImplemented() { void AbstractImporterTest::textureNotImplemented() {
@ -2598,13 +2636,15 @@ void AbstractImporterTest::textureOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doTextureCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.texture(0); importer.texture(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::texture(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::texture(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::image1D() { void AbstractImporterTest::image1D() {
@ -2716,13 +2756,15 @@ void AbstractImporterTest::image1DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doImage1DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.image1DName(0); importer.image1DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::image1DNotImplemented() { void AbstractImporterTest::image1DNotImplemented() {
@ -2760,13 +2802,15 @@ void AbstractImporterTest::image1DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doImage1DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.image1D(0); importer.image1D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image1D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::image2D() { void AbstractImporterTest::image2D() {
@ -2878,13 +2922,15 @@ void AbstractImporterTest::image2DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doImage2DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.image2DName(0); importer.image2DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::image2DNotImplemented() { void AbstractImporterTest::image2DNotImplemented() {
@ -2922,13 +2968,15 @@ void AbstractImporterTest::image2DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doImage2DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.image2D(0); importer.image2D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image2D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::image3D() { void AbstractImporterTest::image3D() {
@ -3040,13 +3088,15 @@ void AbstractImporterTest::image3DNameOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doImage3DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.image3DName(0); importer.image3DName(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3DName(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3DName(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::image3DNotImplemented() { void AbstractImporterTest::image3DNotImplemented() {
@ -3084,13 +3134,15 @@ void AbstractImporterTest::image3DOutOfRange() {
Features doFeatures() const override { return {}; } Features doFeatures() const override { return {}; }
bool doIsOpened() const override { return true; } bool doIsOpened() const override { return true; }
void doClose() override {} void doClose() override {}
UnsignedInt doImage3DCount() const override { return 8; }
} importer; } importer;
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
importer.image3D(0); importer.image3D(8);
CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3D(): index out of range\n"); CORRADE_COMPARE(out.str(), "Trade::AbstractImporter::image3D(): index 8 out of range for 8 entries\n");
} }
void AbstractImporterTest::importerState() { void AbstractImporterTest::importerState() {

Loading…
Cancel
Save