fix unittest folder for roundtriptest.

pull/1832/head
Kim Kulling 2018-03-13 21:40:23 +01:00
parent 20c817bc36
commit 4c023c3818
2 changed files with 9 additions and 13 deletions

View File

@ -100,26 +100,22 @@ IRRImporter::~IRRImporter()
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool IRRImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const bool IRRImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
{
/* NOTE: A simple check for the file extension is not enough
* here. Irrmesh and irr are easy, but xml is too generic
* and could be collada, too. So we need to open the file and
* search for typical tokens.
*/
const std::string extension = GetExtension(pFile); const std::string extension = GetExtension(pFile);
if ( extension == "irr" ) {
if (extension == "irr")return true; return true;
else if (extension == "xml" || checkSig) } else if (extension == "xml" || checkSig) {
{
/* If CanRead() is called in order to check whether we /* If CanRead() is called in order to check whether we
* support a specific file extension in general pIOHandler * support a specific file extension in general pIOHandler
* might be NULL and it's our duty to return true here. * might be NULL and it's our duty to return true here.
*/ */
if (!pIOHandler)return true; if ( nullptr == pIOHandler ) {
return true;
}
const char* tokens[] = {"irr_scene"}; const char* tokens[] = {"irr_scene"};
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1); return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
} }
return false; return false;
} }

View File

@ -90,7 +90,7 @@ TEST_F( utD3MFImporterExporter, roundtrip3MFtoMemTest ) {
EXPECT_TRUE( exporterTest() ); EXPECT_TRUE( exporterTest() );
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "test.3mf", 0 ); const aiScene *scene = importer.ReadFile( "test.3mf", 0 );
EXPECT_NE( nullptr, scene ); EXPECT_NE( nullptr, scene );
} }