Revert back test, because the new one revealed an undefined behavior error.

pull/4044/head
kovacsv 2021-08-24 09:09:35 +02:00
parent 0590a39159
commit 37ba067839
1 changed files with 24 additions and 22 deletions

View File

@ -43,39 +43,41 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "AbstractImportExportBase.h" #include "AbstractImportExportBase.h"
#include "UnitTestPCH.h" #include "UnitTestPCH.h"
#include <assimp/Importer.hpp>
#include <assimp/Exporter.hpp>
#include <assimp/postprocess.h> #include <assimp/postprocess.h>
#include <assimp/Exporter.hpp>
#include <assimp/Importer.hpp> #include <assimp/Importer.hpp>
using namespace Assimp; using namespace Assimp;
TEST(utM3DImportExport, import_cube_normals) { class utM3DImportExport : public AbstractImportExportBase {
Assimp::Importer importer; public:
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/M3D/cube_normals.m3d", aiProcess_ValidateDataStructure); bool importerTest() override {
Assimp::Importer importer;
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/M3D/cube_normals.m3d", aiProcess_ValidateDataStructure);
#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER #ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
ASSERT_NE(nullptr, scene); return nullptr != scene;
#else #else
ASSERT_EQ(nullptr, scene); return nullptr == scene;
#endif // ASSIMP_BUILD_NO_M3D_IMPORTER #endif // ASSIMP_BUILD_NO_M3D_IMPORTER
} }
TEST(utM3DImportExport, import_cube_usemtl) { #ifndef ASSIMP_BUILD_NO_EXPORT
Assimp::Importer importer; bool exporterTest() override {
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/M3D/cube_usemtl.m3d", aiProcess_ValidateDataStructure); Assimp::Importer importer;
#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/M3D/cube_normals.m3d", aiProcess_ValidateDataStructure);
ASSERT_NE(nullptr, scene); Exporter exporter;
#else aiReturn ret = exporter.Export(scene, "m3d", ASSIMP_TEST_MODELS_DIR "/M3D/cube_normals_out.m3d");
ASSERT_EQ(nullptr, scene); return ret == AI_SUCCESS;
#endif // ASSIMP_BUILD_NO_M3D_IMPORTER }
#endif
};
TEST_F(utM3DImportExport, importM3DFromFileTest) {
EXPECT_TRUE(importerTest());
} }
#ifndef ASSIMP_BUILD_NO_EXPORT #ifndef ASSIMP_BUILD_NO_EXPORT
TEST(utM3DImportExport, export_cube_normals) { TEST_F(utM3DImportExport, exportM3DFromFileTest) {
Assimp::Importer importer; EXPECT_TRUE(exporterTest());
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/M3D/cube_normals.m3d", aiProcess_ValidateDataStructure);
Exporter exporter;
aiReturn ret = exporter.Export(scene, "m3d", ASSIMP_TEST_MODELS_DIR "/M3D/cube_normals_out.m3d");
ASSERT_EQ(AI_SUCCESS, ret);
} }
#endif // ASSIMP_BUILD_NO_EXPORT #endif // ASSIMP_BUILD_NO_EXPORT