Browse Source

Trade: AbstractImporter::importerState() expects a file to be opened.

The restriction was there always, but was undocumented and untested.
pull/454/head
Vladimír Vondruš 6 years ago
parent
commit
769e27340f
  1. 5
      src/Magnum/Trade/AbstractImporter.h
  2. 6
      src/Magnum/Trade/Test/AbstractImporterTest.cpp

5
src/Magnum/Trade/AbstractImporter.h

@ -280,8 +280,8 @@ checked by the implementation:
- The @ref doSetFileCallback() function is called only if
@ref ImporterFeature::FileCallback is supported and there is no file
opened.
- All `do*()` implementations working on an opened file are called only if
there is any file opened.
- All `do*()` implementations working on an opened file as well as
@ref doImporterState() are called only if there is any file opened.
- All `do*()` implementations taking data ID as parameter are called only if
the ID is from valid range.
- For @ref doMesh() and `doImage*()` and @p level parameter being nonzero,
@ -1280,6 +1280,7 @@ class MAGNUM_TRADE_EXPORT AbstractImporter: public PluginManager::AbstractManagi
* for currently opened document through this function. See
* documentation of a particular plugin for more information about
* returned type and contents. Returns @cpp nullptr @ce by default.
* Expects that a file is opened.
* @see @ref AbstractMaterialData::importerState(),
* @ref AnimationData::importerState(), @ref CameraData::importerState(),
* @ref ImageData::importerState(), @ref LightData::importerState(),

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

@ -1297,6 +1297,8 @@ void AbstractImporterTest::thingNoFile() {
importer.image3D(42);
importer.image3D("foo");
importer.importerState();
CORRADE_COMPARE(out.str(),
"Trade::AbstractImporter::defaultScene(): no file opened\n"
"Trade::AbstractImporter::scene(): no file opened\n"
@ -1325,7 +1327,9 @@ void AbstractImporterTest::thingNoFile() {
"Trade::AbstractImporter::image2D(): no file opened\n"
"Trade::AbstractImporter::image2D(): no file opened\n"
"Trade::AbstractImporter::image3D(): no file opened\n"
"Trade::AbstractImporter::image3D(): no file opened\n");
"Trade::AbstractImporter::image3D(): no file opened\n"
"Trade::AbstractImporter::importerState(): no file opened\n");
}
void AbstractImporterTest::defaultScene() {

Loading…
Cancel
Save