diff --git a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp index 59ba0645d5232716283e25007e8a34c9230b617b..1692fca248980355faf65a381bdae358eefa5323 100644 --- a/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp +++ b/qt/scientific_interfaces/EnggDiffraction/EnggDiffFittingPresenter.cpp @@ -285,9 +285,7 @@ void EnggDiffFittingPresenter::fittingFinished() { m_multiRunMode = false; } -void EnggDiffFittingPresenter::processSelectRun() { - updatePlot(); -} +void EnggDiffFittingPresenter::processSelectRun() { updatePlot(); } void EnggDiffFittingPresenter::processStart() {} @@ -341,9 +339,7 @@ void EnggDiffFittingPresenter::processLogMsg() { } } -void EnggDiffFittingPresenter::processUpdatePlotFitPeaks() { - updatePlot(); -} +void EnggDiffFittingPresenter::processUpdatePlotFitPeaks() { updatePlot(); } void EnggDiffFittingPresenter::processFitAllPeaks() { m_multiRunMode = true; @@ -677,7 +673,8 @@ void EnggDiffFittingPresenter::plotFocusedFile( } } -void EnggDiffFittingPresenter::plotAlignedWorkspace(const bool plotFittedPeaks) { +void EnggDiffFittingPresenter::plotAlignedWorkspace( + const bool plotFittedPeaks) { try { // detaches previous plots from canvas @@ -686,7 +683,7 @@ void EnggDiffFittingPresenter::plotAlignedWorkspace(const bool plotFittedPeaks) const auto listLabel = m_view->getFittingListWidgetCurrentValue(); if (!listLabel) { m_view->userWarning("Invalid run number or bank", - "Tried to plot a focused file which does not exist"); + "Tried to plot a focused file which does not exist"); return; } int runNumber; @@ -702,7 +699,7 @@ void EnggDiffFittingPresenter::plotAlignedWorkspace(const bool plotFittedPeaks) auto singlePeaksWS = m_model->getFittedPeaksWS(runNumber, bank); auto singlePeaksData = QwtHelper::curveDataFromWs(singlePeaksWS); m_view->setDataVector(singlePeaksData, false, true, - generateXAxisLabel(ws->getAxis(0)->unit())); + generateXAxisLabel(ws->getAxis(0)->unit())); m_view->showStatus("Peaks fitted successfully"); } } catch (std::runtime_error) { diff --git a/qt/scientific_interfaces/EnggDiffraction/IEnggDiffFittingView.h b/qt/scientific_interfaces/EnggDiffraction/IEnggDiffFittingView.h index 49a7dd44e0a60ffc3032f44cd297e1e30a5543f7..b92f9dd7a6dfde4a314878b986faac3f19ef3a6b 100644 --- a/qt/scientific_interfaces/EnggDiffraction/IEnggDiffFittingView.h +++ b/qt/scientific_interfaces/EnggDiffraction/IEnggDiffFittingView.h @@ -270,7 +270,6 @@ public: * Get whether the user has selected to plot reconstructed peaks over the run */ virtual bool plotFittedPeaksEnabled() const = 0; - }; } // namespace CustomInterfaces diff --git a/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h b/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h index 654c7b5644f963c550274874bf3503ce65ed021a..dd3e52ace404bf7369d030ecc351ae7a3b357879 100644 --- a/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h +++ b/qt/scientific_interfaces/test/EnggDiffFittingPresenterTest.h @@ -581,9 +581,8 @@ public: EXPECT_CALL(*mockModel_ptr, getFittedPeaksWS(123, 1)) .Times(1) .WillOnce(Return(WorkspaceCreationHelper::create2DWorkspace(10, 10))); - EXPECT_CALL(mockView, - setDataVector(testing::_, testing::_, testing::_, testing::_)) - .Times(2); + EXPECT_CALL(mockView, setDataVector(testing::_, testing::_, testing::_, + testing::_)).Times(2); pres.notify(IEnggDiffFittingPresenter::updatePlotFittedPeaks); TSM_ASSERT( @@ -595,69 +594,65 @@ public: void test_updatePlotFittedPeaksNoFittedPeaks() { testing::NiceMock<MockEnggDiffFittingView> mockView; auto mockModel = Mantid::Kernel::make_unique< - testing::NiceMock<MockEnggDiffFittingModel>>(); + testing::NiceMock<MockEnggDiffFittingModel>>(); auto *mockModel_ptr = mockModel.get(); EnggDiffFittingPresenterNoThread pres(&mockView, std::move(mockModel)); EXPECT_CALL(mockView, getFittingListWidgetCurrentValue()) - .Times(1) - .WillOnce(Return(boost::optional<std::string>("123_1"))); + .Times(1) + .WillOnce(Return(boost::optional<std::string>("123_1"))); EXPECT_CALL(*mockModel_ptr, hasFittedPeaksForRun(123, 1)) - .Times(1) - .WillOnce(Return(false)); + .Times(1) + .WillOnce(Return(false)); EXPECT_CALL(*mockModel_ptr, getFocusedWorkspace(123, 1)) - .Times(1) - .WillOnce(Return(WorkspaceCreationHelper::create2DWorkspace(10, 10))); + .Times(1) + .WillOnce(Return(WorkspaceCreationHelper::create2DWorkspace(10, 10))); EXPECT_CALL(mockView, plotFittedPeaksEnabled()) - .Times(1) - .WillOnce(Return(true)); - EXPECT_CALL(*mockModel_ptr, getFittedPeaksWS(123, 1)) - .Times(0); - EXPECT_CALL(mockView, - setDataVector(testing::_, testing::_, testing::_, testing::_)) - .Times(1); + .Times(1) + .WillOnce(Return(true)); + EXPECT_CALL(*mockModel_ptr, getFittedPeaksWS(123, 1)).Times(0); + EXPECT_CALL(mockView, setDataVector(testing::_, testing::_, testing::_, + testing::_)).Times(1); EXPECT_CALL(mockView, userWarning("Cannot plot fitted peaks", testing::_)) - .Times(1); + .Times(1); pres.notify(IEnggDiffFittingPresenter::updatePlotFittedPeaks); TSM_ASSERT( - "Mock not used as expected. Some EXPECT_CALL conditions were not " - "satisfied.", - testing::Mock::VerifyAndClearExpectations(&mockView)) + "Mock not used as expected. Some EXPECT_CALL conditions were not " + "satisfied.", + testing::Mock::VerifyAndClearExpectations(&mockView)) } void test_updatePlotSuccessfulFitPlotPeaksDisabled() { testing::NiceMock<MockEnggDiffFittingView> mockView; auto mockModel = Mantid::Kernel::make_unique< - testing::NiceMock<MockEnggDiffFittingModel>>(); + testing::NiceMock<MockEnggDiffFittingModel>>(); auto *mockModel_ptr = mockModel.get(); EnggDiffFittingPresenterNoThread pres(&mockView, std::move(mockModel)); EXPECT_CALL(mockView, getFittingListWidgetCurrentValue()) - .Times(2) - .WillRepeatedly(Return(boost::optional<std::string>("123_1"))); + .Times(2) + .WillRepeatedly(Return(boost::optional<std::string>("123_1"))); EXPECT_CALL(*mockModel_ptr, hasFittedPeaksForRun(123, 1)) - .Times(1) - .WillOnce(Return(true)); + .Times(1) + .WillOnce(Return(true)); EXPECT_CALL(*mockModel_ptr, getAlignedWorkspace(123, 1)) - .Times(1) - .WillOnce(Return(WorkspaceCreationHelper::create2DWorkspace(10, 10))); + .Times(1) + .WillOnce(Return(WorkspaceCreationHelper::create2DWorkspace(10, 10))); EXPECT_CALL(mockView, plotFittedPeaksEnabled()) - .Times(1) - .WillOnce(Return(false)); - EXPECT_CALL(*mockModel_ptr, getFittedPeaksWS(123, 1)) - .Times(0); - EXPECT_CALL(mockView, - setDataVector(testing::_, testing::_, testing::_, testing::_)) - .Times(1); + .Times(1) + .WillOnce(Return(false)); + EXPECT_CALL(*mockModel_ptr, getFittedPeaksWS(123, 1)).Times(0); + EXPECT_CALL(mockView, setDataVector(testing::_, testing::_, testing::_, + testing::_)).Times(1); pres.notify(IEnggDiffFittingPresenter::updatePlotFittedPeaks); TSM_ASSERT( - "Mock not used as expected. Some EXPECT_CALL conditions were not " - "satisfied.", - testing::Mock::VerifyAndClearExpectations(&mockView)) + "Mock not used as expected. Some EXPECT_CALL conditions were not " + "satisfied.", + testing::Mock::VerifyAndClearExpectations(&mockView)) } private: