diff --git a/Code/Wrappers/QtWidget/CMakeLists.txt b/Code/Wrappers/QtWidget/CMakeLists.txt index 92c136ea85dfefae6a753ac0720871629a60ca82..26f2e871daf77c468f7b32436fbef1557c70cf33 100644 --- a/Code/Wrappers/QtWidget/CMakeLists.txt +++ b/Code/Wrappers/QtWidget/CMakeLists.txt @@ -2,4 +2,4 @@ FILE(GLOB srcs "*.cxx") ADD_LIBRARY(OTBWrapperQtWidget ${srcs}) -TARGET_LINK_LIBRARIES(OTBWrapperQtWidget OTBCommon OTBIO OTBWrapperCore) +TARGET_LINK_LIBRARIES(OTBWrapperQtWidget OTBCommon OTBIO OTBWrapperCore ${QT_LIBRARIES}) diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index 8466a719a6789882fafde5a85547d26c7b964cf3..823a4a6de944cf7d0cc353359640421b8fb8d45e 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -5,6 +5,7 @@ IF(WIN32) ENDIF(WIN32) SET(OTB_WRAPPER_TESTS ${CXX_TEST_PATH}/otbWrapperTests) +SET(OTB_WRAPPER_QT_TESTS ${CXX_TEST_PATH}/otbWrapperQtWidgetTests) ADD_TEST(owTuParameterNew ${OTB_WRAPPER_TESTS} otbWrapperParameterNew @@ -43,6 +44,13 @@ ADD_TEST(owTuApplication ${OTB_WRAPPER_TESTS} otbWrapperApplicationNew ) +IF(OTB_USE_QT) +ADD_TEST(owTvQtWidgetParameterFactory ${OTB_WRAPPER_QT_TESTS} + otbWrapperQtWidgetParameterFactory +) + +ENDIF(OTB_USE_QT) + # ----------------Source files CXX ----------------------------------- SET(Wrapper_SRCS @@ -57,3 +65,14 @@ otbWrapperParameterListTest.cxx ADD_EXECUTABLE(otbWrapperTests ${Wrapper_SRCS}) TARGET_LINK_LIBRARIES(otbWrapperTests OTBIO OTBCommon ITKIO ITKCommon OTBTesting OTBWrapperCore) +IF(OTB_USE_QT) + +SET(WrapperQtWidget_SRCS +otbWrapperQtWidgetTests.cxx +otbWrapperQtWidgetParameterFactory.cxx +) + +ADD_EXECUTABLE(otbWrapperQtWidgetTests ${WrapperQtWidget_SRCS}) +TARGET_LINK_LIBRARIES(otbWrapperQtWidgetTests OTBIO OTBCommon ITKIO ITKCommon OTBTesting OTBWrapperCore OTBWrapperQtWidget) + +ENDIF(OTB_USE_QT) diff --git a/Testing/otbWrapperQtWidgetParameterFactory.cxx b/Testing/otbWrapperQtWidgetParameterFactory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..015d873b2d536fb9a20f95e8384af91196f464bb --- /dev/null +++ b/Testing/otbWrapperQtWidgetParameterFactory.cxx @@ -0,0 +1,71 @@ +/*========================================================================= + + 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. + +=========================================================================*/ +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "otbWrapperQtWidgetParameterFactory.h" +#include "otbWrapperEmptyParameter.h" +#include "otbWrapperNumericalParameter.h" + +int otbWrapperQtWidgetParameterFactory(int argc, char* argv[]) +{ + QApplication app(argc, argv); + + otb::Wrapper::QtWidgetParameterFactory::Pointer factory = otb::Wrapper::QtWidgetParameterFactory::New(); + + otb::Wrapper::IntParameter::Pointer intParam = otb::Wrapper::IntParameter::New(); + otb::Wrapper::FloatParameter::Pointer floatParam = otb::Wrapper::FloatParameter::New(); + otb::Wrapper::EmptyParameter::Pointer emptyParam = otb::Wrapper::EmptyParameter::New(); + + intParam->SetName("Int parameter"); + intParam->SetDescription("This is an int parameter"); + intParam->SetKey("int"); + intParam->SetDefaultValue(10); + intParam->SetValue(5); + intParam->SetMinimumValue(-10); + intParam->SetMaximumValue(10); + + floatParam->SetName("Float parameter"); + floatParam->SetDescription("This is an float parameter"); + floatParam->SetKey("float"); + floatParam->SetDefaultValue(0.567); + floatParam->SetValue(0.21); + floatParam->SetMinimumValue(-3.75); + floatParam->SetMaximumValue(4.97); + + emptyParam->SetName("Empty parameter"); + emptyParam->SetDescription("This is an empty parameter"); + emptyParam->SetKey("empty"); + + + QWidget * intWidget = factory->CreateQtWidget(intParam); + QWidget * floatWidget = factory->CreateQtWidget(floatParam); + QWidget * emptyWidget = factory->CreateQtWidget(emptyParam); + + if(intWidget) + { + intWidget->show(); + floatWidget->show(); + emptyWidget->show(); + + return EXIT_SUCCESS; + } + + return EXIT_FAILURE; +} diff --git a/Testing/otbWrapperQtWidgetTests.cxx b/Testing/otbWrapperQtWidgetTests.cxx new file mode 100644 index 0000000000000000000000000000000000000000..8cdafefb8d44da9090ef9206f75a734cf21837fb --- /dev/null +++ b/Testing/otbWrapperQtWidgetTests.cxx @@ -0,0 +1,28 @@ +/*========================================================================= + + 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. + +=========================================================================*/ + +#if defined(_MSC_VER) +#pragma warning ( disable : 4786 ) +#endif + +#include "otbTestMain.h" + +void RegisterTests() +{ + REGISTER_TEST(otbWrapperQtWidgetParameterFactory); +}