From 08169a693430011408ecdf5c00358e841ffb3a20 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 30 Jun 2015 07:26:58 -0600 Subject: [PATCH] Fixed: Use CMake to identify directory containing test models --- test/CMakeLists.txt | 2 ++ test/unit/utColladaExportCamera.cpp | 2 +- test/unit/utColladaExportLight.cpp | 2 +- test/unit/utExport.cpp | 2 +- test/unit/utImporter.cpp | 16 ++++++++-------- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4bd3ff9c6..a93bcf91f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -54,6 +54,8 @@ add_executable( unit ${TEST_SRCS} ) +add_definitions(-DASSIMP_TEST_MODELS_DIR="${CMAKE_CURRENT_LIST_DIR}/models") + SET_PROPERTY( TARGET assimp PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} ) add_dependencies( unit gtest ) diff --git a/test/unit/utColladaExportCamera.cpp b/test/unit/utColladaExportCamera.cpp index 0ebdb0163..8735c626e 100644 --- a/test/unit/utColladaExportCamera.cpp +++ b/test/unit/utColladaExportCamera.cpp @@ -43,7 +43,7 @@ TEST_F(ColladaExportCamera, testExportCamera) { const char* file = "cameraExp.dae"; - const aiScene* pTest = im->ReadFile("../test/models/Collada/cameras.dae",0); + const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/cameras.dae",0); ASSERT_TRUE(pTest!=NULL); ASSERT_TRUE(pTest->HasCameras()); diff --git a/test/unit/utColladaExportLight.cpp b/test/unit/utColladaExportLight.cpp index bac35954c..ee17b77e0 100644 --- a/test/unit/utColladaExportLight.cpp +++ b/test/unit/utColladaExportLight.cpp @@ -43,7 +43,7 @@ TEST_F(ColladaExportLight, testExportLight) { const char* file = "cameraExp.dae"; - const aiScene* pTest = im->ReadFile("../test/models/Collada/lights.dae",0); + const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/lights.dae",0); ASSERT_TRUE(pTest!=NULL); ASSERT_TRUE(pTest->HasLights()); diff --git a/test/unit/utExport.cpp b/test/unit/utExport.cpp index ac2a081fc..f34429338 100644 --- a/test/unit/utExport.cpp +++ b/test/unit/utExport.cpp @@ -14,7 +14,7 @@ public: ex = new Assimp::Exporter(); im = new Assimp::Importer(); - pTest = im->ReadFile("../../test/models/X/test.x",0); + pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test.x",0); } virtual void TearDown() diff --git a/test/unit/utImporter.cpp b/test/unit/utImporter.cpp index d6090fafe..0b300b9b4 100644 --- a/test/unit/utImporter.cpp +++ b/test/unit/utImporter.cpp @@ -219,13 +219,13 @@ TEST_F(ImporterTest, testMultipleReads) aiProcess_OptimizeMeshes | aiProcess_OptimizeGraph; - EXPECT_TRUE(pImp->ReadFile("../test/models/X/test.x",flags)); - //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd - EXPECT_TRUE(pImp->ReadFile("../test/models/X/Testwuson.X",flags)); - EXPECT_TRUE(pImp->ReadFile("../test/models/X/anim_test.x",flags)); - //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd + EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/test.x",flags)); + //EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/dwarf.x",flags)); # is in nonbsd + EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/Testwuson.X",flags)); + EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/anim_test.x",flags)); + //EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/dwarf.x",flags)); # is in nonbsd - EXPECT_TRUE(pImp->ReadFile("../test/models/X/anim_test.x",flags)); - EXPECT_TRUE(pImp->ReadFile("../test/models/X/BCN_Epileptic.X",flags)); - //EXPECT_TRUE(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd + EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/anim_test.x",flags)); + EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/BCN_Epileptic.X",flags)); + //EXPECT_TRUE(pImp->ReadFile(ASSIMP_TEST_MODELS_DIR "/X/dwarf.x",flags)); # is in nonbsd }