From 4ccbe60fc19e594e26ec31b188025823345d01a1 Mon Sep 17 00:00:00 2001
From: Antoine Regimbeau <antoine.regimbeau@c-s.fr>
Date: Mon, 5 Aug 2019 11:27:24 +0200
Subject: [PATCH] BUG: add application path to test

---
 Modules/Applications/AppMathParserX/test/CMakeLists.txt       | 1 +
 .../Applications/AppMathParserX/test/otbBandMathXAppTests.cxx | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Modules/Applications/AppMathParserX/test/CMakeLists.txt b/Modules/Applications/AppMathParserX/test/CMakeLists.txt
index d479651194..65e464ffec 100644
--- a/Modules/Applications/AppMathParserX/test/CMakeLists.txt
+++ b/Modules/Applications/AppMathParserX/test/CMakeLists.txt
@@ -29,5 +29,6 @@ target_link_libraries(OTBBandMathXAppTest ${OTBAppMathParserX-Test_LIBRARIES})
 otb_module_target_label(OTBBandMathXAppTest)
 
 otb_add_test(NAME apTvUtBandMathX COMMAND OTBBandMathXAppTest
+  $<TARGET_FILE_DIR:otbapp_BandMathX>
   ${INPUTDATA}/apTvUtExportBandMathX.txt
   )
\ No newline at end of file
diff --git a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
index d754ad4b81..b2d425fc06 100644
--- a/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
+++ b/Modules/Applications/AppMathParserX/test/otbBandMathXAppTests.cxx
@@ -69,6 +69,7 @@ int main(int , char * argv[] )
   VectorImageType::IndexType index;
   index.Fill(3); // Center of the images
   std::cout<<"Create application"<<std::endl;
+  otb::Wrapper::ApplicationRegistry::SetApplicationPath(argv[1]);
   auto app = otb::Wrapper::ApplicationRegistry::CreateApplication("BandMathX");
   app->AddImageToParameterInputImageList("il", img1);
   app->UpdateParameters();
@@ -113,8 +114,7 @@ int main(int , char * argv[] )
     return_val++;
   }
 
-  std::string context_path(argv[1]);
-  app->SetParameterString("incontext",argv[1]);
+  app->SetParameterString("incontext",argv[2]);
   // val is set in the context to 1
   app->UpdateParameters();
   desc = app->GetParameterDescription("exp");
-- 
GitLab