Commit acb68438 authored by Zack Galbreath's avatar Zack Galbreath

allow TestInteractiveChartXYZ to be run in interactive mode.

This involved fixing a bug where the vtkContextScene's Geometry
could end up set to (0,0) despite the fact that the ContextItem
already had a properly set Geometry.

This commit also removes a debugging executable from the Testing
CMakeLists.txt file, and removes some debugging print statements
from the test.

Change-Id: I866b00c24d3df144fa0303de54b4a0d66989bb82
parent c5246811
add_executable(InteractiveTest MACOSX_BUNDLE tmp.cxx)
target_link_libraries(InteractiveTest
vtkRenderingContext2D
vtkInfovisCore
vtkTestingRendering
vtkViewsContext2D
vtkIOExport
vtkIOInfovis
vtkChartsCore)
# if we have rendering and views add the following tests
# add tests that do not require data
set(MyTests
......
......@@ -23,10 +23,11 @@
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkTable.h"
#include "vtkRegressionTestImage.h"
#include "vtkUnsignedCharArray.h"
#include "vtkVector.h"
int TestInteractiveChartXYZ(int , char * [])
int TestInteractiveChartXYZ(int argc, char **argv)
{
// Now the chart
vtkNew<vtkInteractiveChartXYZ> chart;
......@@ -85,14 +86,10 @@ int TestInteractiveChartXYZ(int , char * [])
vtkVector2d sP(pos.Cast<double>().GetData());
vtkVector2d lSP(lastPos.Cast<double>().GetData());
std::cout << "sanity 1: (" << lSP[0] << ", " << lSP[1] << ")" << std::endl;
std::cout << "sanity 2: (" << sP[0] << ", " << sP[1] << ")" << std::endl;
vtkVector2d screenPos(mouseEvent.GetScreenPos().Cast<double>().GetData());
vtkVector2d lastScreenPos(mouseEvent.GetLastScreenPos().Cast<double>().GetData());
std::cout << "before: (" << lastScreenPos[0] << ", " << lastScreenPos[1] << ")" << std::endl;
chart->MouseMoveEvent(mouseEvent);
std::cout << "after: (" << lastScreenPos[0] << ", " << lastScreenPos[1] << ")" << std::endl;
// spin
mouseEvent.SetButton(vtkContextMouseEvent::LEFT_BUTTON);
......@@ -124,7 +121,11 @@ int TestInteractiveChartXYZ(int , char * [])
mouseEvent.SetScreenPos(pos);
chart->MouseMoveEvent(mouseEvent);
view->GetInteractor()->Start();
return EXIT_SUCCESS;
int retVal = vtkRegressionTestImage(view->GetRenderWindow());
if(retVal == vtkRegressionTester::DO_INTERACTOR)
{
view->GetRenderWindow()->Render();
view->GetInteractor()->Start();
}
return !retVal;
}
......@@ -19,6 +19,7 @@
#include "vtkAxis.h"
#include "vtkContext2D.h"
#include "vtkContext3D.h"
#include "vtkContextScene.h"
#include "vtkTable.h"
#include "vtkFloatArray.h"
#include "vtkTransform.h"
......@@ -295,6 +296,7 @@ vtkAxis * vtkChartXYZ::GetAxis(int axis)
void vtkChartXYZ::SetGeometry(const vtkRectf &bounds)
{
this->Geometry = bounds;
this->Scene->SetGeometry((int)bounds.GetWidth(), (int)bounds.GetHeight());
}
vtkChartXYZ::vtkChartXYZ() : Geometry(0, 0, 10, 10), Link(NULL), angle(0),
......
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