Skip to content

Commit

Permalink
Refs #12396. Fix vtkMDHistoHex4DFactoryTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumsteve committed Jul 16, 2015
1 parent 538d010 commit 81da35f
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Code/Mantid/Vates/VatesAPI/test/vtkMDHistoHex4DFactoryTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,34 @@ class vtkMDHistoHex4DFactoryTest: public CxxTest::TestSuite

vtkMDHistoHex4DFactory<TimeStepToTimeStep> inside(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 2)), Mantid::VATES::VolumeNormalization, 0);
inside.initialize(ws_sptr);
vtkUnstructuredGrid* insideProduct = dynamic_cast<vtkUnstructuredGrid*>(inside.create(progressAction));
vtkStructuredGrid *insideProduct =
dynamic_cast<vtkStructuredGrid *>(inside.create(progressAction));

vtkMDHistoHex4DFactory<TimeStepToTimeStep> below(ThresholdRange_scptr(new UserDefinedThresholdRange(0, 0.5)), Mantid::VATES::VolumeNormalization, 0);
below.initialize(ws_sptr);
vtkUnstructuredGrid* belowProduct = dynamic_cast<vtkUnstructuredGrid*>(below.create(progressAction));
vtkStructuredGrid *belowProduct =
dynamic_cast<vtkStructuredGrid *>(below.create(progressAction));

vtkMDHistoHex4DFactory<TimeStepToTimeStep> above(ThresholdRange_scptr(new UserDefinedThresholdRange(2, 3)), Mantid::VATES::VolumeNormalization, 0);
above.initialize(ws_sptr);
vtkUnstructuredGrid* aboveProduct = dynamic_cast<vtkUnstructuredGrid*>(above.create(progressAction));
vtkStructuredGrid *aboveProduct =
dynamic_cast<vtkStructuredGrid *>(above.create(progressAction));

TS_ASSERT_EQUALS((10*10*10), insideProduct->GetNumberOfCells());

// This has changed, in order to ensure that we do not pass on empty
// workspaces. A single point is created in the center by the vtkNullUnstructuredGrid
TS_ASSERT_EQUALS(1, belowProduct->GetNumberOfCells());
TS_ASSERT_EQUALS(1, aboveProduct->GetNumberOfCells());
for (auto i = 0; i < insideProduct->GetNumberOfCells(); ++i) {
TS_ASSERT_EQUALS(insideProduct->IsCellVisible(i), true)
}

// This has changed. Cells are still present but not visible.
TS_ASSERT_EQUALS((10 * 10 * 10), belowProduct->GetNumberOfCells());
for (auto i = 0; i < belowProduct->GetNumberOfCells(); ++i) {
TS_ASSERT_EQUALS(belowProduct->IsCellVisible(i), false)
}

TS_ASSERT_EQUALS((10 * 10 * 10), aboveProduct->GetNumberOfCells());
for (auto i = 0; i < aboveProduct->GetNumberOfCells(); ++i) {
TS_ASSERT_EQUALS(aboveProduct->IsCellVisible(i), false)
}
}

void testProgressUpdating()
Expand Down

0 comments on commit 81da35f

Please sign in to comment.