From a11b71536d37d663f175732b418b1028ba9ac6e3 Mon Sep 17 00:00:00 2001
From: Antoine Regimbeau <antoine.regimbeau@c-s.fr>
Date: Thu, 23 Nov 2017 15:32:32 +0100
Subject: [PATCH] TEST: add test for contrast enhancment application

---
 .../app/otbContrastEnhancement.cxx            |  2 +-
 .../AppFiltering/test/CMakeLists.txt          | 50 +++++++++++++++++++
 .../test/otbCLHistogramEqualizationFilter.cxx |  2 +-
 3 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
index 75c3a93165..293eceb9ce 100644
--- a/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
+++ b/Modules/Applications/AppFiltering/app/otbContrastEnhancement.cxx
@@ -446,7 +446,7 @@ private:
     oss << "- spatial parameters : " << m_SpatialMode ;
     if ( m_SpatialMode == "local" )
       {
-      oss<< " with a thumbnail of " <<m_ThumbSize[0]<<"X"<<m_ThumbSize[1];
+      oss<< " with a thumbnail of " <<m_ThumbSize[0]<<" X "<<m_ThumbSize[1];
       }
     oss << std::endl << "- equalisation of ";
     if ( m_EqMode == "each" )
diff --git a/Modules/Applications/AppFiltering/test/CMakeLists.txt b/Modules/Applications/AppFiltering/test/CMakeLists.txt
index bdf1671b8c..f8195d22ce 100644
--- a/Modules/Applications/AppFiltering/test/CMakeLists.txt
+++ b/Modules/Applications/AppFiltering/test/CMakeLists.txt
@@ -51,6 +51,56 @@ otb_test_application(NAME  apTvUtSmoothingTest_OutXML
 
 #----------- Contrast TESTS ----------------
 
+otb_test_application(NAME  apTvUtContrastTest_base
+                     APP  ContrastEnhancement
+                     OPTIONS -in ${INPUTDATA}/QB_Suburb.png
+                             -out ${TEMP}/apTvUtContrastTest_base.tif int16
+                             -bins 256
+                             -spatial.local.h 51
+                             -spatial.local.w 67
+                     VALID   --compare-image ${NOTOL}
+                             ${BASELINE}/apTvUtContrastTest_base.tif
+                             ${TEMP}/apTvUtContrastTest_base.tif)
+
+otb_test_application(NAME  apTvUtContrastTest_base_glob
+                     APP  ContrastEnhancement
+                     OPTIONS -in ${INPUTDATA}/QB_Suburb.png
+                             -out ${TEMP}/apTvUtContrastTest_base_glob.tif int16
+                             -bins 256
+                             -spatial global
+                             -minmax manuel
+                             -minmax.manuel.min 0 
+                             -minmax.manuel.max 255
+                     VALID   --compare-image ${NOTOL}
+                             ${BASELINE}/apTvUtContrastTest_base_glob.tif
+                             ${TEMP}/apTvUtContrastTest_base_glob.tif)
+
+otb_test_application(NAME  apTvUtContrastTest_lum_glob
+                     APP  ContrastEnhancement
+                     OPTIONS -in ${INPUTDATA}/anaglyphInput1.tif
+                             -out ${TEMP}/apTvUtContrastTest_lum_glob.tif int16
+                             -bins 256
+                             -spatial global
+                             -hfact 2.7
+                             -nodata 0
+                             -mode lum
+                     VALID   --compare-image ${NOTOL}
+                             ${BASELINE}/apTvUtContrastTest_lum_glob.tif
+                             ${TEMP}/apTvUtContrastTest_lum_glob.tif)
+
+otb_test_application(NAME  apTvUtContrastTest_lum
+                     APP  ContrastEnhancement
+                     OPTIONS -in ${INPUTDATA}/anaglyphInput1.tif
+                             -out ${TEMP}/apTvUtContrastTest_lum.tif int16
+                             -bins 256
+                             -spatial.local.h 33
+                             -spatial.local.w 47
+                             -hfact 2.1
+                             -nodata 0
+                             -mode lum
+                     VALID   --compare-image ${NOTOL}
+                             ${BASELINE}/apTvUtContrastTest_lum.tif
+                             ${TEMP}/apTvUtContrastTest_lum.tif)
 
 
                              
diff --git a/Modules/Filtering/Contrast/test/otbCLHistogramEqualizationFilter.cxx b/Modules/Filtering/Contrast/test/otbCLHistogramEqualizationFilter.cxx
index 403fa06d79..7ddbe3e6fa 100644
--- a/Modules/Filtering/Contrast/test/otbCLHistogramEqualizationFilter.cxx
+++ b/Modules/Filtering/Contrast/test/otbCLHistogramEqualizationFilter.cxx
@@ -41,7 +41,7 @@ int otbCLHistogramEqualizationFilter(int itkNotUsed(argc), char * argv [])
   reader->UpdateOutputInformation();
 
   FilterType::Pointer histoEqualize ( FilterType::New() );
-  
+
   histoEqualize->SetInput( reader->GetOutput() );
   histoEqualize->SetMin(0);
   histoEqualize->SetMax(255);
-- 
GitLab