diff --git a/Tests/Unit/GUI/TestAutosaveController.cpp b/Tests/Unit/GUI/TestAutosaveController.cpp index 8ae97ca265173036aea497ec68cced49987a5f62..74a9f47bc74c8d74b997700d2c56fd2ba222d945 100644 --- a/Tests/Unit/GUI/TestAutosaveController.cpp +++ b/Tests/Unit/GUI/TestAutosaveController.cpp @@ -21,6 +21,7 @@ protected: { auto* instrument = doc.instrumentsModifier()->front(); instrument->setName(QUuid::createUuid().toString()); + emit gDoc->instruments()->currentModified(); } const int m_save_wait = 3000; }; diff --git a/Tests/Unit/GUI/TestInstrumentsSet.cpp b/Tests/Unit/GUI/TestInstrumentsSet.cpp deleted file mode 100644 index 25cd091404ab0c4fd1307c0165a3431d73347963..0000000000000000000000000000000000000000 --- a/Tests/Unit/GUI/TestInstrumentsSet.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "GUI/Model/Device/InstrumentItems.h" -#include "GUI/Model/Device/InstrumentsSet.h" -#include "GUI/Model/Project/ProjectDocument.h" -#include "Tests/GTestWrapper/google_test.h" -#include <QSignalSpy> - -Q_DECLARE_METATYPE(const InstrumentItem*) - -/* Disabled 18feb24: signal no longer emitted at InstrumentsSet level - -//! Checks whether instrumentAddedRemoved will be emitted as expected - -TEST(TestInstrumentsSet, instrumentAddedRemoved) -{ - gDoc = std::make_unique<ProjectDocument>(); - - QSignalSpy spy(gDoc->instruments(), SIGNAL(setChanged())); - EXPECT_TRUE(spy.isValid()); - - // populating instrument model - auto* p = new Scatter2DInstrumentItem; - gDoc->instrumentsModifier()->push_back(p); - - // checking that a signal was emitted about the new instrument - EXPECT_EQ(spy.count(), 1); - - // removing instrument - gDoc->instrumentsModifier()->delete_element(p); - EXPECT_EQ(spy.count(), 2); -} -*/ - -//! Test whether instrumentChanged will be emitted as expected -TEST(TestInstrumentsSet, instrumentChanged) -{ - qRegisterMetaType<const InstrumentItem*>(); - gDoc = std::make_unique<ProjectDocument>(); - - // populating instrument model - auto* instrument1 = new Scatter2DInstrumentItem; - gDoc->instrumentsModifier()->push_back(instrument1); - auto* instrument2 = new SpecularInstrumentItem; - gDoc->instrumentsModifier()->push_back(instrument2); - - QSignalSpy spy(gDoc->instruments(), SIGNAL(currentModified())); - EXPECT_TRUE(spy.isValid()); - - // change other properties, e.g. id - instrument1->setId("xxxxx"); - emit gDoc->instruments()->currentModified(); - EXPECT_EQ(spy.count(), 1); - - // Add another instrument - auto* instrument3 = new OffspecInstrumentItem; - gDoc->instrumentsModifier()->push_back(instrument3); - EXPECT_EQ(spy.count(), 2); -} diff --git a/Tests/Unit/GUI/TestProjectDocument.cpp b/Tests/Unit/GUI/TestProjectDocument.cpp index f6ee1340bfa9b4062fe4cd8fd9c232f0e334328d..028eba4f9c2e8ec7cf078b762893f39fa7cf30da 100644 --- a/Tests/Unit/GUI/TestProjectDocument.cpp +++ b/Tests/Unit/GUI/TestProjectDocument.cpp @@ -22,6 +22,7 @@ protected: { auto* instrument = doc.instrumentsModifier()->front(); instrument->setName(QUuid::createUuid().toString()); + emit gDoc->instruments()->currentModified(); } };