Skip to content
Snippets Groups Projects
Commit ffd0f7a6 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Autosave time increased in unit test to tackle rare buildbot failures.

parent 1ba0d8ef
No related branches found
No related tags found
No related merge requests found
...@@ -193,18 +193,19 @@ TEST_F(TestSaveService, test_autosaveEnabled) ...@@ -193,18 +193,19 @@ TEST_F(TestSaveService, test_autosaveEnabled)
SaveService service; SaveService service;
service.setAutosaveEnabled(true); service.setAutosaveEnabled(true);
const int autosave_time(100); const int autosave_time(200);
service.setAutosaveTime(autosave_time); service.setAutosaveTime(autosave_time);
service.setDocument(document.get()); service.setDocument(document.get());
QSignalSpy spySaveService(&service, SIGNAL(projectSaved())); QSignalSpy spySaveService(&service, SIGNAL(projectSaved()));
service.save(projectFileName); service.save(projectFileName);
spySaveService.wait(autosave_time * 3); // waiting saving in a thread is complete spySaveService.wait(autosave_time * 5); // waiting saving in a thread is complete
EXPECT_EQ(spySaveService.count(), 1); EXPECT_EQ(spySaveService.count(), 1);
EXPECT_FALSE(document->isModified()); EXPECT_FALSE(document->isModified());
EXPECT_TRUE(ProjectUtils::exists(projectDir + "/document.pro")); EXPECT_TRUE(ProjectUtils::exists(projectDir + "/document.pro"));
EXPECT_TRUE(ProjectUtils::exists(projectDir + "/realdata.int.gz")); EXPECT_TRUE(ProjectUtils::exists(projectDir + "/realdata.int.gz"));
spySaveService.clear();
// modify several times and check SaveService signals // modify several times and check SaveService signals
for (size_t i = 0; i < 10; ++i) for (size_t i = 0; i < 10; ++i)
...@@ -212,8 +213,8 @@ TEST_F(TestSaveService, test_autosaveEnabled) ...@@ -212,8 +213,8 @@ TEST_F(TestSaveService, test_autosaveEnabled)
EXPECT_TRUE(document->isModified()); EXPECT_TRUE(document->isModified());
spySaveService.wait(autosave_time * 3); // waiting saving in a thread is complete spySaveService.wait(autosave_time * 5); // waiting saving in a thread is complete
EXPECT_EQ(spySaveService.count(), 2); EXPECT_EQ(spySaveService.count(), 1);
EXPECT_TRUE(ProjectUtils::exists(projectDir + "/autosave/document.pro")); EXPECT_TRUE(ProjectUtils::exists(projectDir + "/autosave/document.pro"));
EXPECT_TRUE(ProjectUtils::exists(projectDir + "/autosave/realdata.int.gz")); EXPECT_TRUE(ProjectUtils::exists(projectDir + "/autosave/realdata.int.gz"));
......
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