Skip to content

Commit

Permalink
Refs #6541. Adding test for MDEWEventNexus loading presenter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Reuter committed Feb 22, 2013
1 parent 801d42b commit f052c21
Showing 1 changed file with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,46 @@ void testGetWorkspaceTypeName()
TSM_ASSERT_EQUALS("Characterisation Test Failed", "", presenter.getWorkspaceTypeName());
}

void testAxisLabels()
{
//Setup view
MockMDLoadingView* view = new MockMDLoadingView;
EXPECT_CALL(*view, getRecursionDepth()).Times(AtLeast(1));
EXPECT_CALL(*view, getLoadInMemory()).Times(AtLeast(1)).WillRepeatedly(testing::Return(true));
EXPECT_CALL(*view, updateAlgorithmProgress(_,_)).Times(AnyNumber());

//Setup rendering factory
MockvtkDataSetFactory factory;
EXPECT_CALL(factory, initialize(_)).Times(1);
EXPECT_CALL(factory, create(_)).WillOnce(testing::Return(vtkUnstructuredGrid::New()));
EXPECT_CALL(factory, setRecursionDepth(_)).Times(1);

//Setup progress updates objects
MockProgressAction mockLoadingProgressAction;
EXPECT_CALL(mockLoadingProgressAction, eventRaised(AllOf(Le(100),Ge(0)))).Times(AtLeast(1));

MockProgressAction mockDrawingProgressAction;

//Create the presenter and runit!
MDEWEventNexusLoadingPresenter presenter(view, getSuitableFile());
presenter.executeLoadMetadata();
vtkDataSet* product = presenter.execute(&factory, mockLoadingProgressAction, mockDrawingProgressAction);
TSM_ASSERT_THROWS_NOTHING("Should pass", presenter.setAxisLabels(product));
TSM_ASSERT_EQUALS("X Label should match exactly",
getStringFieldDataValue(product, "AxisTitleForX"),
"A (Ang)");
TSM_ASSERT_EQUALS("Y Label should match exactly",
getStringFieldDataValue(product, "AxisTitleForY"),
"B (Ang)");
TSM_ASSERT_EQUALS("Z Label should match exactly",
getStringFieldDataValue(product, "AxisTitleForZ"),
"C (Ang)");

TS_ASSERT(Mock::VerifyAndClearExpectations(view));
TS_ASSERT(Mock::VerifyAndClearExpectations(&factory));

product->Delete();
}

};
#endif
#endif

0 comments on commit f052c21

Please sign in to comment.