/
ReflMainViewMockObjects.h
62 lines (56 loc) · 2.68 KB
/
ReflMainViewMockObjects.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef MANTID_CUSTOMINTERFACES_REFLMAINVIEWMOCKOBJECTS_H
#define MANTID_CUSTOMINTERFACES_REFLMAINVIEWMOCKOBJECTS_H
#include <gmock/gmock.h>
#include "MantidQtCustomInterfaces/ReflMainView.h"
#include "MantidAPI/TableRow.h"
using namespace MantidQt::CustomInterfaces;
using namespace Mantid::API;
//Clean flag aliases for use within tests.
const int SaveAsFlag = ReflMainView::SaveAsFlag;
const int SaveFlag = ReflMainView::SaveFlag;
const int ProcessFlag = ReflMainView::ProcessFlag;
const int AddRowFlag = ReflMainView::AddRowFlag;
const int DeleteRowFlag = ReflMainView::DeleteRowFlag;
const int GroupRowsFlag = ReflMainView::GroupRowsFlag;
//Clean column ids for use within tests
const int RunCol = ReflMainViewPresenter::COL_RUNS;
const int ThetaCol = ReflMainViewPresenter::COL_ANGLE;
const int TransCol = ReflMainViewPresenter::COL_TRANSMISSION;
const int QMinCol = ReflMainViewPresenter::COL_QMIN;
const int QMaxCol = ReflMainViewPresenter::COL_QMAX;
const int DQQCol = ReflMainViewPresenter::COL_DQQ;
const int ScaleCol = ReflMainViewPresenter::COL_SCALE;
const int GroupCol = ReflMainViewPresenter::COL_GROUP;
const int OptionsCol = ReflMainViewPresenter::COL_OPTIONS;
class MockView : public ReflMainView
{
public:
MockView(){};
virtual void showTable(Mantid::API::ITableWorkspace_sptr model){ m_model = model;}
MOCK_METHOD3(askUserString, std::string(const std::string& prompt, const std::string& title, const std::string& defaultValue));
MOCK_METHOD2(askUserYesNo, bool(std::string, std::string));
MOCK_METHOD2(giveUserCritical, void(std::string, std::string));
MOCK_METHOD2(giveUserInfo, void(std::string, std::string));
MOCK_METHOD2(giveUserWarning, void(std::string, std::string));
MOCK_METHOD2(setProgressRange, void(int, int));
MOCK_METHOD1(setProgress, void(int));
MOCK_CONST_METHOD0(getSelectedRowIndexes, std::vector<size_t>());
MOCK_CONST_METHOD0(getSearchInstrument, std::string());
MOCK_CONST_METHOD0(getProcessInstrument, std::string());
virtual ~MockView(){}
void addDataForTest()
{
TableRow row = m_model->appendRow();
row << "13460" << "0.7" << "13463,13464" << "0.01" << "0.06" << "0.04" << 1.0 << 3 << "";
row = m_model->appendRow();
row << "13462" << "2.3" << "13463,13464" << "0.035" << "0.3" << "0.04" << 1.0 << 3 << "";
row = m_model->appendRow();
row << "13469" << "0.7" << "13463,13464" << "0.01" << "0.06" << "0.04" << 1.0 << 1 << "";
row = m_model->appendRow();
row << "13470" << "2.3" << "13463,13464" << "0.035" << "0.3" << "0.04" << 1.0 << 1 << "";
m_model->removeRow(0);
}
private:
Mantid::API::ITableWorkspace_sptr m_model;
};
#endif /*MANTID_CUSTOMINTERFACES_REFLMAINVIEWMOCKOBJECTS_H*/