diff --git a/Modules/Wrappers/SWIG/test/python/Bug1498.py b/Modules/Wrappers/SWIG/test/python/Bug1498.py new file mode 100644 index 0000000000000000000000000000000000000000..ab0fb77e0d50756a412ea84dab5a3067d2822039 --- /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 2342234bee32768dc1efa0809b4a22d43b733183..d1e4a50cf2f386418deb425a00d10f1d65eaaa30 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) +