diff --git a/MantidQt/CustomInterfaces/CMakeLists.txt b/MantidQt/CustomInterfaces/CMakeLists.txt index 4010723d09694e4e0271dd77664438f5d40e4348..f0e69c82e7c8614a9dc0f47cd618800c15fe651d 100644 --- a/MantidQt/CustomInterfaces/CMakeLists.txt +++ b/MantidQt/CustomInterfaces/CMakeLists.txt @@ -193,6 +193,7 @@ set ( INC_FILES inc/MantidQtCustomInterfaces/Muon/MuonAnalysisOptionTab.h inc/MantidQtCustomInterfaces/Muon/MuonAnalysisResultTableTab.h inc/MantidQtCustomInterfaces/ParseKeyValueString.h + inc/MantidQtCustomInterfaces/ProgressableView.h inc/MantidQtCustomInterfaces/QReflTableModel.h inc/MantidQtCustomInterfaces/QtReflMainView.h inc/MantidQtCustomInterfaces/QtReflOptionsDialog.h diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DllConfig.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DllConfig.h index 2d33591f81a975dc019957b957855236d9c07ce6..0ac41e522ba2405421a278e7f2cb4b718c5177fd 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DllConfig.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/DllConfig.h @@ -1,6 +1,8 @@ #ifndef MANTIDQTCUSTOMINTERFACES_DLLCONFIG_H_ #define MANTIDQTCUSTOMINTERFACES_DLLCONFIG_H_ +#include "MantidKernel/System.h" + /* This file contains the DLLExport/DLLImport linkage configuration for the MantidQt CustomInterfaces library @@ -26,9 +28,9 @@ Code Documentation is available at: <http://doxygen.mantidproject.org> */ #ifdef IN_MANTIDQT_CUSTOMINTERFACES -#define MANTIDQT_CUSTOMINTERFACES_DLL Q_DECL_EXPORT +#define MANTIDQT_CUSTOMINTERFACES_DLL DLLExport #else -#define MANTIDQT_CUSTOMINTERFACES_DLL Q_DECL_IMPORT +#define MANTIDQT_CUSTOMINTERFACES_DLL DLLImport #endif #endif // MANTIDQTCUSTOMINTERFACES_DLLCONFIG_H_ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ProgressableView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ProgressableView.h new file mode 100644 index 0000000000000000000000000000000000000000..356125fa9b3401a96b6f748edda9df86eb08c718 --- /dev/null +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ProgressableView.h @@ -0,0 +1,40 @@ +#ifndef MANTID_CUSTOMINTERFACES_PROGRESSABLEVIEW_H_ +#define MANTID_CUSTOMINTERFACES_PROGRESSABLEVIEW_H_ + +#include "MantidQtCustomInterfaces/DllConfig.h" + +namespace MantidQt { +namespace CustomInterfaces { + +/** ProgressableView : Abstract view useful for indicating progress + + Copyright © 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge + National Laboratory & European Spallation Source + + This file is part of Mantid. + + Mantid is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + Mantid is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + File change history is stored at: <https://github.com/mantidproject/mantid> + Code Documentation is available at: <http://doxygen.mantidproject.org> +*/ +class MANTIDQT_CUSTOMINTERFACES_DLL ProgressableView { +public: + virtual ~ProgressableView() {} +}; + +} // namespace CustomInterfaces +} // namespace MantidQt + +#endif /* MANTID_CUSTOMINTERFACES_PROGRESSABLEVIEW_H_ */ diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h index 9afef697eac851d26f37c65428ed899de1968700..ad219e98b0ce7d7ba5347cb26d94ca0bc151589a 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/QtReflMainView.h @@ -3,6 +3,8 @@ #include "MantidKernel/System.h" #include "MantidQtAPI/UserSubWindow.h" +#include "MantidQtCustomInterfaces/DllConfig.h" +#include "MantidQtCustomInterfaces/ProgressableView.h" #include "MantidQtCustomInterfaces/ReflMainView.h" #include "MantidQtCustomInterfaces/IReflPresenter.h" #include "MantidQtCustomInterfaces/ReflSearchModel.h" @@ -39,8 +41,10 @@ namespace MantidQt File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ - class DLLExport QtReflMainView : public MantidQt::API::UserSubWindow, public ReflMainView - { + class MANTIDQT_CUSTOMINTERFACES_DLL QtReflMainView + : public MantidQt::API::UserSubWindow, + public ReflMainView, + public ProgressableView { Q_OBJECT public: QtReflMainView(QWidget *parent = 0); diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h index e7449ab191c0bdcc82459b8476c6e9c0afffc76d..82492ff65588d8136e4c1f4204fe31def65eacb7 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h @@ -34,7 +34,9 @@ namespace MantidQt class DLLExport ReflLegacyTransferStrategy : public ReflTransferStrategy { public: - std::vector<std::map<std::string,std::string> > transferRuns(const std::map<std::string,std::string>& runRows); + std::vector<std::map<std::string, std::string>> + transferRuns(const std::map<std::string, std::string> &runRows, + Mantid::Kernel::ProgressBase &progress); }; } } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainViewPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainViewPresenter.h index 67069311b1989743a3262fd1bc1acac6b5be32c9..50cfd8a512bdb62f5f11982deba580119ac44d25 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainViewPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflMainViewPresenter.h @@ -4,9 +4,9 @@ #include "MantidAPI/AnalysisDataService.h" #include "MantidAPI/ITableWorkspace_fwd.h" #include "MantidKernel/System.h" +#include "MantidQtCustomInterfaces/ReflMainView.h" #include "MantidQtCustomInterfaces/IReflPresenter.h" #include "MantidQtCustomInterfaces/IReflSearcher.h" -#include "MantidQtCustomInterfaces/ReflMainView.h" #include "MantidQtCustomInterfaces/ReflTransferStrategy.h" #include "MantidQtCustomInterfaces/QReflTableModel.h" @@ -17,6 +17,9 @@ namespace MantidQt { namespace CustomInterfaces { + // Forward decs + class ProgressableView; + /** @class ReflMainViewPresenter ReflMainViewPresenter is a presenter class for teh Reflectometry Interface. It handles any interface functionality and model manipulation. @@ -44,7 +47,10 @@ namespace MantidQt class DLLExport ReflMainViewPresenter: public IReflPresenter { public: - ReflMainViewPresenter(ReflMainView* view, boost::shared_ptr<IReflSearcher> searcher = boost::shared_ptr<IReflSearcher>()); + ReflMainViewPresenter(ReflMainView *mainView, + ProgressableView *progressView, + boost::shared_ptr<IReflSearcher> searcher = + boost::shared_ptr<IReflSearcher>()); virtual ~ReflMainViewPresenter(); virtual void notify(IReflPresenter::Flag flag); virtual const std::map<std::string,QVariant>& options() const; @@ -57,8 +63,10 @@ namespace MantidQt ReflSearchModel_sptr m_searchModel; //the name of the workspace/table/model in the ADS, blank if unsaved std::string m_wsName; - //the view we're managing + // the main view we're managing ReflMainView* m_view; + // The progress view + ProgressableView *m_progressView; //stores whether or not the table has changed since it was last saved bool m_tableDirty; //stores the user options for the presenter diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflTransferStrategy.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflTransferStrategy.h index f5ce7aa8b1fea79afebbc007b23ca00b4402ebc8..53b4de0f3936ef65066910faab070a020d13cb38 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflTransferStrategy.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/ReflTransferStrategy.h @@ -5,6 +5,12 @@ #include <string> #include <vector> +namespace Mantid { +namespace Kernel { +// Forward dec +class ProgressBase; +} +} namespace MantidQt { namespace CustomInterfaces @@ -38,11 +44,16 @@ namespace MantidQt virtual ~ReflTransferStrategy() {}; /** - * @param runRows : A map where the keys are the runs and the values the descriptions + * @param runRows : A map where the keys are the runs and the values the + * descriptions + * @param progress : Progress object to notify. * @returns A vector of maps where each map represents a row, - * with Keys matching Column headings and Values matching the row entries for those columns + * with Keys matching Column headings and Values matching the row entries + * for those columns */ - virtual std::vector<std::map<std::string,std::string> > transferRuns(const std::map<std::string,std::string>& runRows) = 0; + virtual std::vector<std::map<std::string, std::string>> + transferRuns(const std::map<std::string, std::string> &runRows, + Mantid::Kernel::ProgressBase &progress) = 0; }; } } diff --git a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp index f9612e2dfb1636412cf2384b30694f39b8489bd2..23ca711f77db5d1f6003a60610f08c7c212bc03e 100644 --- a/MantidQt/CustomInterfaces/src/QtReflMainView.cpp +++ b/MantidQt/CustomInterfaces/src/QtReflMainView.cpp @@ -63,7 +63,9 @@ namespace MantidQt connect(ui.tableSearchResults, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showSearchContextMenu(const QPoint&))); //Finally, create a presenter to do the thinking for us - m_presenter = boost::shared_ptr<IReflPresenter>(new ReflMainViewPresenter(this)); + m_presenter = boost::shared_ptr<IReflPresenter>(new ReflMainViewPresenter( + this /*main view*/, + this /*currently this concrete view is also responsibile for prog reporting*/)); } /** @@ -514,6 +516,9 @@ namespace MantidQt void QtReflMainView::setProgress(int progress) { ui.progressBar->setValue(progress); + QPalette p = palette(); + p.setColor(QPalette::Highlight, Qt::green); + ui.progressBar->setPalette(p); } /** diff --git a/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp b/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp index 02e8d9fc17cd3bfdcf5f921f4e074a777cc5cce3..915bfb7f79a75b2fd824ca0f8727b57c76f05a99 100644 --- a/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp +++ b/MantidQt/CustomInterfaces/src/ReflLegacyTransferStrategy.cpp @@ -1,5 +1,6 @@ #include "MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h" #include "MantidQtCustomInterfaces/ReflTableSchema.h" +#include "MantidKernel/ProgressBase.h" #include <algorithm> #include <boost/lexical_cast.hpp> #include <boost/regex.hpp> @@ -8,8 +9,10 @@ namespace MantidQt { namespace CustomInterfaces { - std::vector<std::map<std::string,std::string> > ReflLegacyTransferStrategy::transferRuns(const std::map<std::string,std::string>& runRows) - { + std::vector<std::map<std::string, std::string>> + ReflLegacyTransferStrategy::transferRuns( + const std::map<std::string, std::string> &runRows, + Mantid::Kernel::ProgressBase &progress) { /* * If the descriptions are the same except for theta: same group, different rows. * If the descriptions are the same including theta: same row with runs separated by '+' @@ -59,6 +62,8 @@ namespace MantidQt //Assign this description to the group it belongs to groupsByDesc[desc] = groupsByDesc[cleanDesc]; + + progress.report(); } //All the data we need is now properly organised, so we can quickly throw out the rows needed diff --git a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp index 8d17a11d9a2cfdf778105b5be66aae897a5e411f..02281b84e29292a93e2939aabe3be34d319a4723 100644 --- a/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/ReflMainViewPresenter.cpp @@ -6,9 +6,11 @@ #include "MantidAPI/TableRow.h" #include "MantidAPI/NotebookWriter.h" #include "MantidGeometry/Instrument/ParameterMap.h" +#include "MantidKernel/ProgressBase.h" #include "MantidKernel/Strings.h" #include "MantidKernel/TimeSeriesProperty.h" #include "MantidKernel/Utils.h" +#include "MantidQtCustomInterfaces/ProgressableView.h" #include "MantidQtCustomInterfaces/ReflCatalogSearcher.h" #include "MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h" #include "MantidQtCustomInterfaces/ReflMainView.h" @@ -34,6 +36,18 @@ using namespace MantidQt::MantidWidgets; namespace { +class ReflProgress : public Mantid::Kernel::ProgressBase { + +public: + ReflProgress(double start, double end, int64_t nSteps) + : ProgressBase(start, end, nSteps) {} + + void doReport(const std::string &msg) { + // TODO. + } + ~ReflProgress() {} +}; + void validateModel(ITableWorkspace_sptr model) { if (!model) throw std::runtime_error("Null pointer"); @@ -105,8 +119,10 @@ ITableWorkspace_sptr createDefaultWorkspace() { namespace MantidQt { namespace CustomInterfaces { ReflMainViewPresenter::ReflMainViewPresenter( - ReflMainView *view, boost::shared_ptr<IReflSearcher> searcher) - : m_view(view), m_tableDirty(false), m_searcher(searcher), + ReflMainView *mainView, ProgressableView *progressView, + boost::shared_ptr<IReflSearcher> searcher) + : m_view(mainView), m_progressView(progressView), m_tableDirty(false), + m_searcher(searcher), m_transferStrategy(new ReflLegacyTransferStrategy()), m_addObserver(*this, &ReflMainViewPresenter::handleAddEvent), m_remObserver(*this, &ReflMainViewPresenter::handleRemEvent), @@ -1455,7 +1471,8 @@ void ReflMainViewPresenter::transfer() { runs[run] = description; } - auto newRows = m_transferStrategy->transferRuns(runs); + ReflProgress progress(0, 1, selectedRows.size()); + auto newRows = m_transferStrategy->transferRuns(runs, progress); std::map<std::string, int> groups; // Loop over the rows (vector elements) diff --git a/MantidQt/CustomInterfaces/test/ReflLegacyTransferStrategyTest.h b/MantidQt/CustomInterfaces/test/ReflLegacyTransferStrategyTest.h index ad914424d3f52a7b96d386cbbd0d0400356aae24..4eb44ac7831dc622e1a0b586297aa6d51e77e799 100644 --- a/MantidQt/CustomInterfaces/test/ReflLegacyTransferStrategyTest.h +++ b/MantidQt/CustomInterfaces/test/ReflLegacyTransferStrategyTest.h @@ -5,12 +5,14 @@ #include <map> #include <string> #include <vector> +#include <gmock/gmock.h> #include "MantidQtCustomInterfaces/ReflLegacyTransferStrategy.h" #include "MantidQtCustomInterfaces/ReflTableSchema.h" - +#include "ReflMainViewMockObjects.h" using namespace MantidQt::CustomInterfaces; +using namespace testing; class ReflLegacyTransferStrategyTest : public CxxTest::TestSuite { @@ -50,9 +52,14 @@ public: expected.push_back(expectedRow); ReflLegacyTransferStrategy strategy; - auto output = strategy.transferRuns(input); + + MockProgressBase progress; + EXPECT_CALL(progress, doReport(_)).Times(AtLeast(1)); + + auto output = strategy.transferRuns(input, progress); TS_ASSERT_EQUALS(output, expected); + TS_ASSERT(Mock::VerifyAndClear(&progress)); } void testGroupedTransfer() @@ -82,9 +89,14 @@ public: expected.push_back(expectedRow); ReflLegacyTransferStrategy strategy; - auto output = strategy.transferRuns(input); + + MockProgressBase progress; + EXPECT_CALL(progress, doReport(_)).Times(AtLeast(1)); + + auto output = strategy.transferRuns(input, progress); TS_ASSERT_EQUALS(output, expected); + TS_ASSERT(Mock::VerifyAndClear(&progress)); } void testThetaExtraction() @@ -121,9 +133,14 @@ public: std::sort(expected.begin(), expected.end()); ReflLegacyTransferStrategy strategy; - auto output = strategy.transferRuns(input); + + MockProgressBase progress; + EXPECT_CALL(progress, doReport(_)).Times(AtLeast(1)); + + auto output = strategy.transferRuns(input, progress); TS_ASSERT_EQUALS(output, expected); + TS_ASSERT(Mock::VerifyAndClear(&progress)); } void testComplexExtraction() @@ -179,9 +196,14 @@ public: std::sort(expected.begin(), expected.end()); ReflLegacyTransferStrategy strategy; - auto output = strategy.transferRuns(input); + + MockProgressBase progress; + EXPECT_CALL(progress, doReport(_)).Times(AtLeast(1)); + + auto output = strategy.transferRuns(input, progress); TS_ASSERT_EQUALS(output, expected); + TS_ASSERT(Mock::VerifyAndClear(&progress)); } }; diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h index 65e6703e7a9f23d267b53e76698ace182fb35482..7d8543123ba003786a2abff547e4b1538d2b56cd 100644 --- a/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h +++ b/MantidQt/CustomInterfaces/test/ReflMainViewMockObjects.h @@ -2,11 +2,13 @@ #define MANTID_CUSTOMINTERFACES_REFLMAINVIEWMOCKOBJECTS_H #include <gmock/gmock.h> +#include "MantidQtCustomInterfaces/ProgressableView.h" #include "MantidQtCustomInterfaces/ReflMainView.h" #include "MantidQtCustomInterfaces/ReflSearchModel.h" #include "MantidQtCustomInterfaces/ReflTableSchema.h" #include "MantidQtCustomInterfaces/QReflTableModel.h" #include "MantidAPI/TableRow.h" +#include "MantidKernel/ProgressBase.h" using namespace MantidQt::CustomInterfaces; using namespace Mantid::API; @@ -64,4 +66,16 @@ public: virtual boost::shared_ptr<IReflPresenter> getPresenter() const {return boost::shared_ptr<IReflPresenter>();} }; +class MockProgressableView : public ProgressableView { +public: + ~MockProgressableView() {} +}; + +class MockProgressBase : public Mantid::Kernel::ProgressBase { + +public: + MOCK_METHOD1(doReport, void(const std::string &)); + ~MockProgressBase() {} +}; + #endif /*MANTID_CUSTOMINTERFACES_REFLMAINVIEWMOCKOBJECTS_H*/ diff --git a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h index 36d043f921e47425dc4ed88c241c0207f61cee26..f6c3a31f69f10c877b9d64f2cd0dce1ae5d2f34d 100644 --- a/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h +++ b/MantidQt/CustomInterfaces/test/ReflMainViewPresenterTest.h @@ -126,7 +126,8 @@ public: void testSaveNew() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); presenter.notify(IReflPresenter::NewTableFlag); @@ -143,7 +144,8 @@ public: void testSaveExisting() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -161,7 +163,8 @@ public: void testSaveAs() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -191,7 +194,8 @@ public: void testAppendRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -233,7 +237,8 @@ public: void testAppendRowSpecify() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -278,7 +283,8 @@ public: void testAppendRowSpecifyPlural() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -322,7 +328,8 @@ public: void testPrependRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -363,7 +370,8 @@ public: void testPrependRowSpecify() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -407,7 +415,8 @@ public: void testPrependRowSpecifyPlural() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -452,7 +461,8 @@ public: void testDeleteRowNone() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -485,7 +495,8 @@ public: void testDeleteRowSingle() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -522,7 +533,8 @@ public: void testDeleteRowPlural() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -562,7 +574,8 @@ public: void testProcess() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -615,7 +628,8 @@ public: void testProcessWithNotebook() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -682,7 +696,8 @@ public: createTOFWorkspace("dataB", "12346"); MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); EXPECT_CALL(mockView, getWorkspaceToOpen()) .Times(1) .WillRepeatedly(Return("TestWorkspace")); @@ -738,7 +753,8 @@ public: AnalysisDataService::Instance().addOrReplace("TestWorkspace", ws); MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); // We should receive an error EXPECT_CALL(mockView, giveUserCritical(_, _)).Times(1); @@ -755,7 +771,8 @@ public: void testBadWorkspaceLength() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); // Because we to open twice, get an error twice EXPECT_CALL(mockView, giveUserCritical(_, _)).Times(2); @@ -791,7 +808,8 @@ public: void testPromptSaveAfterAppendRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); // User hits "append row" EXPECT_CALL(mockView, getSelectedRows()) @@ -820,7 +838,8 @@ public: void testPromptSaveAfterDeleteRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); // User hits "append row" a couple of times EXPECT_CALL(mockView, getSelectedRows()) @@ -861,7 +880,8 @@ public: void testPromptSaveAndDiscard() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); // User hits "append row" a couple of times EXPECT_CALL(mockView, getSelectedRows()) @@ -883,7 +903,8 @@ public: void testPromptSaveOnOpen() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); @@ -989,7 +1010,8 @@ public: << "" << 1.0 << 5 << ""; // Row 9 MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); EXPECT_CALL(mockView, getWorkspaceToOpen()) .Times(1) @@ -1080,7 +1102,8 @@ public: void testClearRows() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1141,7 +1164,8 @@ public: void testCopyRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1166,7 +1190,8 @@ public: void testCopyRows() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1197,7 +1222,8 @@ public: void testCutRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1233,7 +1259,8 @@ public: void testCutRows() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1271,7 +1298,8 @@ public: void testPasteRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1320,7 +1348,8 @@ public: void testPasteNewRow() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1367,7 +1396,8 @@ public: void testPasteRows() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1427,7 +1457,8 @@ public: void testPasteNewRows() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); EXPECT_CALL(mockView, getWorkspaceToOpen()) @@ -1485,7 +1516,8 @@ public: void testImportTable() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); EXPECT_CALL(mockView, showAlgorithmDialog("LoadReflTBL")); presenter.notify(IReflPresenter::ImportTableFlag); @@ -1494,7 +1526,8 @@ public: void testExportTable() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); EXPECT_CALL(mockView, showAlgorithmDialog("SaveReflTBL")); presenter.notify(IReflPresenter::ExportTableFlag); @@ -1503,7 +1536,8 @@ public: void testPlotRowWarn() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); createTOFWorkspace("TOF_12345", "12345"); @@ -1536,7 +1570,8 @@ public: void testPlotGroupWarn() { MockView mockView; - ReflMainViewPresenter presenter(&mockView); + MockProgressableView mockProgress; + ReflMainViewPresenter presenter(&mockView, &mockProgress); createPrefilledWorkspace("TestWorkspace"); createTOFWorkspace("TOF_12345", "12345");