Commit a73af6d7 authored by Ken Martin's avatar Ken Martin

fix issue with the amr tests

They were drawing thee layers of overlapping data
Depending on pointer values the test could fail
due to which level was drawn last.
parent cd98500c
......@@ -19,6 +19,7 @@
#include <vtkCamera.h>
#include <vtkColorTransferFunction.h>
#include <vtkCompositePolyDataMapper2.h>
#include <vtkDataObjectTreeIterator.h>
#include <vtkDataSetSurfaceFilter.h>
#include <vtkImageToAMR.h>
#include <vtkLookupTable.h>
......@@ -83,6 +84,30 @@ int TestAMRSliceFilterCellData(int argc, char *argv[])
mapper->SetInterpolateScalarsBeforeMapping(1);
mapper->SelectColorArray("RTData");
// only show the leaf nodes
vtkCompositeDataSet *input = vtkCompositeDataSet::SafeDownCast(
mapper->GetInputDataObject(0, 0));
if (input)
{
vtkSmartPointer<vtkDataObjectTreeIterator> iter =
vtkSmartPointer<vtkDataObjectTreeIterator>::New();
iter->SetDataSet(input);
for (iter->InitTraversal(); !iter->IsDoneWithTraversal();
iter->GoToNextItem())
{
unsigned int flatIndex = iter->GetCurrentFlatIndex();
mapper->SetBlockVisibility(flatIndex, false);
}
iter->SkipEmptyNodesOn();
iter->VisitOnlyLeavesOn();
for (iter->InitTraversal(); !iter->IsDoneWithTraversal();
iter->GoToNextItem())
{
unsigned int flatIndex = iter->GetCurrentFlatIndex();
mapper->SetBlockVisibility(flatIndex, true);
}
}
vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
......@@ -97,13 +122,12 @@ int TestAMRSliceFilterCellData(int argc, char *argv[])
ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);
ren->ResetCamera();
rwin->SetSize(300, 300);
iren->Initialize();
rwin->Render();
int retVal = vtkRegressionTestImage(rwin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
iren->Start();
}
return !retVal;
......
......@@ -19,6 +19,7 @@
#include <vtkCamera.h>
#include <vtkColorTransferFunction.h>
#include <vtkCompositePolyDataMapper2.h>
#include <vtkDataObjectTreeIterator.h>
#include <vtkDataSetSurfaceFilter.h>
#include <vtkImageToAMR.h>
#include <vtkLookupTable.h>
......@@ -79,6 +80,30 @@ int TestAMRSliceFilterPointData(int argc, char *argv[])
mapper->SetInterpolateScalarsBeforeMapping(1);
mapper->SelectColorArray("RTData");
// only show the leaf nodes
vtkCompositeDataSet *input = vtkCompositeDataSet::SafeDownCast(
mapper->GetInputDataObject(0, 0));
if (input)
{
vtkSmartPointer<vtkDataObjectTreeIterator> iter =
vtkSmartPointer<vtkDataObjectTreeIterator>::New();
iter->SetDataSet(input);
for (iter->InitTraversal(); !iter->IsDoneWithTraversal();
iter->GoToNextItem())
{
unsigned int flatIndex = iter->GetCurrentFlatIndex();
mapper->SetBlockVisibility(flatIndex, false);
}
iter->SkipEmptyNodesOn();
iter->VisitOnlyLeavesOn();
for (iter->InitTraversal(); !iter->IsDoneWithTraversal();
iter->GoToNextItem())
{
unsigned int flatIndex = iter->GetCurrentFlatIndex();
mapper->SetBlockVisibility(flatIndex, true);
}
}
vtkNew<vtkActor> actor;
actor->SetMapper(mapper);
......@@ -93,13 +118,12 @@ int TestAMRSliceFilterPointData(int argc, char *argv[])
ren->GetActiveCamera()->SetFocalPoint(0, 0, 0);
ren->ResetCamera();
rwin->SetSize(300, 300);
iren->Initialize();
rwin->Render();
int retVal = vtkRegressionTestImage(rwin);
if (retVal == vtkRegressionTester::DO_INTERACTOR)
{
iren->Start();
iren->Start();
}
return !retVal;
......
......@@ -24,6 +24,7 @@ TEST_DEPENDS
VTK::FiltersGeometry
VTK::IOAMR
VTK::ImagingCore
VTK::InteractionStyle
VTK::TestingCore
VTK::TestingRendering
VTK::RenderingCore
......
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