/
ReflMainViewMockObjects.h
89 lines (82 loc) · 3.71 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#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;
class ConstructView : public ReflMainView
{
public:
ConstructView(){};
MOCK_METHOD1(showTable, void(Mantid::API::ITableWorkspace_sptr));
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 ~ConstructView(){}
};
class MockView : public ReflMainView
{
public:
MockView(){};
virtual void showTable(Mantid::API::ITableWorkspace_sptr model){(void)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(){}
};
class AddDelProcView : public ReflMainView
{
public:
AddDelProcView(){};
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 ~AddDelProcView(){}
void addDataForTest()
{
TableRow row = m_model->appendRow();
row << "13460" << "0.7" << "13463,13464" << "0.01" << "0.06" << "0.04" << "1" << 3;
row = m_model->appendRow();
row << "13462" << "2.3" << "13463,13464" << "0.035" << "0.3" << "0.04" << "1" << 3;
row = m_model->appendRow();
row << "13469" << "0.7" << "13463,13464" << "0.01" << "0.06" << "0.04" << "1" << 1;
row = m_model->appendRow();
row << "13470" << "2.3" << "13463,13464" << "0.035" << "0.3" << "0.04" << "1" << 1;
m_model->removeRow(0);
}
private:
Mantid::API::ITableWorkspace_sptr m_model;
};
#endif /*MANTID_CUSTOMINTERFACES_REFLMAINVIEWMOCKOBJECTS_H*/