From 15e349741b01b4be86fb779350bbc9bc886a3cba Mon Sep 17 00:00:00 2001 From: Julien Michel <julien.michel@cnes.fr> Date: Fri, 8 Dec 2017 15:05:58 +0100 Subject: [PATCH] TEST: Adding test to ensure non-regression on bugfix #1498 --- Modules/Wrappers/SWIG/test/python/Bug1498.py | 38 +++++++++++++++++++ .../Wrappers/SWIG/test/python/CMakeLists.txt | 8 ++++ 2 files changed, 46 insertions(+) create mode 100644 Modules/Wrappers/SWIG/test/python/Bug1498.py diff --git a/Modules/Wrappers/SWIG/test/python/Bug1498.py b/Modules/Wrappers/SWIG/test/python/Bug1498.py new file mode 100644 index 0000000000..ab0fb77e0d --- /dev/null +++ b/Modules/Wrappers/SWIG/test/python/Bug1498.py @@ -0,0 +1,38 @@ +import otbApplication as otb + +# TO RUN WITH PYTHON3 +# try: +# unicode = unicode +# except NameError: +# # 'unicode' is undefined, must be Python 3 +# str = str +# unicode = str +# bytes = bytes +# basestring = (str,bytes) +# else: +# # 'unicode' exists, must be Python 2 +# str = str +# unicode = unicode +# bytes = str +# basestring = basestring + + +# This test checks that UpdateOutputInformation() has been called on output image pointers when connecting pipeline in-memory +# This code snippet has been used to reproduce bug #1498 + +if __name__ == '__main__': + inimage = sys.argv[2] + outimage = sys.argv[3] + + ext1 = otb.Registry.CreateApplication("ExtractROI") + ext2 = otb.Registry.CreateApplication("ExtractROI") + + ext1.SetParameterString('in',inimage) + ext1.Execute() + ext1.UpdateParameters() + + ext2.SetParameterInputImage('in',ext2.GetParameterOutputImage('out')) + ext2.UpdateParameters() + ext2.SetParameterStringList('cl',['Channel1']) + ext2.SetParameterString("out",outimage) + ext2.ExecuteAndWriteOutput() diff --git a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt index 2342234bee..d1e4a50cf2 100644 --- a/Modules/Wrappers/SWIG/test/python/CMakeLists.txt +++ b/Modules/Wrappers/SWIG/test/python/CMakeLists.txt @@ -135,3 +135,11 @@ add_test( NAME pyTvConnectApplications PythonConnectApplications ${OTB_DATA_ROOT}/Input/poupees.tif ${TEMP}/pyTvConnectApplicationsOutput.tif) + +add_test( NAME pyTvBug1498 + COMMAND ${TEST_DRIVER} Execute + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/PythonTestDriver.py + Bug823 + ${OTB_DATA_ROOT}/Input/poupees.tif + ${TEMP}/Bu1498-output.tif) + -- GitLab