Mantid
Loading...
Searching...
No Matches
WorkspaceDockMockObjects.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
10
11#include "MantidAPI/Workspace.h"
14#include <boost/enable_shared_from_this.hpp>
15#include <gmock/gmock.h>
16#include <memory>
17
18using namespace MantidQt::MantidWidgets;
19
21
22class MockMantidDisplayBase;
23
25public:
27 auto presenter = std::make_shared<WorkspacePresenter>(this);
28 m_presenter = std::dynamic_pointer_cast<ViewNotifiable>(presenter);
29 presenter->init();
30 }
31 ~MockWorkspaceDockView() override = default;
32
33 MOCK_CONST_METHOD2(askUserYesNo, bool(const std::string &caption, const std::string &message));
34 MOCK_CONST_METHOD2(showCriticalUserMessage, void(const std::string &caption, const std::string &message));
35
42 MOCK_METHOD1(enableClearButton, void(bool enable));
44 MOCK_METHOD2(recordWorkspaceRename, void(const std::string &oldName, const std::string &newName));
51 MOCK_METHOD2(saveWorkspace, void(const std::string &wsName, SaveFileType type));
52 MOCK_METHOD1(saveWorkspaces, void(const StringList &wsNames));
53 MOCK_METHOD1(updateTree, void(const std::map<std::string, Mantid::API::Workspace_sptr> &items));
54
56 MOCK_METHOD1(filterWorkspaces, void(const std::string &filterText));
57
60
61 // Context Menu Handlers
66 MOCK_METHOD1(plotSpectrum, void(const std::string &type));
80 MOCK_METHOD0(showSurfacePlot, void());
81 MOCK_METHOD0(showContourPlot, void());
82
84
85 // Methods which are not to be mocked
86 void enableDeletePrompt(bool) override {}
88 return std::dynamic_pointer_cast<WorkspacePresenter>(m_presenter);
89 }
90
91 void refreshWorkspaces() override {}
92
94
95private:
97};
98
100public:
103};
104
#define GNU_DIAG_ON_SUGGEST_OVERRIDE
#define GNU_DIAG_OFF_SUGGEST_OVERRIDE
virtual bool clearWorkspacesConfirmation() const =0
virtual void updateTree(const std::map< std::string, Mantid::API::Workspace_sptr > &items)=0
virtual void plotSpectrum(const std::string &type)=0
virtual SortCriteria getSortCriteria() const =0
virtual void showCriticalUserMessage(const std::string &caption, const std::string &message) const =0
virtual StringList getSelectedWorkspaceNames() const =0
virtual Mantid::API::Workspace_sptr getSelectedWorkspace() const =0
virtual void showRenameDialog(const StringList &wsNames)=0
virtual void enableClearButton(bool enable)=0
virtual void recordWorkspaceRename(const std::string &oldName, const std::string &newName)=0
virtual void saveWorkspace(const std::string &wsName, const SaveFileType type)=0
virtual void saveWorkspaces(const StringList &wsNames)=0
virtual SortDirection getSortDirection() const =0
virtual SaveFileType getSaveFileType() const =0
virtual void sortWorkspaces(SortCriteria criteria, SortDirection direction)=0
virtual bool executeAlgorithmAsync(Mantid::API::IAlgorithm_sptr alg, const bool wait=true)=0
virtual std::string getFilterText() const =0
virtual bool askUserYesNo(const std::string &caption, const std::string &message) const =0
virtual void deleteWorkspaces(const StringList &wsNames)=0
virtual bool deleteConfirmation() const =0
virtual void filterWorkspaces(const std::string &filterText)=0
MOCK_CONST_METHOD0(getFilterText, std::string())
MOCK_METHOD0(showWorkspaceData, void())
MOCK_CONST_METHOD0(getSelectedWorkspace, Mantid::API::Workspace_sptr())
MOCK_METHOD1(saveWorkspaces, void(const StringList &wsNames))
MOCK_METHOD0(showLiveDataDialog, void())
MOCK_CONST_METHOD2(showCriticalUserMessage, void(const std::string &caption, const std::string &message))
MOCK_CONST_METHOD0(clearWorkspacesConfirmation, bool())
MOCK_CONST_METHOD0(getSortCriteria, SortCriteria())
MOCK_METHOD0(convertMDHistoToMatrixWorkspace, void())
MOCK_METHOD0(saveToProgram, void())
MOCK_METHOD0(showMDPlot, void())
MOCK_METHOD0(showListData, void())
WorkspacePresenterVN_sptr m_presenter
WorkspacePresenterVN_sptr getPresenterSharedPtr()
MOCK_CONST_METHOD0(getSaveFileType, SaveFileType())
MOCK_METHOD2(saveWorkspace, void(const std::string &wsName, SaveFileType type))
MOCK_METHOD0(convertToMatrixWorkspace, void())
MOCK_METHOD0(showBoxDataTable, void())
WorkspacePresenterWN_wptr getPresenterWeakPtr() override
MOCK_METHOD0(showInstrumentView, void())
MOCK_METHOD0(showColourFillPlot, void())
MOCK_METHOD2(executeAlgorithmAsync, bool(Mantid::API::IAlgorithm_sptr alg, const bool wait))
MOCK_METHOD1(plotSpectrum, void(const std::string &type))
MOCK_METHOD0(showSpectrumViewer, void())
MOCK_CONST_METHOD0(getSortDirection, SortDirection())
MOCK_CONST_METHOD0(isPromptDelete, bool())
MOCK_CONST_METHOD0(deleteConfirmation, bool())
MOCK_METHOD0(showLoadDialog, void())
MOCK_METHOD0(showContourPlot, void())
MOCK_METHOD1(enableClearButton, void(bool enable))
MOCK_METHOD2(sortWorkspaces, void(IWorkspaceDockView::SortCriteria criteria, IWorkspaceDockView::SortDirection direction))
MOCK_METHOD0(showSurfacePlot, void())
void enableDeletePrompt(bool) override
~MockWorkspaceDockView() override=default
MOCK_METHOD0(showAlgorithmHistory, void())
MOCK_METHOD0(showLogs, void())
MOCK_CONST_METHOD0(getSelectedWorkspaceNames, StringList())
MOCK_METHOD0(clearView, void())
MOCK_METHOD0(showTransposed, void())
MOCK_METHOD2(recordWorkspaceRename, void(const std::string &oldName, const std::string &newName))
MOCK_METHOD0(showSliceViewer, void())
MOCK_CONST_METHOD2(askUserYesNo, bool(const std::string &caption, const std::string &message))
MOCK_METHOD1(deleteWorkspaces, void(const StringList &wsNames))
MOCK_METHOD1(updateTree, void(const std::map< std::string, Mantid::API::Workspace_sptr > &items))
MOCK_METHOD1(showRenameDialog, void(const StringList &wsNames))
MOCK_METHOD0(showSampleMaterialWindow, void())
MOCK_METHOD0(popupContextMenu, void())
MOCK_METHOD1(filterWorkspaces, void(const std::string &filterText))
MOCK_METHOD0(showDetectorsTable, void())
~MockWorkspaceProviderNotifiable() override=default
MOCK_METHOD1(notifyFromWorkspaceProvider, void(Flag flag))
std::shared_ptr< ViewNotifiable > WorkspacePresenterVN_sptr
std::vector< std::string > StringList
std::weak_ptr< WorkspaceProviderNotifiable > WorkspacePresenterWN_wptr
std::shared_ptr< IAlgorithm > IAlgorithm_sptr
shared pointer to Mantid::API::IAlgorithm
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Definition: Workspace_fwd.h:20