From 2cf131374bf7c84f6cfbe147c6153225c4abf51c Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Fri, 17 Nov 2023 17:55:31 +0100 Subject: [PATCH] adapt test --- GUI/Model/Model/DatafilesModel.cpp | 4 +--- GUI/Model/Model/DatafilesModel.h | 3 +-- GUI/Model/Project/ProjectDocument.cpp | 1 - Tests/Unit/GUI/{TestRealModel.cpp => TestDatafilesModel.cpp} | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) rename Tests/Unit/GUI/{TestRealModel.cpp => TestDatafilesModel.cpp} (98%) diff --git a/GUI/Model/Model/DatafilesModel.cpp b/GUI/Model/Model/DatafilesModel.cpp index 30c3d4cc8f6..e005ec14366 100644 --- a/GUI/Model/Model/DatafilesModel.cpp +++ b/GUI/Model/Model/DatafilesModel.cpp @@ -27,9 +27,7 @@ const QString SelectedRank("SelectedRank"); } // namespace Tag } // namespace -DatafilesModel::DatafilesModel(InstrumentModel* instrumentModel, QObject* parent) - : QObject(parent) - , m_instrumentModel(instrumentModel) +DatafilesModel::DatafilesModel() { setObjectName("DatafilesModel"); } diff --git a/GUI/Model/Model/DatafilesModel.h b/GUI/Model/Model/DatafilesModel.h index 009c00a86f4..9ab1cc4b0e7 100644 --- a/GUI/Model/Model/DatafilesModel.h +++ b/GUI/Model/Model/DatafilesModel.h @@ -28,7 +28,7 @@ class DatafileItem; class DatafilesModel : public QObject { Q_OBJECT public: - explicit DatafilesModel(InstrumentModel* instrumentModel = nullptr, QObject* parent = nullptr); + explicit DatafilesModel(); ~DatafilesModel(); QVector<DataItem*> dataItems() const; @@ -61,7 +61,6 @@ public: private: DatafilesCleaner dataFilesCleaner; - InstrumentModel* m_instrumentModel; std::vector<std::unique_ptr<DatafileItem>> m_realItems; int m_selectedIndex = -1; int m_selectedRank = -1; diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp index 8460d121231..018f80bc9e8 100644 --- a/GUI/Model/Project/ProjectDocument.cpp +++ b/GUI/Model/Project/ProjectDocument.cpp @@ -52,7 +52,6 @@ const QString ActiveView("ActiveView"); ProjectDocument::ProjectDocument() : m_modified(false) , m_instrumentEditController(&m_instrumentModel) - , m_realModel(&m_instrumentModel) , m_lastViewActive(GUI::ID::ViewId::Instrument) { connect(&m_instrumentEditController, &MultiInstrumentNotifier::instrumentAddedOrRemoved, this, diff --git a/Tests/Unit/GUI/TestRealModel.cpp b/Tests/Unit/GUI/TestDatafilesModel.cpp similarity index 98% rename from Tests/Unit/GUI/TestRealModel.cpp rename to Tests/Unit/GUI/TestDatafilesModel.cpp index e3dde26fcf5..12226e2b9e2 100644 --- a/Tests/Unit/GUI/TestRealModel.cpp +++ b/Tests/Unit/GUI/TestDatafilesModel.cpp @@ -84,7 +84,7 @@ TEST(TestDatafilesModel, saveXMLData) UTest::GUI::create_dir(dir); InstrumentModel instrument_model; - DatafilesModel model1(&instrument_model); + DatafilesModel model1; // add specular DatafileItems with non-default parameters auto* spec1 = model1.insertDataItem(1); @@ -118,7 +118,7 @@ TEST(TestDatafilesModel, saveXMLData) EXPECT_TRUE(QFile::exists(file1)); // read data to the second model - DatafilesModel model2(&instrument_model); + DatafilesModel model2; UTest::GUI::readXMLFile<DatafilesModel>(file1, model2, tag); // write the second model back to disk -- GitLab