Skip to content
Snippets Groups Projects
Commit 01bd9097 authored by Lamar Moore's avatar Lamar Moore
Browse files

Re #15360 fix PeakColumn::getReadOnly and added unit test

parent 341b5642
No related branches found
No related tags found
No related merge requests found
...@@ -206,7 +206,7 @@ void PeakColumn::read(size_t index, const std::string &text) { ...@@ -206,7 +206,7 @@ void PeakColumn::read(size_t index, const std::string &text) {
//------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------
/** @return true if the column is read-only */ /** @return true if the column is read-only */
bool PeakColumn::getReadOnly() const { bool PeakColumn::getReadOnly() const {
return ((m_name == "h") || (m_name == "k") || (m_name == "l") || return !((m_name == "h") || (m_name == "k") || (m_name == "l") ||
(m_name == "RunNumber")); (m_name == "RunNumber"));
} }
......
...@@ -106,6 +106,16 @@ public: ...@@ -106,6 +106,16 @@ public:
TS_ASSERT_EQUALS(qlab1, m_peaks[1].getQLabFrame()); TS_ASSERT_EQUALS(qlab1, m_peaks[1].getQLabFrame());
} }
void test_get_read_only_returns_correct_value() {
PeakColumn pc1(m_peaks, "h");
auto readOnly = pc1.getReadOnly();
TS_ASSERT(!readOnly);
PeakColumn pc2(m_peaks, "DetID");
readOnly = pc2.getReadOnly();
TS_ASSERT(readOnly);
}
private: private:
Mantid::Geometry::Instrument_sptr m_inst; Mantid::Geometry::Instrument_sptr m_inst;
std::vector<Peak> m_peaks; std::vector<Peak> m_peaks;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment