diff --git a/Testing/Code/IO/CMakeLists.txt b/Testing/Code/IO/CMakeLists.txt index 9da6ca064714537b20244cd1dc34b1fe5d864224..fd3e1ad396c75e26416d1e7b5ea0d95a10bbf03d 100755 --- a/Testing/Code/IO/CMakeLists.txt +++ b/Testing/Code/IO/CMakeLists.txt @@ -1415,6 +1415,16 @@ ADD_TEST(ioTvVectorDataFileReaderWriter ${IO_TESTS15} ADD_TEST(ioTuKMLVectorDataIO ${IO_TESTS15} otbKMLVectorDataIONew ) +# CanRead() +ADD_TEST(ioTuKMLVectorDataIOCanRead ${IO_TESTS15} + otbKMLVectorDataIOTestCanRead + ${INPUTDATA}/simple.kml) + +# CanWrite() +ADD_TEST(ioTuKMLVectorDataIOCanWrite ${IO_TESTS15} + otbKMLVectorDataIOTestCanWrite + ${TEMP}/simple.kml) + #---------------------------------------------------------------------------------- SET(BasicIO_SRCS1 @@ -1526,6 +1536,8 @@ otbVectorDataFileWriter.cxx otbVectorDataFileReaderWriter.cxx otbSHPVectorDataIONew.cxx otbKMLVectorDataIONew.cxx +otbKMLVectorDataIOTestCanRead.cxx +otbKMLVectorDataIOTestCanWrite.cxx ) diff --git a/Testing/Code/IO/otbIOTests15.cxx b/Testing/Code/IO/otbIOTests15.cxx index 31a6c3ea1a94bccd1122daf5fd6d071c36484926..5062f79ce0b5335e3eda0353883913906858c95f 100755 --- a/Testing/Code/IO/otbIOTests15.cxx +++ b/Testing/Code/IO/otbIOTests15.cxx @@ -36,4 +36,6 @@ REGISTER_TEST(otbVectorDataFileWriter); REGISTER_TEST(otbVectorDataFileReaderWriter); REGISTER_TEST(otbSHPVectorDataIONew); REGISTER_TEST(otbKMLVectorDataIONew); +REGISTER_TEST(otbKMLVectorDataIOTestCanRead); +REGISTER_TEST(otbKMLVectorDataIOTestCanWrite); } diff --git a/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx b/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx new file mode 100644 index 0000000000000000000000000000000000000000..00c714f51af31e045457f6a7f75a2e9ee40b8b9a --- /dev/null +++ b/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx @@ -0,0 +1,36 @@ +/*========================================================================= + + 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 "otbKMLVectorDataIO.h" +#include "otbVectorData.h" +#include <iostream> + +int otbKMLVectorDataIOTestCanRead(int argc, char* argv[]) +{ + typedef otb::VectorData<> VectorDataType; + typedef otb::KMLVectorDataIO<VectorDataType> KMLVectorDataIOType; + KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); + bool lCanRead = object->CanReadFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::KMLVectorDataIO : impossible to open the file "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx b/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e4366f538bb45a83f0962b2b28626dd1c6fb2740 --- /dev/null +++ b/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx @@ -0,0 +1,36 @@ +/*========================================================================= + + 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 "otbKMLVectorDataIO.h" +#include "otbVectorData.h" +#include <iostream> + +int otbKMLVectorDataIOTestCanWrite(int argc, char* argv[]) +{ + typedef otb::VectorData<> VectorDataType; + typedef otb::KMLVectorDataIO<VectorDataType> KMLVectorDataIOType; + KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); + bool lCanRead = object->CanWriteFile(argv[1]); + if ( lCanRead == false) + { + std::cerr << "Erreur otb::KMLVectorDataIO : impossible to create the file "<<argv[1]<<"."<<std::endl; + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +}