Skip to content
Snippets Groups Projects
Commit 0ee92d6f authored by Robert Applin's avatar Robert Applin
Browse files

Refs #24148. Review changes

parent 4d295004
No related branches found
No related tags found
No related merge requests found
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
void setUp() override { void setUp() override {
m_view = std::make_unique<NiceMock<MockIIndirectFitDataView>>(); m_view = std::make_unique<NiceMock<MockIIndirectFitDataView>>();
m_model = std::make_unique<NiceMock<MockIndirectFitDataModel>>(); m_model = std::make_unique<NiceMock<MockIndirectFitDataModel>>();
createEmptyTableWidget(5, 5); m_table = createEmptyTableWidget(5, 5);
m_dataTablePresenter = std::make_unique<IndirectDataTablePresenter>( m_dataTablePresenter = std::make_unique<IndirectDataTablePresenter>(
std::move(m_model.get()), std::move(m_table.get())); std::move(m_model.get()), std::move(m_table.get()));
...@@ -235,32 +235,29 @@ public: ...@@ -235,32 +235,29 @@ public:
void void
test_that_setStartX_will_alter_the_relevant_startX_column_in_the_data_table() { test_that_setStartX_will_alter_the_relevant_startX_column_in_the_data_table() {
int const startXColumn(2);
TableItem const startX(2.3); TableItem const startX(2.3);
m_presenter->setStartX(startX.asDouble(), 0, 0); m_presenter->setStartX(startX.asDouble(), 0, 0);
assertValueIsGlobal(startXColumn, startX); assertValueIsGlobal(START_X_COLUMN, startX);
} }
void void
test_that_setEndX_will_alter_the_relevant_endX_column_in_the_data_table() { test_that_setEndX_will_alter_the_relevant_endX_column_in_the_data_table() {
int const endXColumn(3);
TableItem const endX(5.5); TableItem const endX(5.5);
m_presenter->setEndX(endX.asDouble(), 0, 0); m_presenter->setEndX(endX.asDouble(), 0, 0);
assertValueIsGlobal(endXColumn, endX); assertValueIsGlobal(END_X_COLUMN, endX);
} }
void void
test_that_the_setExcludeRegion_slot_will_alter_the_relevant_excludeRegion_column_in_the_table() { test_that_the_setExcludeRegion_slot_will_alter_the_relevant_excludeRegion_column_in_the_table() {
int const excludeRegionColumn(4);
TableItem const excludeRegion("2-3"); TableItem const excludeRegion("2-3");
m_presenter->setExclude(excludeRegion.asString(), 0, 0); m_presenter->setExclude(excludeRegion.asString(), 0, 0);
assertValueIsGlobal(excludeRegionColumn, excludeRegion); assertValueIsGlobal(EXCLUDE_REGION_COLUMN, excludeRegion);
} }
void test_that_loadSettings_will_read_the_settings_from_the_view() { void test_that_loadSettings_will_read_the_settings_from_the_view() {
...@@ -274,12 +271,13 @@ public: ...@@ -274,12 +271,13 @@ public:
private: private:
/// Used in setup /// Used in setup
void createEmptyTableWidget(int rows, int columns) { std::unique_ptr<QTableWidget> createEmptyTableWidget(int columns, int rows) {
m_table = std::make_unique<QTableWidget>(rows, columns); auto table = std::make_unique<QTableWidget>(columns, rows);
for (auto column = 0; column < rows; ++column) for (auto column = 0; column < columns; ++column)
for (auto row = 0; row < columns; ++row) for (auto row = 0; row < rows; ++row)
m_table->setItem(row, column, new QTableWidgetItem("item")); table->setItem(row, column, new QTableWidgetItem("item"));
} return table;
}
void deleteSetup() { void deleteSetup() {
m_presenter.reset(); m_presenter.reset();
......
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