| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | 
							
- // Qt includes
 
- #include <QCoreApplication>
 
- // CTKVTK includes
 
- #include "ctkVTKHistogram.h"
 
- // VTK includes
 
- #include <vtkSmartPointer.h>
 
- #include <vtkDataArray.h>
 
- // STD includes
 
- #include <cstdlib>
 
- #include <iostream>
 
- int ctkVTKHistogramTest3( int argc, char * argv [])
 
- {
 
-   Q_UNUSED(argc);
 
-   Q_UNUSED(argv);
 
- //---------------------------------------------------
 
- // test 3 :
 
- //---------------------------------------------------
 
-   //------Test build--------------------------------
 
-   ctkVTKHistogram histogram;
 
-   vtkSmartPointer<vtkDataArray> dataArray = vtkDataArray::CreateDataArray(VTK_CHAR);
 
-   dataArray->InsertNextTuple1(0);
 
-   dataArray->InsertNextTuple1(0);
 
-   dataArray->InsertNextTuple1(0);
 
-   dataArray->InsertNextTuple1(0);
 
-   histogram.setDataArray(dataArray);
 
-   if (histogram.dataArray() != dataArray)
 
-     {
 
-     std::cerr << "Line : " << __LINE__
 
-               << " - Problem with ctkVTKHistogram::setDataArray "
 
-               << std::endl;
 
-     return EXIT_FAILURE;
 
-     }
 
-   //------Test build---------------------------------
 
-   histogram.build();
 
-   if (histogram.count() != 256)
 
-     {
 
-     std::cerr << "Failed to build histogram" << histogram.count()
 
-               << std::endl;
 
-     return EXIT_FAILURE;
 
-     }
 
-   if (histogram.value(0).toInt() != 4)
 
-     {
 
-     std::cerr << "Failed to build histogram" << histogram.value(0).toInt()
 
-               << std::endl;
 
-     return EXIT_FAILURE;
 
-     }
 
-   if (histogram.value(1).toInt() != 0)
 
-     {
 
-     std::cerr << "Failed to build histogram" << histogram.value(1).toInt()
 
-               << std::endl;
 
-     return EXIT_FAILURE;
 
-     }
 
-   if (histogram.value(255).toInt() != 0)
 
-     {
 
-     std::cerr << "Failed to build histogram" << histogram.value(255).toInt()
 
-               << std::endl;
 
-     return EXIT_FAILURE;
 
-     }
 
-   if (histogram.value(1024).toInt() != 0)
 
-     {
 
-     std::cerr << "Failed to build histogram" << histogram.value(1024).toInt()
 
-               << std::endl;
 
-     return EXIT_FAILURE;
 
-     }
 
-   return EXIT_SUCCESS;
 
- }
 
 
  |