Skip to content
Snippets Groups Projects
Commit 79cbb9a8 authored by Julien Michel's avatar Julien Michel
Browse files

TEST: (Visu Refactoring) Adding a new validation test

parent 4c6bc519
No related branches found
No related tags found
No related merge requests found
......@@ -16,14 +16,20 @@ SET(EPSILON 0.000001)
# Test programs
SET(VISUREFAC_TESTS1 ${CXX_TEST_PATH}/otbVisuRefacTests1)
#------------ otb::ImageWidget -------------------------
ADD_TEST(vrTuImageWidgetNew ${VISUREFAC_TESTS1}
otbImageWidgetNew
)
ADD_TEST(vrTvImageWidget ${VISUREFAC_TESTS1}
otbImageWidget
${INPUTDATA}/poupees.png
)
SET(VisuRefac_SRCS1
otbImageWidgetNew.cxx
otbImageWidget.cxx
)
INCLUDE_DIRECTORIES("${OTBTesting_BINARY_DIR}")
......
/*=========================================================================
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 "otbImageWidget.h"
#include "otbImageFileReader.h"
#include <FL/Fl.H>
int otbImageWidget( int argc, char * argv[] )
{
// typedefs
typedef otb::ImageWidget<> WidgetType;
typedef WidgetType::InputImageType ImageType;
typedef otb::ImageFileReader<ImageType> ReaderType;
// Reading the input image
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName(argv[1]);
reader->Update();
ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion();
// Create a widget
WidgetType::Pointer widget = WidgetType::New();
// Resize it
widget->resize(0,0,region.GetSize()[0],region.GetSize()[1]);
// Show it
widget->show();
// Refresh display
Fl::check();
// Read the OpenGl buffer
widget->ReadBuffer(reader->GetOutput(),region);
// Redraw it
widget->redraw();
// Refresh display
Fl::check();
// Print out widget status
std::cout<<widget<<std::endl;
return EXIT_SUCCESS;
}
......@@ -27,4 +27,5 @@
void RegisterTests()
{
REGISTER_TEST(otbImageWidgetNew);
REGISTER_TEST(otbImageWidget);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment