From 566a195bc2a76954d23dc720365135277d14dfbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Traizet?= <cedric.traizet@c-s.fr>
Date: Tue, 4 Feb 2020 10:19:43 +0100
Subject: [PATCH] ENH: updated test for the Smoothing application

---
 .../Images/apTvUtSmoothingTestAnisotropic.tif |  3 ++
 .../Images/apTvUtSmoothingTestGaussian.tif    |  3 ++
 Data/Input/apTvUtSmoothingTest_OutXML.xml     | 38 ---------------
 .../AppFiltering/test/CMakeLists.txt          | 47 ++++++++++++-------
 4 files changed, 37 insertions(+), 54 deletions(-)
 create mode 100644 Data/Baseline/OTB/Images/apTvUtSmoothingTestAnisotropic.tif
 create mode 100644 Data/Baseline/OTB/Images/apTvUtSmoothingTestGaussian.tif
 delete mode 100644 Data/Input/apTvUtSmoothingTest_OutXML.xml

diff --git a/Data/Baseline/OTB/Images/apTvUtSmoothingTestAnisotropic.tif b/Data/Baseline/OTB/Images/apTvUtSmoothingTestAnisotropic.tif
new file mode 100644
index 0000000000..5336d19998
--- /dev/null
+++ b/Data/Baseline/OTB/Images/apTvUtSmoothingTestAnisotropic.tif
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:bdd0ce0f98ec479767e9e4cbb8f118753963f9a91c689870c3f02758de94d15e
+size 3422183
diff --git a/Data/Baseline/OTB/Images/apTvUtSmoothingTestGaussian.tif b/Data/Baseline/OTB/Images/apTvUtSmoothingTestGaussian.tif
new file mode 100644
index 0000000000..539c8486c8
--- /dev/null
+++ b/Data/Baseline/OTB/Images/apTvUtSmoothingTestGaussian.tif
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5a9e56c55f2cb4f16ad31b762f1a38283c664d5570671fdf5f8a905f03a53a13
+size 3308861
diff --git a/Data/Input/apTvUtSmoothingTest_OutXML.xml b/Data/Input/apTvUtSmoothingTest_OutXML.xml
deleted file mode 100644
index 2f95025e38..0000000000
--- a/Data/Input/apTvUtSmoothingTest_OutXML.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" ?>
-<OTB>
-    <version>3.18</version>
-    <build>18-05-2013</build>
-    <platform>Linux</platform>
-    <application>
-        <name>Smoothing</name>
-        <descr>Apply a smoothing filter to an image</descr>
-        <doc>
-            <name>Smoothing</name>
-            <longdescr>This application applies smoothing filter to an image. Either gaussian, mean, or anisotropic diffusion are available.</longdescr>
-            <authors>OTB-Team</authors>
-            <limitations>None</limitations>
-            <seealso> </seealso>
-            <tags>
-                <tag>Image Filtering</tag>
-            </tags>
-        </doc>
-        <parameter mandatory="true">
-            <key>in</key>
-            <type>InputImage</type>
-            <name>Input Image</name>
-            <value>/home/rashad/repos/orfeo/OTB-Data/Input/poupees.tif</value>
-        </parameter>
-        <parameter mandatory="true">
-            <key>out</key>
-            <type>OutputImage</type>
-            <name>Output Image</name>
-            <value>/home/rashad/repos/orfeo/build/OTB_/test-build/Testing/Temporary/apTvUtSmoothingTest_OutXML.tif</value>
-        </parameter>
-        <parameter mandatory="true">
-            <key>type</key>
-            <type>Choice</type>
-            <name>Smoothing Type</name>
-            <value>mean</value>
-        </parameter>
-    </application>
-</OTB>
diff --git a/Modules/Applications/AppFiltering/test/CMakeLists.txt b/Modules/Applications/AppFiltering/test/CMakeLists.txt
index 84ce852767..688fa359aa 100644
--- a/Modules/Applications/AppFiltering/test/CMakeLists.txt
+++ b/Modules/Applications/AppFiltering/test/CMakeLists.txt
@@ -20,9 +20,20 @@
 
 otb_module_test()
 #----------- Smoothing TESTS ----------------
+
+otb_test_application(NAME  apTvUtSmoothingTest_OutXML
+                     APP  Smoothing
+                     OPTIONS -in ${INPUTDATA}/poupees.tif
+               	             -out ${TEMP}/apTvUtSmoothingTest_OutXML.tif
+                             -type mean
+                             -outxml ${TEMP}/apTvUtSmoothingTest_OutXML.xml
+                     VALID   --compare-image ${NOTOL}
+                             ${BASELINE}/apTvUtSmoothingTest.tif
+                             ${TEMP}/apTvUtSmoothingTest_OutXML.tif)
+
 otb_test_application(NAME  apTvUtSmoothingTest_InXML
                      APP  Smoothing
-                     OPTIONS -inxml ${INPUTDATA}/apTvUtSmoothingTest_OutXML.xml
+                     OPTIONS -inxml ${TEMP}/apTvUtSmoothingTest_OutXML.xml
                	             -in ${INPUTDATA}/poupees.tif
                	             -out ${TEMP}/apTvUtSmoothingTest_InXML.tif
                              -type mean
@@ -30,24 +41,32 @@ otb_test_application(NAME  apTvUtSmoothingTest_InXML
                              ${BASELINE}/apTvUtSmoothingTest.tif
                              ${TEMP}/apTvUtSmoothingTest_InXML.tif)
 
-otb_test_application(NAME  apTvUtSmoothingTest
+set_tests_properties( apTvUtSmoothingTest_InXML
+    PROPERTIES DEPENDS apTvUtSmoothingTest_OutXML)
+
+otb_test_application(NAME  apTvUtSmoothingTestGaussian
                      APP  Smoothing
                      OPTIONS -in ${INPUTDATA}/poupees.tif
-               	             -out ${TEMP}/apTvUtSmoothingTest.tif
-                             -type mean
+               	             -out ${TEMP}/apTvUtSmoothingTestGaussian.tif
+                             -type gaussian
+                             -type.gaussian.stdev 2.0
+                             -type.gaussian.maxerror 0.1
+                             -type.gaussian.maxwidth 64
                      VALID   --compare-image ${NOTOL}
-                             ${BASELINE}/apTvUtSmoothingTest.tif
-                             ${TEMP}/apTvUtSmoothingTest.tif)
+                             ${BASELINE}/apTvUtSmoothingTestGaussian.tif
+                             ${TEMP}/apTvUtSmoothingTestGaussian.tif)
 
-otb_test_application(NAME  apTvUtSmoothingTest_OutXML
+otb_test_application(NAME  apTvUtSmoothingTestAnisotropic
                      APP  Smoothing
                      OPTIONS -in ${INPUTDATA}/poupees.tif
-               	             -out ${TEMP}/apTvUtSmoothingTest_OutXML.tif
-                             -type mean
-                             -outxml ${TEMP}/apTvUtSmoothingTest_OutXML.xml
+               	             -out ${TEMP}/apTvUtSmoothingTestAnisotropic.tif
+                             -type anidif
+                             -type.anidif.timestep 0.125
+                             -type.anidif.nbiter 10
+                             -type.anidif.conductance 1.
                      VALID   --compare-image ${NOTOL}
-                             ${BASELINE}/apTvUtSmoothingTest.tif
-                             ${TEMP}/apTvUtSmoothingTest_OutXML.tif)
+                             ${BASELINE}/apTvUtSmoothingTestAnisotropic.tif
+                             ${TEMP}/apTvUtSmoothingTestAnisotropic.tif)
 
 #----------- Contrast TESTS ----------------
 
@@ -115,7 +134,3 @@ otb_test_application(NAME  nlMeansTest_base
                              ${BASELINE}/GomaAvant_NLMeans.tif
                              ${TEMP}/GomaAvant_NLMeans.tif)
 
-
-                             
-                             
-
-- 
GitLab