Commit 3da3d33d authored by Marcus D. Hanwell's avatar Marcus D. Hanwell

ENH: Ported code to use vtkTestingInteractor.

parent 87f92d15
......@@ -90,12 +90,7 @@ int TestBarGraph( int argc, char * argv [] )
//Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(0);
int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 25);
//int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -59,11 +59,7 @@ int TestContext( int argc, char * argv [] )
view->GetRenderWindow()->Render();
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......
......@@ -49,10 +49,6 @@ int TestContextImage(int argc, char * argv [])
view->GetRenderWindow()->Render();
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -67,11 +67,7 @@ int TestDiagram( int argc, char * argv [] )
renderWindow->Render();
int retVal = vtkRegressionTestImage(renderWindow);
if( retVal == vtkRegressionTester::DO_INTERACTOR)
{
interactor->Start();
}
interactor->Start();
return !retVal;
}
......
/*=========================================================================
Program: Visualization Toolkit
Module: TestContext.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm 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 notice for more information.
=========================================================================*/
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkSmartPointer.h"
#include "vtkObjectFactory.h"
#include "vtkContext2D.h"
#include "vtkTransform2D.h"
#include "vtkImageItem.h"
#include "vtkImageData.h"
#include "vtkContextView.h"
#include "vtkContextScene.h"
#include "vtkTextProperty.h"
#include "vtkFreeTypeUtilities.h"
#include "vtkUnicodeString.h"
#include "vtkQtRenderUtility.h"
#include "vtkRegressionTestImage.h"
#include <QApplication>
//----------------------------------------------------------------------------
int TestFreeTypeRender(int argc, char * argv [])
{
QApplication app(argc, argv);
// Set up a 2D context view, context test object and add it to the scene
vtkSmartPointer<vtkContextView> view = vtkSmartPointer<vtkContextView>::New();
view->GetRenderWindow()->SetSize(200, 200);
vtkSmartPointer<vtkImageItem> item = vtkSmartPointer<vtkImageItem>::New();
view->GetScene()->AddItem(item);
// Now try to render some text using freetype...
vtkSmartPointer<vtkQtRenderUtility> qt =
vtkSmartPointer<vtkQtRenderUtility>::New();
vtkSmartPointer<vtkFreeTypeUtilities> freetype =
vtkFreeTypeUtilities::GetInstance();
vtkSmartPointer<vtkTextProperty> prop =
vtkSmartPointer<vtkTextProperty>::New();
prop->SetColor(0.0, 0.0, 0.0);
prop->SetFontSize(24);
vtkSmartPointer<vtkImageData> image = vtkSmartPointer<vtkImageData>::New();
//int result = freetype->RenderString(prop, "My String", image);
int result = qt->RenderString(prop,
vtkUnicodeString::from_utf8("\xe2\x84\xab"),
image);
item->SetImage(image);
item->SetPosition(20, 20);
view->GetRenderWindow()->SetMultiSamples(0);
view->GetRenderWindow()->Render();
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
return !retVal;
}
......@@ -67,7 +67,6 @@ int TestMultipleChartRenderers( int argc, char * argv [] )
ren->AddActor(chartActor);
chartScene->SetRenderer(ren);
// Create a table with some points in it...
VTK_CREATE(vtkTable, table);
VTK_CREATE(vtkFloatArray, arrX);
......@@ -110,10 +109,7 @@ int TestMultipleChartRenderers( int argc, char * argv [] )
}
int retVal = vtkRegressionTestImage(iren->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
iren->Start();
return !retVal;
}
......@@ -76,7 +76,6 @@ int TestMultipleRenderers( int argc, char * argv [] )
ren2d->AddActor(chartActor);
chartScene->SetRenderer( ren2d );
// Create a table with some points in it...
VTK_CREATE(vtkTable, table);
VTK_CREATE(vtkFloatArray, arrX);
......@@ -121,10 +120,7 @@ int TestMultipleRenderers( int argc, char * argv [] )
ren2d->SetViewport(0,0.5,1,1);
int retVal = vtkRegressionTestImage(iren->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
}
iren->Start();
return !retVal;
}
......@@ -68,13 +68,7 @@ int TestParallelCoordinates(int argc, char* argv[])
view->GetRenderWindow()->SetMultiSamples(0);
//Finally render the scene and compare the image to a reference image
//int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 25);
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -81,12 +81,7 @@ int TestPieChart( int argc, char * argv [] )
//Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(0);
int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 25);
//int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -54,12 +54,8 @@ int TestQtContextUnicode(int argc, char * argv [])
view->GetRenderWindow()->SetMultiSamples(0);
view->GetRenderWindow()->Render();
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 30);
view->GetInteractor()->Start();
return !retVal;
}
......
......@@ -80,11 +80,7 @@ int TestQtDiagram( int argc, char * argv [] )
renderWindow->Render();
int retVal = vtkRegressionTestImageThreshold(renderWindow, 15);
if( retVal == vtkRegressionTester::DO_INTERACTOR)
{
interactor->Start();
}
interactor->Start();
return !retVal;
}
......
......@@ -85,11 +85,7 @@ int TestScalarsToColors( int argc, char * argv [] )
//Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(0);
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -82,12 +82,7 @@ int TestScatterPlot( int argc, char * argv [] )
//Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(0);
int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 25);
//int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -142,12 +142,7 @@ int TestStackedBarGraph( int argc, char * argv [] )
//Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(0);
int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 25);
//int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
......@@ -38,7 +38,7 @@
// Monthly checkout data
static const char *month_labels[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
static const char *month_labels[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
static int book[] = {5675, 5902, 6388, 5990, 5575, 7393, 9878, 8082, 6417, 5946, 5526, 5166};
static int new_popular[] = {701, 687, 736, 696, 750, 814, 923, 860, 786, 735, 680, 741};
......@@ -123,16 +123,12 @@ int TestStackedPlot( int argc, char * argv [] )
VTK_CREATE(vtkColorSeries,colorSeries);
colorSeries->SetColorScheme(vtkColorSeries::COOL);
stack->SetColorSeries(colorSeries);
//Finally render the scene and compare the image to a reference image
view->GetRenderWindow()->SetMultiSamples(0);
int retVal = vtkRegressionTestImageThreshold(view->GetRenderWindow(), 25);
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetInteractor()->Initialize();
view->GetInteractor()->Start();
}
view->GetInteractor()->Start();
return !retVal;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment