Skip to content

Commit

Permalink
Refs #6541. Adding some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Feb 11, 2013
1 parent ca75a6e commit bcbd8d8
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
30 changes: 29 additions & 1 deletion Code/Mantid/Vates/VatesAPI/test/MDEWLoadingPresenterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,34 @@ void testDepthChanged()
TSM_ASSERT("This is a 4D workspace with an integrated T dimension", presenter.hasTDimensionAvailable());
}

void testCanSetAxisLabelsFrom3DData()
{
//Setup view
MockMDLoadingView* view = new MockMDLoadingView;

ConcreteMDEWLoadingPresenter presenter(view);

//Test that it does work when setup.
Mantid::API::Workspace_sptr ws = get3DWorkspace(true, true);
presenter.extractMetadata(boost::dynamic_pointer_cast<IMDEventWorkspace>(ws));
vtkDataSet *ds = vtkUnstructuredGrid::New();
TSM_ASSERT_THROWS_NOTHING("Should pass", presenter.setAxisLabels(ds));
}

void testCanSetAxisLabelsFrom4DData()
{
//Setup view
MockMDLoadingView* view = new MockMDLoadingView;

ConcreteMDEWLoadingPresenter presenter(view);

//Test that it does work when setup.
Mantid::API::Workspace_sptr ws = get3DWorkspace(false, true);
presenter.extractMetadata(boost::dynamic_pointer_cast<IMDEventWorkspace>(ws));
vtkDataSet *ds = vtkUnstructuredGrid::New();
TSM_ASSERT_THROWS_NOTHING("Should pass", presenter.setAxisLabels(ds));
}

void testCanLoadFileBasedOnExtension()
{
MockMDLoadingView* view = new MockMDLoadingView;
Expand All @@ -189,4 +217,4 @@ void testDepthChanged()

};

#endif
#endif
28 changes: 28 additions & 0 deletions Code/Mantid/Vates/VatesAPI/test/MDHWLoadingPresenterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,34 @@ void testHasTDimensionWhenNotIntegrated()
TSM_ASSERT("This is a 4D workspace with an integrated T dimension", presenter.hasTDimensionAvailable());
}

void testCanSetAxisLabelsFrom3DData()
{
//Setup view
MockMDLoadingView* view = new MockMDLoadingView;

ConcreteMDHWLoadingPresenter presenter(view);

//Test that it does work when setup.
Mantid::API::Workspace_sptr ws = get3DWorkspace(true, true);
presenter.extractMetadata(boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(ws));
vtkDataSet *ds = vtkUnstructuredGrid::New();
TSM_ASSERT_THROWS_NOTHING("Should pass", presenter.setAxisLabels(ds));
}

void testCanSetAxisLabelsFrom4DData()
{
//Setup view
MockMDLoadingView* view = new MockMDLoadingView;

ConcreteMDHWLoadingPresenter presenter(view);

//Test that it does work when setup.
Mantid::API::Workspace_sptr ws = get3DWorkspace(false, true);
presenter.extractMetadata(boost::dynamic_pointer_cast<Mantid::API::IMDHistoWorkspace>(ws));
vtkDataSet *ds = vtkUnstructuredGrid::New();
TSM_ASSERT_THROWS_NOTHING("Should pass", presenter.setAxisLabels(ds));
}

};

#endif
8 changes: 8 additions & 0 deletions Code/Mantid/Vates/VatesAPI/test/NullRebinningPresenterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "MantidVatesAPI/vtkDataSetFactory.h"
#include <vtkDataSet.h>
#include <vtkFloatArray.h>
#include <vtkUnstructuredGrid.h>
#include "MantidAPI/Workspace.h"

using namespace Mantid::VATES;
Expand Down Expand Up @@ -69,6 +70,13 @@ class NullRebinningPresenterTest : public CxxTest::TestSuite
TS_ASSERT_THROWS(nullObject.getTimeStepValues(), std::runtime_error);
}

void setAxisLabelsThrows()
{
NullRebinningPresenter nullObject;
vtkDataSet *ds = vtkUnstructuredGrid::New();
TS_ASSERT_THROWS(nullObject.setAxisLabels(ds), std::runtime_error);
ds->Delete();
}
};

#endif

0 comments on commit bcbd8d8

Please sign in to comment.