diff --git a/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h b/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h index 616829c8e952..49bddd05bf43 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h @@ -41,6 +41,7 @@ class MockView : public ReflMainView MOCK_METHOD2(giveUserWarning, void(std::string, std::string)); MOCK_METHOD2(setProgressRange, void(int, int)); MOCK_METHOD1(setProgress, void(int)); + MOCK_METHOD1(setTableList, void(const std::set& tableList)); MOCK_METHOD2(setInstrumentList, void(const std::vector& instruments, const std::string& defaultInstrument)); MOCK_METHOD1(setInstrument, void(const std::string&)); MOCK_CONST_METHOD0(getSelectedRowIndexes, std::vector()); diff --git a/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h b/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h index 54f816cd0c3c..47b878dece07 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h @@ -97,6 +97,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -104,7 +105,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite presenter.notify(OpenTableFlag); presenter.notify(SaveFlag); - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); AnalysisDataService::Instance().remove("TestWorkspace"); } @@ -112,6 +112,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -129,9 +130,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite EXPECT_CALL(mockView, askUserString(_,_,"Workspace")).Times(1).WillOnce(Return("Workspace")); presenter.notify(SaveAsFlag); - //Check calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check that the workspace was saved TS_ASSERT(AnalysisDataService::Instance().doesExist("Workspace")); @@ -144,6 +142,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -165,9 +164,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite EXPECT_CALL(mockView, askUserString(_,_,_)).Times(0); presenter.notify(SaveFlag); - //Check calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check that the workspace was saved TS_ASSERT(AnalysisDataService::Instance().doesExist("Workspace")); @@ -180,6 +176,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -206,9 +203,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits "save" presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check that the table has been modified correctly ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->rowCount(), 6); @@ -228,6 +222,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -259,9 +254,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits "save" presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check that the table has been modified correctly ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->rowCount(), 6); @@ -283,6 +275,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -316,9 +309,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits "save" presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check that the table was modified correctly ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->rowCount(), 5); @@ -340,6 +330,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -362,9 +353,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits save presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check that the table was not modified ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->rowCount(), 4); @@ -379,6 +367,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -404,9 +393,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits "save" presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->rowCount(), 3); TS_ASSERT_EQUALS(ws->String(1, RunCol), "13469"); @@ -421,6 +407,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -448,9 +435,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits save presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check the rows were deleted as expected ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->rowCount(), 1); @@ -468,6 +452,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); createPrefilledWorkspace("TestWorkspace"); @@ -488,9 +473,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite EXPECT_CALL(mockView, setProgress(_)).Times(4); presenter.notify(ProcessFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check output workspaces were created as expected TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_13460")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_13460")); @@ -537,6 +519,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); EXPECT_CALL(mockView, getWorkspaceToOpen()).Times(1).WillRepeatedly(Return("TestWorkspace")); presenter.notify(OpenTableFlag); @@ -555,9 +538,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite EXPECT_CALL(mockView, setProgress(_)).Times(4); presenter.notify(ProcessFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check output workspaces were created as expected TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_dataA")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_13462")); @@ -591,6 +571,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); EXPECT_CALL(mockView, getWorkspaceToOpen()).Times(1).WillRepeatedly(Return("TestWorkspace")); presenter.notify(OpenTableFlag); @@ -612,9 +593,6 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite //The user hits the "save" button presenter.notify(SaveFlag); - //Check the calls were made as expected - TS_ASSERT(Mock::VerifyAndClearExpectations(&mockView)); - //Check the table was updated as expected ws = AnalysisDataService::Instance().retrieveWS("TestWorkspace"); TS_ASSERT_EQUALS(ws->String(0, ThetaCol), "0.7"); @@ -656,6 +634,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); //We should receive an error @@ -671,6 +650,7 @@ class ReflMainViewPresenterTest : public CxxTest::TestSuite { MockView mockView; EXPECT_CALL(mockView, setInstrumentList(_,_)).Times(1); + EXPECT_CALL(mockView, setTableList(_)).Times(AnyNumber()); ReflMainViewPresenter presenter(&mockView); //Because we to open twice, get an error twice