Introduce simple export test for assbin.

pull/2128/head
Kim Kulling 2018-09-10 22:42:24 +02:00
parent c25a2dfc22
commit 081365df48
2 changed files with 17 additions and 6 deletions

View File

@ -188,13 +188,17 @@ aiQuatKey Read<aiQuatKey>(IOStream * stream)
} }
template <typename T> template <typename T>
void ReadArray(IOStream * stream, T * out, unsigned int size) void ReadArray( IOStream *stream, T * out, unsigned int size) {
{ ai_assert( nullptr != stream );
for (unsigned int i=0; i<size; i++) out[i] = Read<T>(stream); ai_assert( nullptr != out );
for (unsigned int i=0; i<size; i++) {
out[i] = Read<T>(stream);
}
} }
template <typename T> void ReadBounds( IOStream * stream, T* /*p*/, unsigned int n ) template <typename T>
{ void ReadBounds( IOStream * stream, T* /*p*/, unsigned int n ) {
// not sure what to do here, the data isn't really useful. // not sure what to do here, the data isn't really useful.
stream->Seek( sizeof(T) * n, aiOrigin_CUR ); stream->Seek( sizeof(T) * n, aiOrigin_CUR );
} }

View File

@ -54,6 +54,7 @@ public:
virtual bool importerTest() { virtual bool importerTest() {
Assimp::Importer importer; Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure ); const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure );
Exporter exporter; Exporter exporter;
EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "assbin", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_test.assbin" ) ); EXPECT_EQ( aiReturn_SUCCESS, exporter.Export( scene, "assbin", ASSIMP_TEST_MODELS_DIR "/OBJ/spider_test.assbin" ) );
const aiScene *newScene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider_test.assbin", aiProcess_ValidateDataStructure ); const aiScene *newScene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider_test.assbin", aiProcess_ValidateDataStructure );
@ -62,6 +63,12 @@ public:
} }
}; };
TEST_F( utAssbinImportExport, import3DFromFileTest ) { TEST_F( utAssbinImportExport, exportAssbin3DFromFileTest ) {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/OBJ/spider.obj", aiProcess_ValidateDataStructure );
EXPECT_NE( nullptr, scene );
}
TEST_F( utAssbinImportExport, import3ExportAssbinDFromFileTest ) {
EXPECT_TRUE( importerTest() ); EXPECT_TRUE( importerTest() );
} }