Skip to content

Commit

Permalink
Update mock objects and test files
Browse files Browse the repository at this point in the history
  • Loading branch information
robertapplin committed Jan 29, 2024
1 parent 6c7dbce commit 0154344
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "Analysis/FunctionBrowser/SingleFunctionTemplateBrowser.h"
#include "Analysis/IndirectFitDataView.h"
#include "Analysis/IndirectFitPropertyBrowser.h"
#include "Common/IndirectAddWorkspaceDialog.h"
#include "MantidFrameworkTestHelpers/IndirectFitDataCreationHelper.h"
#include "MantidQtWidgets/Common/AddWorkspaceDialog.h"
#include "MockObjects.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ class MockFitScriptGeneratorPresenter : public IFitScriptGeneratorPresenter {
MOCK_METHOD3(notifyPresenterImpl, void(ViewEvent const &ev, std::string const &arg1, std::string const &arg2));
MOCK_METHOD2(notifyPresenter, void(ViewEvent const &ev, std::vector<std::string> const &vec));
MOCK_METHOD2(notifyPresenter, void(ViewEvent const &ev, FittingMode fittingMode));
MOCK_METHOD2(handleAddDomainAccepted, void(std::vector<Mantid::API::MatrixWorkspace_const_sptr> const &workspaces,
FunctionModelSpectra const &workspaceIndices));

MOCK_METHOD0(openFitScriptGenerator, void());

Expand Down Expand Up @@ -84,8 +86,8 @@ class MockFitScriptGeneratorView : public IFitScriptGeneratorView {
void(std::string const &workspaceName, WorkspaceIndex workspaceIndex, double startX, double endX));

MOCK_METHOD0(openAddWorkspaceDialog, void());
MOCK_METHOD0(getDialogWorkspaces, std::vector<Mantid::API::MatrixWorkspace_const_sptr>());
MOCK_CONST_METHOD0(getDialogWorkspaceIndices, FunctionModelSpectra());
MOCK_METHOD1(getDialogWorkspaces, std::vector<Mantid::API::MatrixWorkspace_const_sptr>(
MantidQt::MantidWidgets::IAddWorkspaceDialog *dialog));

MOCK_METHOD7(openEditLocalParameterDialog,
void(std::string const &parameter, std::vector<std::string> const &workspaceNames,
Expand Down
8 changes: 1 addition & 7 deletions qt/widgets/common/test/FitScriptGeneratorPresenterTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,10 @@ class FitScriptGeneratorPresenterTest : public CxxTest::TestSuite {
auto const workspaces = std::vector<Mantid::API::MatrixWorkspace_const_sptr>{m_workspace};
auto const workspaceIndices = FunctionModelSpectra(std::to_string(m_wsIndex.value));

ON_CALL(*m_view, getDialogWorkspaces()).WillByDefault(Return(workspaces));
ON_CALL(*m_view, getDialogWorkspaceIndices()).WillByDefault(Return(workspaceIndices));

EXPECT_CALL(*m_view, getDialogWorkspaces()).Times(1).WillOnce(Return(workspaces));
EXPECT_CALL(*m_view, getDialogWorkspaceIndices()).Times(1).WillOnce(Return(workspaceIndices));

EXPECT_CALL(*m_view, addWorkspaceDomain(m_wsName, m_wsIndex, m_startX, m_endX)).Times(1);
EXPECT_CALL(*m_model, addWorkspaceDomain(m_wsName, m_wsIndex, m_startX, m_endX)).Times(1);

m_presenter->notifyPresenter(ViewEvent::AddDomainAccepted);
m_presenter->handleAddDomainAccepted(workspaces, workspaceIndices);
}

void test_that_changing_a_start_x_will_update_its_value_in_the_model_when_the_x_value_is_valid() {
Expand Down

0 comments on commit 0154344

Please sign in to comment.