FBX: add test case
parent
189bb2a233
commit
cbd8b032e7
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
ply
|
ply
|
||||||
format ascii 1.0
|
format ascii 1.0
|
||||||
comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.4208963464)
|
comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.412856994)
|
||||||
element vertex 8
|
element vertex 8
|
||||||
property float x
|
property float x
|
||||||
property float y
|
property float y
|
||||||
|
|
|
@ -52,18 +52,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
class ColladaExportCamera : public ::testing::Test {
|
class ColladaExportCamera : public ::testing::Test {
|
||||||
public:
|
public:
|
||||||
|
void SetUp() override{
|
||||||
virtual void SetUp()
|
|
||||||
{
|
|
||||||
ex = new Assimp::Exporter();
|
ex = new Assimp::Exporter();
|
||||||
im = new Assimp::Importer();
|
im = new Assimp::Importer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void TearDown()
|
void TearDown() {
|
||||||
{
|
|
||||||
delete ex;
|
delete ex;
|
||||||
|
ex = nullptr;
|
||||||
delete im;
|
delete im;
|
||||||
|
im = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -71,16 +70,15 @@ protected:
|
||||||
Assimp::Importer* im;
|
Assimp::Importer* im;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(ColladaExportCamera, testExportCamera)
|
TEST_F(ColladaExportCamera, testExportCamera) {
|
||||||
{
|
|
||||||
const char* file = "cameraExp.dae";
|
const char* file = "cameraExp.dae";
|
||||||
|
|
||||||
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/cameras.dae", aiProcess_ValidateDataStructure);
|
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/cameras.dae", aiProcess_ValidateDataStructure);
|
||||||
ASSERT_TRUE(pTest!=NULL);
|
ASSERT_NE( nullptr, pTest );
|
||||||
ASSERT_TRUE(pTest->HasCameras());
|
ASSERT_TRUE(pTest->HasCameras());
|
||||||
|
|
||||||
|
|
||||||
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
EXPECT_EQ( AI_SUCCESS, ex->Export(pTest,"collada",file));
|
||||||
const unsigned int origNumCams( pTest->mNumCameras );
|
const unsigned int origNumCams( pTest->mNumCameras );
|
||||||
std::unique_ptr<float[]> origFOV( new float[ origNumCams ] );
|
std::unique_ptr<float[]> origFOV( new float[ origNumCams ] );
|
||||||
std::unique_ptr<float[]> orifClipPlaneNear( new float[ origNumCams ] );
|
std::unique_ptr<float[]> orifClipPlaneNear( new float[ origNumCams ] );
|
||||||
|
@ -89,7 +87,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
||||||
std::unique_ptr<aiVector3D[]> pos( new aiVector3D[ origNumCams ] );
|
std::unique_ptr<aiVector3D[]> pos( new aiVector3D[ origNumCams ] );
|
||||||
for (size_t i = 0; i < origNumCams; i++) {
|
for (size_t i = 0; i < origNumCams; i++) {
|
||||||
const aiCamera *orig = pTest->mCameras[ i ];
|
const aiCamera *orig = pTest->mCameras[ i ];
|
||||||
ASSERT_TRUE( orig != nullptr );
|
ASSERT_NE(nullptr, orig );
|
||||||
|
|
||||||
origFOV[ i ] = orig->mHorizontalFOV;
|
origFOV[ i ] = orig->mHorizontalFOV;
|
||||||
orifClipPlaneNear[ i ] = orig->mClipPlaneNear;
|
orifClipPlaneNear[ i ] = orig->mClipPlaneNear;
|
||||||
|
@ -99,7 +97,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
||||||
}
|
}
|
||||||
const aiScene* imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
const aiScene* imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
||||||
|
|
||||||
ASSERT_TRUE(imported!=NULL);
|
ASSERT_NE(nullptr, imported );
|
||||||
|
|
||||||
EXPECT_TRUE( imported->HasCameras() );
|
EXPECT_TRUE( imported->HasCameras() );
|
||||||
EXPECT_EQ( origNumCams, imported->mNumCameras );
|
EXPECT_EQ( origNumCams, imported->mNumCameras );
|
||||||
|
@ -119,5 +117,3 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -114,3 +114,18 @@ TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
|
||||||
scene->mMetaData->Get("UnitScaleFactor", factor);
|
scene->mMetaData->Get("UnitScaleFactor", factor);
|
||||||
EXPECT_DOUBLE_EQ(500.0, factor);
|
EXPECT_DOUBLE_EQ(500.0, factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
||||||
|
// see https://github.com/assimp/assimp/issues/1957
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box.FBX", aiProcess_ValidateDataStructure);
|
||||||
|
EXPECT_NE(nullptr, scene);
|
||||||
|
|
||||||
|
EXPECT_EQ(1, scene->mNumMaterials);
|
||||||
|
aiMaterial *mat = scene->mMaterials[0];
|
||||||
|
ASSERT_NE(nullptr, mat);
|
||||||
|
|
||||||
|
aiString path;
|
||||||
|
aiTextureMapMode modes[2];
|
||||||
|
EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue