Browse Source

Merge pull request #1090 from assimp/new_unittests

New tests for importers.
Kim Kulling 8 years ago
parent
commit
eefb812316

+ 4 - 12
include/assimp/Importer.hpp

@@ -193,7 +193,6 @@ public:
      */
      */
     aiReturn UnregisterPPStep(BaseProcess* pImp);
     aiReturn UnregisterPPStep(BaseProcess* pImp);
 
 
-
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Set an integer configuration property.
     /** Set an integer configuration property.
      * @param szName Name of the property. All supported properties
      * @param szName Name of the property. All supported properties
@@ -292,10 +291,10 @@ public:
 
 
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Supplies a custom IO handler to the importer to use to open and
     /** Supplies a custom IO handler to the importer to use to open and
-     * access files. If you need the importer to use custion IO logic to
+     * access files. If you need the importer to use custom IO logic to
      * access the files, you need to provide a custom implementation of
      * access the files, you need to provide a custom implementation of
      * IOSystem and IOFile to the importer. Then create an instance of
      * IOSystem and IOFile to the importer. Then create an instance of
-     * your custion IOSystem implementation and supply it by this function.
+     * your custom IOSystem implementation and supply it by this function.
      *
      *
      * The Importer takes ownership of the object and will destroy it
      * The Importer takes ownership of the object and will destroy it
      * afterwards. The previously assigned handler will be deleted.
      * afterwards. The previously assigned handler will be deleted.
@@ -357,7 +356,7 @@ public:
     bool IsDefaultProgressHandler() const;
     bool IsDefaultProgressHandler() const;
 
 
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
-    /** @brief Check whether a given set of postprocessing flags
+    /** @brief Check whether a given set of post-processing flags
      *  is supported.
      *  is supported.
      *
      *
      *  Some flags are mutually exclusive, others are probably
      *  Some flags are mutually exclusive, others are probably
@@ -517,9 +516,6 @@ public:
      *   It will work as well for static linkage with Assimp.*/
      *   It will work as well for static linkage with Assimp.*/
     aiScene* GetOrphanedScene();
     aiScene* GetOrphanedScene();
 
 
-
-
-
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Returns whether a given file extension is supported by ASSIMP.
     /** Returns whether a given file extension is supported by ASSIMP.
      *
      *
@@ -558,7 +554,7 @@ public:
     inline void GetExtensionList(std::string& szOut) const;
     inline void GetExtensionList(std::string& szOut) const;
 
 
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
-    /** Get the number of importrs currently registered with Assimp. */
+    /** Get the number of importers currently registered with Assimp. */
     size_t GetImporterCount() const;
     size_t GetImporterCount() const;
 
 
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
@@ -601,9 +597,6 @@ public:
     *  @return (size_t)-1 if no importer is found */
     *  @return (size_t)-1 if no importer is found */
     size_t GetImporterIndex (const char* szExtension) const;
     size_t GetImporterIndex (const char* szExtension) const;
 
 
-
-
-
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Returns the storage allocated by ASSIMP to hold the scene data
     /** Returns the storage allocated by ASSIMP to hold the scene data
      * in memory.
      * in memory.
@@ -624,7 +617,6 @@ public:
      * intended for use in production environments. */
      * intended for use in production environments. */
     void SetExtraVerbose(bool bDo);
     void SetExtraVerbose(bool bDo);
 
 
-
     // -------------------------------------------------------------------
     // -------------------------------------------------------------------
     /** Private, do not use. */
     /** Private, do not use. */
     ImporterPimpl* Pimpl() { return pimpl; }
     ImporterPimpl* Pimpl() { return pimpl; }

+ 2 - 0
test/CMakeLists.txt

@@ -55,6 +55,7 @@ SOURCE_GROUP( unit FILES
 )
 )
 
 
 SET( TEST_SRCS
 SET( TEST_SRCS
+  unit/AbstractImportExportBase.cpp
   unit/TestIOSystem.h
   unit/TestIOSystem.h
   unit/TestModelFactory.h
   unit/TestModelFactory.h
   unit/utAnim.cpp
   unit/utAnim.cpp
@@ -101,6 +102,7 @@ SET( TEST_SRCS
   unit/utTypes.cpp
   unit/utTypes.cpp
   unit/utVertexTriangleAdjacency.cpp
   unit/utVertexTriangleAdjacency.cpp
   unit/utVersion.cpp
   unit/utVersion.cpp
+  unit/utXImporterExporter.cpp
 )
 )
 
 
 SOURCE_GROUP( tests FILES  ${TEST_SRCS} )
 SOURCE_GROUP( tests FILES  ${TEST_SRCS} )

+ 47 - 0
test/unit/AbstractImportExportBase.cpp

@@ -0,0 +1,47 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2016, assimp team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
+#include "AbstractImportExportBase.h"
+
+using namespace ::Assimp;
+
+AbstractImportExportBase::~AbstractImportExportBase() {
+        // empty
+}

+ 49 - 0
test/unit/AbstractImportExportBase.h

@@ -0,0 +1,49 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2016, assimp team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
+#pragma once
+
+#include "UnitTestPCH.h"
+
+class AbstractImportExportBase : public ::testing::Test {
+public:
+    virtual ~AbstractImportExportBase();
+    virtual bool importerTest() = 0;
+};

+ 85 - 81
test/unit/SceneDiffer.cpp

@@ -44,9 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <assimp/material.h>
 #include <assimp/material.h>
 #include <sstream>
 #include <sstream>
 
 
-using namespace Assimp;
+namespace Assimp {
 
 
-SceneDiffer::SceneDiffer() {
+SceneDiffer::SceneDiffer() 
+: m_diffs() {
     // empty
     // empty
 }
 }
 
 
@@ -94,14 +95,14 @@ bool SceneDiffer::isEqual( const aiScene *expected, const aiScene *toCompare ) {
         addDiff( stream.str() );
         addDiff( stream.str() );
         return false;
         return false;
     }
     }
-    
+
     if ( expected->mNumMaterials > 0 ) {
     if ( expected->mNumMaterials > 0 ) {
         if ( nullptr == expected->mMaterials || nullptr == toCompare->mMaterials ) {
         if ( nullptr == expected->mMaterials || nullptr == toCompare->mMaterials ) {
             addDiff( "Number of materials > 0 and mat pointer is nullptr" );
             addDiff( "Number of materials > 0 and mat pointer is nullptr" );
             return false;
             return false;
         }
         }
     }
     }
-    
+
     for ( unsigned int i = 0; i < expected->mNumMaterials; i++ ) {
     for ( unsigned int i = 0; i < expected->mNumMaterials; i++ ) {
         aiMaterial *expectedMat( expected->mMaterials[ i ] );
         aiMaterial *expectedMat( expected->mMaterials[ i ] );
         aiMaterial *toCompareMat( expected->mMaterials[ i ] );
         aiMaterial *toCompareMat( expected->mMaterials[ i ] );
@@ -119,7 +120,7 @@ void SceneDiffer::showReport() {
     if ( m_diffs.empty() ) {
     if ( m_diffs.empty() ) {
         return;
         return;
     }
     }
-    
+
     for ( std::vector<std::string>::iterator it = m_diffs.begin(); it != m_diffs.end(); it++ ) {
     for ( std::vector<std::string>::iterator it = m_diffs.begin(); it != m_diffs.end(); it++ ) {
         std::cout << *it << "\n";
         std::cout << *it << "\n";
     }
     }
@@ -156,7 +157,8 @@ static std::string dumpFace( const aiFace &face ) {
         stream << face.mIndices[ i ];
         stream << face.mIndices[ i ];
         if ( i < face.mNumIndices - 1 ) {
         if ( i < face.mNumIndices - 1 ) {
             stream << ", ";
             stream << ", ";
-        } else {
+        }
+        else {
             stream << "\n";
             stream << "\n";
         }
         }
     }
     }
@@ -213,98 +215,98 @@ bool SceneDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) {
         return false;
         return false;
     }
     }
 
 
-//    return true;
-    
-    //ToDo!
-    bool normalEqual( true );
-/*    for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
-        aiVector3D &expNormal( expected->mNormals[ i ] );
-        aiVector3D &toCompNormal( toCompare->mNormals[ i ] );
-        if ( expNormal.Equal( toCompNormal ) ) {
-            std::stringstream stream;
-            stream << "Normal not equal ( expected: " << dumpVector3( expNormal ) << ", found: " << dumpVector3( toCompNormal ) << "\n";
-            addDiff( stream.str() );
-            normalEqual = false;
-        }
-    }
-    if ( !normalEqual ) {
-        return false;
-    }
+    //    return true;
 
 
-    // vertex colors
-    bool vertColEqual( true );
-    for ( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++ ) {
-        if ( expected->HasVertexColors(a) != toCompare->HasVertexColors(a) ) {
-            addDiff( "Expected are normals, toCompare does not have any." );
-            return false;
-        }
-        for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
-            aiColor4D &expColor4D( expected->mColors[ a ][ i ] );
-            aiColor4D &toCompColor4D( toCompare->mColors[ a ][ i ] );
-            if ( expColor4D != toCompColor4D ) {
+        //ToDo!
+    bool normalEqual( true );
+    /*    for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
+            aiVector3D &expNormal( expected->mNormals[ i ] );
+            aiVector3D &toCompNormal( toCompare->mNormals[ i ] );
+            if ( expNormal.Equal( toCompNormal ) ) {
                 std::stringstream stream;
                 std::stringstream stream;
-                stream << "Color4D not equal ( expected: " << dumpColor4D( expColor4D ) << ", found: " << dumpColor4D( toCompColor4D ) << "\n";
+                stream << "Normal not equal ( expected: " << dumpVector3( expNormal ) << ", found: " << dumpVector3( toCompNormal ) << "\n";
                 addDiff( stream.str() );
                 addDiff( stream.str() );
-                vertColEqual = false;
+                normalEqual = false;
             }
             }
         }
         }
-        if ( !vertColEqual ) {
+        if ( !normalEqual ) {
             return false;
             return false;
         }
         }
-    }
 
 
-    // texture coords
-    bool texCoordsEqual( true );
-    for ( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++ ) {
-        if ( expected->HasTextureCoords( a ) != toCompare->HasTextureCoords( a ) ) {
-            addDiff( "Expected are texture coords, toCompare does not have any." );
+        // vertex colors
+        bool vertColEqual( true );
+        for ( unsigned int a = 0; a < AI_MAX_NUMBER_OF_COLOR_SETS; a++ ) {
+            if ( expected->HasVertexColors(a) != toCompare->HasVertexColors(a) ) {
+                addDiff( "Expected are normals, toCompare does not have any." );
+                return false;
+            }
+            for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
+                aiColor4D &expColor4D( expected->mColors[ a ][ i ] );
+                aiColor4D &toCompColor4D( toCompare->mColors[ a ][ i ] );
+                if ( expColor4D != toCompColor4D ) {
+                    std::stringstream stream;
+                    stream << "Color4D not equal ( expected: " << dumpColor4D( expColor4D ) << ", found: " << dumpColor4D( toCompColor4D ) << "\n";
+                    addDiff( stream.str() );
+                    vertColEqual = false;
+                }
+            }
+            if ( !vertColEqual ) {
+                return false;
+            }
+        }
+
+        // texture coords
+        bool texCoordsEqual( true );
+        for ( unsigned int a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; a++ ) {
+            if ( expected->HasTextureCoords( a ) != toCompare->HasTextureCoords( a ) ) {
+                addDiff( "Expected are texture coords, toCompare does not have any." );
+                return false;
+            }
+            for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
+                aiVector3D &expTexCoord( expected->mTextureCoords[ a ][ i ] );
+                aiVector3D &toCompTexCoord( toCompare->mTextureCoords[ a ][ i ] );
+                if ( expTexCoord.Equal( toCompTexCoord ) ) {
+                    std::stringstream stream;
+                    stream << "Texture coords not equal ( expected: " << dumpVector3( expTexCoord ) << ", found: " << dumpVector3( toCompTexCoord ) << "\n";
+                    addDiff( stream.str() );
+                    vertColEqual = false;
+                }
+            }
+            if ( !vertColEqual ) {
+                return false;
+            }
+        }
+
+        // tangents and bi-tangents
+        if ( expected->HasTangentsAndBitangents() != toCompare->HasTangentsAndBitangents() ) {
+            addDiff( "Expected are tangents and bi-tangents, toCompare does not have any." );
             return false;
             return false;
         }
         }
+        bool tangentsEqual( true );
         for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
         for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
-            aiVector3D &expTexCoord( expected->mTextureCoords[ a ][ i ] );
-            aiVector3D &toCompTexCoord( toCompare->mTextureCoords[ a ][ i ] );
-            if ( expTexCoord.Equal( toCompTexCoord ) ) {
+            aiVector3D &expTangents( expected->mTangents[ i ] );
+            aiVector3D &toCompTangents( toCompare->mTangents[ i ] );
+            if ( expTangents.Equal( toCompTangents ) ) {
                 std::stringstream stream;
                 std::stringstream stream;
-                stream << "Texture coords not equal ( expected: " << dumpVector3( expTexCoord ) << ", found: " << dumpVector3( toCompTexCoord ) << "\n";
+                stream << "Tangents not equal ( expected: " << dumpVector3( expTangents ) << ", found: " << dumpVector3( toCompTangents ) << "\n";
                 addDiff( stream.str() );
                 addDiff( stream.str() );
-                vertColEqual = false;
+                tangentsEqual = false;
             }
             }
-        }
-        if ( !vertColEqual ) {
-            return false;
-        }
-    }
 
 
-    // tangents and bi-tangents
-    if ( expected->HasTangentsAndBitangents() != toCompare->HasTangentsAndBitangents() ) {
-        addDiff( "Expected are tangents and bi-tangents, toCompare does not have any." );
-        return false;
-    }
-    bool tangentsEqual( true );
-    for ( unsigned int i = 0; i < expected->mNumVertices; i++ ) {
-        aiVector3D &expTangents( expected->mTangents[ i ] );
-        aiVector3D &toCompTangents( toCompare->mTangents[ i ] );
-        if ( expTangents.Equal( toCompTangents ) ) {
-            std::stringstream stream;
-            stream << "Tangents not equal ( expected: " << dumpVector3( expTangents ) << ", found: " << dumpVector3( toCompTangents ) << "\n";
-            addDiff( stream.str() );
-            tangentsEqual = false;
-        }
-
-        aiVector3D &expBiTangents( expected->mBitangents[ i ] );
-        aiVector3D &toCompBiTangents( toCompare->mBitangents[ i ] );
-        if ( expBiTangents.Equal( toCompBiTangents ) ) {
-            std::stringstream stream;
-            stream << "Tangents not equal ( expected: " << dumpVector3( expBiTangents ) << ", found: " << dumpVector3( toCompBiTangents ) << " )\n";
-            addDiff( stream.str() );
-            tangentsEqual = false;
+            aiVector3D &expBiTangents( expected->mBitangents[ i ] );
+            aiVector3D &toCompBiTangents( toCompare->mBitangents[ i ] );
+            if ( expBiTangents.Equal( toCompBiTangents ) ) {
+                std::stringstream stream;
+                stream << "Tangents not equal ( expected: " << dumpVector3( expBiTangents ) << ", found: " << dumpVector3( toCompBiTangents ) << " )\n";
+                addDiff( stream.str() );
+                tangentsEqual = false;
+            }
         }
         }
-    }
-    if ( !tangentsEqual ) {
-        return false;
-    }*/
+        if ( !tangentsEqual ) {
+            return false;
+        }*/
 
 
-    // faces
+        // faces
     if ( expected->mNumFaces != toCompare->mNumFaces ) {
     if ( expected->mNumFaces != toCompare->mNumFaces ) {
         std::stringstream stream;
         std::stringstream stream;
         stream << "Number of faces are not equal, ( expected: " << expected->mNumFaces << ", found: " << toCompare->mNumFaces << ")\n";
         stream << "Number of faces are not equal, ( expected: " << expected->mNumFaces << ", found: " << toCompare->mNumFaces << ")\n";
@@ -367,3 +369,5 @@ bool SceneDiffer::compareMaterial( aiMaterial *expected, aiMaterial *toCompare )
 
 
     return true;
     return true;
 }
 }
+
+}

+ 4 - 0
test/unit/SceneDiffer.h

@@ -50,6 +50,8 @@ struct aiMesh;
 struct aiMaterial;
 struct aiMaterial;
 struct aiFace;
 struct aiFace;
 
 
+namespace Assimp {
+
 class SceneDiffer {
 class SceneDiffer {
 public:
 public:
     SceneDiffer();
     SceneDiffer();
@@ -67,3 +69,5 @@ protected:
 private:
 private:
     std::vector<std::string> m_diffs;
     std::vector<std::string> m_diffs;
 };
 };
+
+} 

+ 40 - 0
test/unit/TestIOSystem.h

@@ -1,3 +1,43 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2016, assimp team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
 #pragma once
 #pragma once
 
 
 #include "UnitTestPCH.h"
 #include "UnitTestPCH.h"

+ 40 - 0
test/unit/TestModelFactory.h

@@ -1,3 +1,43 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2016, assimp team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
 #pragma once
 #pragma once
 
 
 #include "UnitTestPCH.h"
 #include "UnitTestPCH.h"

+ 13 - 1
test/unit/utObjImportExport.cpp

@@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 #include "UnitTestPCH.h"
 #include "UnitTestPCH.h"
 #include "SceneDiffer.h"
 #include "SceneDiffer.h"
+#include "AbstractImportExportBase.h"
 
 
 #include <assimp/Importer.hpp>
 #include <assimp/Importer.hpp>
 #include <assimp/scene.h>
 #include <assimp/scene.h>
@@ -100,7 +101,7 @@ static const std::string ObjModel =
     "\n"
     "\n"
     "# End of file\n";
     "# End of file\n";
 
 
-class utObjImportExport : public ::testing::Test {
+class utObjImportExport : public AbstractImportExportBase {
 protected:
 protected:
     virtual void SetUp() {
     virtual void SetUp() {
         m_im = new Assimp::Importer;
         m_im = new Assimp::Importer;
@@ -173,11 +174,22 @@ protected:
         return expScene;
         return expScene;
     }
     }
 
 
+    virtual bool importerTest() {
+        Assimp::Importer importer;
+        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", 0 );
+        return nullptr != scene;
+    }
+
+
 protected:
 protected:
     Assimp::Importer *m_im;
     Assimp::Importer *m_im;
     aiScene *m_expectedScene;
     aiScene *m_expectedScene;
 };
 };
 
 
+TEST_F( utObjImportExport, importObjFromFileTest ) {
+    EXPECT_TRUE( importerTest() );
+}
+
 TEST_F( utObjImportExport, obj_import_test ) {
 TEST_F( utObjImportExport, obj_import_test ) {
     const aiScene *scene = m_im->ReadFileFromMemory( (void*) ObjModel.c_str(), ObjModel.size(), 0 );
     const aiScene *scene = m_im->ReadFileFromMemory( (void*) ObjModel.c_str(), ObjModel.size(), 0 );
     aiScene *expected = createScene();
     aiScene *expected = createScene();

+ 9 - 6
test/unit/utSIBImporter.cpp

@@ -42,11 +42,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 #include "SIBImporter.h"
 #include "SIBImporter.h"
 #include <assimp/Importer.hpp>
 #include <assimp/Importer.hpp>
+#include "AbstractImportExportBase.h"
 
 
 using namespace ::Assimp;
 using namespace ::Assimp;
 
 
-class utSIBImporter : public ::testing::Test {
-    // empty
+class utSIBImporter : public AbstractImportExportBase {
+public:
+    virtual bool importerTest() {
+        Assimp::Importer importer;
+        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SIB/heffalump.sib", 0 );
+        return nullptr != scene;
+    }
 };
 };
 
 
 TEST_F( utSIBImporter, createTest ) {
 TEST_F( utSIBImporter, createTest ) {
@@ -60,8 +66,5 @@ TEST_F( utSIBImporter, createTest ) {
 }
 }
 
 
 TEST_F( utSIBImporter, importTest ) {
 TEST_F( utSIBImporter, importTest ) {
-    Assimp::Importer importer;
-
-    const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/SIB/heffalump.sib", 0 );
-    EXPECT_NE( nullptr, scene );
+    EXPECT_TRUE( importerTest() );
 }
 }

+ 61 - 0
test/unit/utXImporterExporter.cpp

@@ -0,0 +1,61 @@
+/*
+---------------------------------------------------------------------------
+Open Asset Import Library (assimp)
+---------------------------------------------------------------------------
+
+Copyright (c) 2006-2016, assimp team
+
+All rights reserved.
+
+Redistribution and use of this software in source and binary forms,
+with or without modification, are permitted provided that the following
+conditions are met:
+
+* Redistributions of source code must retain the above
+copyright notice, this list of conditions and the
+following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the
+following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+* Neither the name of the assimp team, nor the names of its
+contributors may be used to endorse or promote products
+derived from this software without specific prior
+written permission of the assimp team.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+---------------------------------------------------------------------------
+*/
+
+#include "UnitTestPCH.h"
+#include "SceneDiffer.h"
+#include "AbstractImportExportBase.h"
+
+#include <assimp/Importer.hpp>
+
+using namespace Assimp;
+
+class utXImporterExporter : public AbstractImportExportBase {
+public:
+    virtual bool importerTest() {
+        Assimp::Importer importer;
+        const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/X/test.x", 0 );
+        return nullptr != scene;
+    }
+};
+
+TEST_F( utXImporterExporter, importXFromFileTest ) {
+    EXPECT_TRUE( importerTest() );
+}