Skip to content
Snippets Groups Projects
Commit e7c51e7d authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

restore failingSaveService test

parent a1dc9363
No related branches found
No related tags found
1 merge request!1293GUI: simplify save/load machinery
......@@ -104,29 +104,26 @@ TEST_F(TestSaveService, autoSaveControllerNewDocument)
TEST_F(TestSaveService, failingSaveService)
{
// const QString projectDir("test_failingSaveService");
// // do NOT create dir in order to force saving to fail
// const QString projectFileName(projectDir + "/document.pro");
const QString projectDir("test_failingSaveService");
// do NOT create dir in order to force saving to fail
const QString projectFileName(projectDir + "/document.pro");
// std::unique_ptr<ProjectDocument> document(new ProjectDocument);
// auto* instrument = document->instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
// instrument->setInstrumentName("GISAS");
// modify_models(*document);
std::unique_ptr<ProjectDocument> document(new ProjectDocument);
auto* instrument = document->instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
instrument->setInstrumentName("GISAS");
modify_models(*document);
// EXPECT_FALSE(QFile::exists(projectFileName));
EXPECT_FALSE(QFile::exists(projectFileName));
// SaveService service;
// QSignalSpy spySaveService(&service, SIGNAL(projectSaved()));
QSignalSpy spyDocument(document.get(), SIGNAL(modifiedStateChanged()));
// service.setDocument(document.get());
// EXPECT_THROW(service.save(projectFileName), Error);
EXPECT_THROW(document->saveProjectFileWithData(projectFileName), Error);
// EXPECT_EQ(spySaveService.count(), 0);
// EXPECT_FALSE(QFile::exists(projectFileName));
// EXPECT_FALSE(service.isSaving());
EXPECT_EQ(spyDocument.count(), 0);
EXPECT_FALSE(QFile::exists(projectFileName));
// // after failed save, document should still be in modified state
// EXPECT_TRUE(document->isModified());
// after failed save, document should still be in modified state
EXPECT_TRUE(document->isModified());
}
//! Testing SaveService when autosave is enabled.
......
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