diff --git a/test/integration/ModelPhotoShootTest.hh b/test/integration/ModelPhotoShootTest.hh index f5197b1ebd..4fe1f08aff 100644 --- a/test/integration/ModelPhotoShootTest.hh +++ b/test/integration/ModelPhotoShootTest.hh @@ -82,11 +82,10 @@ void SavePicture(const ignition::rendering::CameraPtr _camera, void testImages(const std::string &_imageFile, const std::string &_testImageFile) { - std::string imageFilePath = common::joinPaths( - std::string(PROJECT_BINARY_PATH), "test", "integration", _imageFile); + std::string imageFilePath = common::joinPaths(common::cwd(), _imageFile); ignition::common::Image image(imageFilePath); - std::string testImageFilePath = common::joinPaths( - std::string(PROJECT_BINARY_PATH), "test", "integration", _testImageFile); + std::string testImageFilePath = + common::joinPaths(common::cwd(), _testImageFile); ignition::common::Image testImage(testImageFilePath); EXPECT_TRUE(image.Valid()); @@ -111,6 +110,11 @@ void testImages(const std::string &_imageFile, /// \brief Test ModelPhotoShootTest system. class ModelPhotoShootTest : public InternalFixture<::testing::Test> { + protected: void SetUp() override + { + EXPECT_TRUE(common::chdir(test::UniqueTestDirectoryEnv::Path())); + InternalFixture<::testing::Test>::SetUp(); + } /// \brief PostRender callback. public: void OnPostRender() { @@ -168,8 +172,7 @@ class ModelPhotoShootTest : public InternalFixture<::testing::Test> /// \param[in] _poseFile File containing the generated poses. protected: void LoadPoseValues(std::string _poseFile = "poses.txt") { - std::string poseFilePath = common::joinPaths( - std::string(PROJECT_BINARY_PATH), "test", "integration", _poseFile); + std::string poseFilePath = common::joinPaths(common::cwd(), _poseFile); std::ifstream poseFile (poseFilePath); std::string line; ASSERT_TRUE(poseFile.is_open()); diff --git a/test/integration/model_photo_shoot_default_joints.cc b/test/integration/model_photo_shoot_default_joints.cc index 09f62e93d3..620bf42e8a 100644 --- a/test/integration/model_photo_shoot_default_joints.cc +++ b/test/integration/model_photo_shoot_default_joints.cc @@ -26,3 +26,11 @@ TEST_F(ModelPhotoShootTest, this->ModelPhotoShootTestCmd( "examples/worlds/model_photo_shoot.sdf"); } + +int main(int _argc, char **_argv) +{ + ::testing::InitGoogleTest(&_argc, _argv); + ::testing::AddGlobalTestEnvironment( + new test::UniqueTestDirectoryEnv("model_photo_shoot_test")); + return RUN_ALL_TESTS(); +} diff --git a/test/integration/model_photo_shoot_random_joints.cc b/test/integration/model_photo_shoot_random_joints.cc index 2559b0c889..21cabd9681 100644 --- a/test/integration/model_photo_shoot_random_joints.cc +++ b/test/integration/model_photo_shoot_random_joints.cc @@ -26,3 +26,11 @@ TEST_F(ModelPhotoShootTest, this->ModelPhotoShootTestCmd( "test/worlds/model_photo_shoot_random_joints.sdf"); } + +int main(int _argc, char **_argv) +{ + ::testing::InitGoogleTest(&_argc, _argv); + ::testing::AddGlobalTestEnvironment( + new test::UniqueTestDirectoryEnv("model_photo_shoot_test")); + return RUN_ALL_TESTS(); +}