Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Main Repositories
otb
Commits
d2d4b68e
Commit
d2d4b68e
authored
Sep 20, 2022
by
Julien Osman
Browse files
TEST: Add test to check the raise of exceptions instead of segfault
parent
95a5b5e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt
View file @
d2d4b68e
...
...
@@ -116,6 +116,12 @@ otb_add_test(NAME owTvOutputImageParameter COMMAND otbApplicationEngineTestDrive
"my description"
)
otb_add_test
(
NAME owTvOutputImageParameter2 COMMAND otbApplicationEngineTestDriver
otbWrapperOutputImageParameterTest2
${
INPUTDATA
}
/QB_Toulouse_Ortho_PAN.tif
$<TARGET_FILE_DIR:otbapp_BandMath>
)
#~ otb_add_test(NAME owTvOutputImageParameterConversion COMMAND otbApplicationEngineTestDriver
#~ otbWrapperOutputImageParameterConversionTest
#~ ${INPUTDATA}/poupees.tif
...
...
Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx
View file @
d2d4b68e
...
...
@@ -38,6 +38,7 @@ void RegisterTests()
REGISTER_TEST
(
otbWrapperInputVectorDataListParameterTest1
);
REGISTER_TEST
(
otbWrapperApplicationDocTest
);
REGISTER_TEST
(
otbWrapperOutputImageParameterTest1
);
REGISTER_TEST
(
otbWrapperOutputImageParameterTest2
);
//~ REGISTER_TEST(otbWrapperOutputImageParameterConversionTest);
REGISTER_TEST
(
otbApplicationMemoryConnectTest
);
REGISTER_TEST
(
otbWrapperImageInterface
);
...
...
Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx
View file @
d2d4b68e
...
...
@@ -26,6 +26,9 @@
#include
"otbWrapperInputImageParameter.h"
#include
"otbImageFileReader.h"
#include
"otbWrapperTypes.h"
#include
"otbWrapperApplicationRegistry.h"
#include
"itkExceptionObject.h"
#include
<boost/test/unit_test.hpp>
#include
<vector>
...
...
@@ -55,6 +58,34 @@ int otbWrapperOutputImageParameterTest1(int itkNotUsed(argc), char* argv[])
}
int
otbWrapperOutputImageParameterTest2
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
3
)
{
std
::
cout
<<
"Usage: otbWrapperOutputImageParameterTest2 TestImage PathToBandMathApp
\n
"
;
return
EXIT_FAILURE
;
}
otb
::
Wrapper
::
ApplicationRegistry
::
SetApplicationPath
(
argv
[
2
]);
auto
app
=
otb
::
Wrapper
::
ApplicationRegistry
::
CreateApplication
(
"BandMath"
);
app
->
SetParameterStringList
(
"il"
,
{
argv
[
1
]});
otb
::
Wrapper
::
ImageBaseType
::
RegionType
region
;
const
otb
::
ImageMetadata
imd
;
// The following instructions should raise an exception
BOOST_CHECK_THROW
(
app
->
GetImageOrigin
(
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
GetImageSpacing
(
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
GetImageSize
(
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
GetImageNbBands
(
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
PropagateRequestedRegion
(
"out"
,
region
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
GetImageRequestedRegion
(
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
SetImageMetadata
(
imd
,
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
GetMetadataDictionary
(
"out"
),
itk
::
ExceptionObject
);
BOOST_CHECK_THROW
(
app
->
GetImageBasePixelType
(
"out"
),
itk
::
ExceptionObject
);
return
EXIT_SUCCESS
;
}
// template < typename ImageType >
// void Cross( int p , std::string inputfilename, std::string outputfilename)
// {
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment