From f8676b6786f02d3c77cec66ec8bd1f1a9f4393e2 Mon Sep 17 00:00:00 2001
From: Otmane Lahlou <otmane.lahlou@c-s.fr>
Date: Fri, 20 Aug 2010 11:44:28 +0200
Subject: [PATCH] ADD : MapFileWriter test

---
 Testing/Code/IO/CMakeLists.txt                | 17 ++++++++++
 Testing/Code/IO/otbIOTests21.cxx              | 30 +++++++++++++++++
 .../Code/IO/otbMapFileProductWriterNew.cxx    | 32 +++++++++++++++++++
 3 files changed, 79 insertions(+)
 create mode 100644 Testing/Code/IO/otbIOTests21.cxx
 create mode 100644 Testing/Code/IO/otbMapFileProductWriterNew.cxx

diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt
index 838c5bf31d..a72681dbf1 100644
--- a/Testing/Code/IO/CMakeLists.txt
+++ b/Testing/Code/IO/CMakeLists.txt
@@ -55,6 +55,7 @@ IF(OTB_USE_CURL)
 ENDIF(OTB_USE_CURL)
 
 SET(IO_TESTS20    ${CXX_TEST_PATH}/otbIOTests20)
+SET(IO_TESTS21    ${CXX_TEST_PATH}/otbIOTests21)
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ COMMON_TESTS3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2583,6 +2584,14 @@ ADD_TEST(ioTuSarDefaultImageMetadataInterfaceNew ${IO_TESTS20}
         otbSarDefaultImageMetadataInterfaceNew )
 
 
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTESTS21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ADD_TEST(ioTuMapFileProductWriterNew ${IO_TESTS21}
+  otbMapFileProductWriterNew
+)
+
 #----------------------------------------------------------------------------------
 SET(BasicIO_SRCS1
 otbIOTests1.cxx
@@ -2786,6 +2795,12 @@ otbSarDefaultImageMetadataInterfaceFactoryNew.cxx
 otbSarDefaultImageMetadataInterfaceNew.cxx
 )
 
+SET(BasicIO_SRCS21
+otbIOTests21.cxx
+otbMapFileProductWriterNew
+)
+
+
 
 OTB_ADD_EXECUTABLE(otbIOTests1 "${BasicIO_SRCS1}" "OTBIO;OTBTesting")
 OTB_ADD_EXECUTABLE(otbIOTests2 "${BasicIO_SRCS2}" "OTBIO;OTBTesting")
@@ -2829,3 +2844,5 @@ OTB_ADD_EXECUTABLE(otbIOTests20 "${BasicIO_SRCS20}" "OTBIO;OTBTesting")
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
 
+OTB_ADD_EXECUTABLE(otbIOTests21 "${BasicIO_SRCS21}" "OTBIO;OTBTesting")
+
diff --git a/Testing/Code/IO/otbIOTests21.cxx b/Testing/Code/IO/otbIOTests21.cxx
new file mode 100644
index 0000000000..f5d96a296a
--- /dev/null
+++ b/Testing/Code/IO/otbIOTests21.cxx
@@ -0,0 +1,30 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+  This software is distributed WITHOUT ANY WARRANTY; without even
+  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+  PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+// this file defines the otbCommonTest for the test driver
+// and all it expects is that you have a function called RegisterTests
+#if defined(_MSC_VER)
+#pragma warning ( disable : 4786 )
+#endif
+
+#include "otbTestMain.h"
+
+void RegisterTests()
+{
+  REGISTER_TEST(otbMapFileProductWriterNew);
+}
diff --git a/Testing/Code/IO/otbMapFileProductWriterNew.cxx b/Testing/Code/IO/otbMapFileProductWriterNew.cxx
new file mode 100644
index 0000000000..cf0d8f6dcb
--- /dev/null
+++ b/Testing/Code/IO/otbMapFileProductWriterNew.cxx
@@ -0,0 +1,32 @@
+/*=========================================================================
+
+  Program:   ORFEO Toolbox
+  Language:  C++
+  Date:      $Date$
+  Version:   $Revision$
+
+
+  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
+  See OTBCopyright.txt for details.
+
+
+     This software is distributed WITHOUT ANY WARRANTY; without even
+     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+     PURPOSE.  See the above copyright notices for more information.
+
+=========================================================================*/
+
+#include "otbMapFileProductWriter.h"
+#include "otbVectorImage.h"
+
+int otbMapFileProductWriterNew(int argc, char* argv[])
+{
+  
+  typedef otb::VectorImage<double>               ImageType;
+  typedef otb::MapFileProductWriter<ImageType>   MapFileProductWriterType;
+  
+  MapFileProductWriterType::Pointer    mapWriter  = MapFileProductWriterType::New();
+  
+  return EXIT_SUCCESS;
+}
+
-- 
GitLab