New tests for importers.
parent
c80777f13f
commit
edfb3fc410
|
@ -193,7 +193,6 @@ public:
|
|||
*/
|
||||
aiReturn UnregisterPPStep(BaseProcess* pImp);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Set an integer configuration property.
|
||||
* @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
|
||||
* 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
|
||||
* 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
|
||||
* afterwards. The previously assigned handler will be deleted.
|
||||
|
@ -357,7 +356,7 @@ public:
|
|||
bool IsDefaultProgressHandler() const;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Check whether a given set of postprocessing flags
|
||||
/** @brief Check whether a given set of post-processing flags
|
||||
* is supported.
|
||||
*
|
||||
* Some flags are mutually exclusive, others are probably
|
||||
|
@ -517,9 +516,6 @@ public:
|
|||
* It will work as well for static linkage with Assimp.*/
|
||||
aiScene* GetOrphanedScene();
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns whether a given file extension is supported by ASSIMP.
|
||||
*
|
||||
|
@ -558,7 +554,7 @@ public:
|
|||
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;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -601,9 +597,6 @@ public:
|
|||
* @return (size_t)-1 if no importer is found */
|
||||
size_t GetImporterIndex (const char* szExtension) const;
|
||||
|
||||
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Returns the storage allocated by ASSIMP to hold the scene data
|
||||
* in memory.
|
||||
|
@ -624,7 +617,6 @@ public:
|
|||
* intended for use in production environments. */
|
||||
void SetExtraVerbose(bool bDo);
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Private, do not use. */
|
||||
ImporterPimpl* Pimpl() { return pimpl; }
|
||||
|
|
|
@ -55,6 +55,7 @@ SOURCE_GROUP( unit FILES
|
|||
)
|
||||
|
||||
SET( TEST_SRCS
|
||||
unit/AbstractImportExportBase.cpp
|
||||
unit/TestIOSystem.h
|
||||
unit/TestModelFactory.h
|
||||
unit/utAnim.cpp
|
||||
|
@ -101,6 +102,7 @@ SET( TEST_SRCS
|
|||
unit/utTypes.cpp
|
||||
unit/utVertexTriangleAdjacency.cpp
|
||||
unit/utVersion.cpp
|
||||
unit/utXImporterExporter.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP( tests FILES ${TEST_SRCS} )
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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;
|
||||
};
|
|
@ -44,9 +44,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <assimp/material.h>
|
||||
#include <sstream>
|
||||
|
||||
using namespace Assimp;
|
||||
namespace Assimp {
|
||||
|
||||
SceneDiffer::SceneDiffer() {
|
||||
SceneDiffer::SceneDiffer()
|
||||
: m_diffs() {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
@ -94,14 +95,14 @@ bool SceneDiffer::isEqual( const aiScene *expected, const aiScene *toCompare ) {
|
|||
addDiff( stream.str() );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if ( expected->mNumMaterials > 0 ) {
|
||||
if ( nullptr == expected->mMaterials || nullptr == toCompare->mMaterials ) {
|
||||
addDiff( "Number of materials > 0 and mat pointer is nullptr" );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ( unsigned int i = 0; i < expected->mNumMaterials; i++ ) {
|
||||
aiMaterial *expectedMat( expected->mMaterials[ i ] );
|
||||
aiMaterial *toCompareMat( expected->mMaterials[ i ] );
|
||||
|
@ -119,7 +120,7 @@ void SceneDiffer::showReport() {
|
|||
if ( m_diffs.empty() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for ( std::vector<std::string>::iterator it = m_diffs.begin(); it != m_diffs.end(); it++ ) {
|
||||
std::cout << *it << "\n";
|
||||
}
|
||||
|
@ -156,7 +157,8 @@ static std::string dumpFace( const aiFace &face ) {
|
|||
stream << face.mIndices[ i ];
|
||||
if ( i < face.mNumIndices - 1 ) {
|
||||
stream << ", ";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
stream << "\n";
|
||||
}
|
||||
}
|
||||
|
@ -213,98 +215,98 @@ bool SceneDiffer::compareMesh( aiMesh *expected, aiMesh *toCompare ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// return true;
|
||||
|
||||
//ToDo!
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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 ) {
|
||||
/* 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 << "Color4D not equal ( expected: " << dumpColor4D( expColor4D ) << ", found: " << dumpColor4D( toCompColor4D ) << "\n";
|
||||
stream << "Normal not equal ( expected: " << dumpVector3( expNormal ) << ", found: " << dumpVector3( toCompNormal ) << "\n";
|
||||
addDiff( stream.str() );
|
||||
vertColEqual = false;
|
||||
normalEqual = false;
|
||||
}
|
||||
}
|
||||
if ( !vertColEqual ) {
|
||||
if ( !normalEqual ) {
|
||||
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;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
if ( !vertColEqual ) {
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
if ( !tangentsEqual ) {
|
||||
return 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;
|
||||
}*/
|
||||
|
||||
// faces
|
||||
// faces
|
||||
if ( expected->mNumFaces != toCompare->mNumFaces ) {
|
||||
std::stringstream stream;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
|
@ -50,6 +50,8 @@ struct aiMesh;
|
|||
struct aiMaterial;
|
||||
struct aiFace;
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
class SceneDiffer {
|
||||
public:
|
||||
SceneDiffer();
|
||||
|
@ -67,3 +69,5 @@ protected:
|
|||
private:
|
||||
std::vector<std::string> m_diffs;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
#include "UnitTestPCH.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
|
||||
|
||||
#include "UnitTestPCH.h"
|
||||
|
|
|
@ -41,6 +41,7 @@ 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>
|
||||
#include <assimp/scene.h>
|
||||
|
@ -100,7 +101,7 @@ static const std::string ObjModel =
|
|||
"\n"
|
||||
"# End of file\n";
|
||||
|
||||
class utObjImportExport : public ::testing::Test {
|
||||
class utObjImportExport : public AbstractImportExportBase {
|
||||
protected:
|
||||
virtual void SetUp() {
|
||||
m_im = new Assimp::Importer;
|
||||
|
@ -173,11 +174,22 @@ protected:
|
|||
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:
|
||||
Assimp::Importer *m_im;
|
||||
aiScene *m_expectedScene;
|
||||
};
|
||||
|
||||
TEST_F( utObjImportExport, importObjFromFileTest ) {
|
||||
EXPECT_TRUE( importerTest() );
|
||||
}
|
||||
|
||||
TEST_F( utObjImportExport, obj_import_test ) {
|
||||
const aiScene *scene = m_im->ReadFileFromMemory( (void*) ObjModel.c_str(), ObjModel.size(), 0 );
|
||||
aiScene *expected = createScene();
|
||||
|
|
|
@ -42,11 +42,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "SIBImporter.h"
|
||||
#include <assimp/Importer.hpp>
|
||||
#include "AbstractImportExportBase.h"
|
||||
|
||||
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 ) {
|
||||
|
@ -60,8 +66,5 @@ TEST_F( utSIBImporter, createTest ) {
|
|||
}
|
||||
|
||||
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() );
|
||||
}
|
||||
|
|
|
@ -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() );
|
||||
}
|
Loading…
Reference in New Issue