Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
e7c51e7d
Commit
e7c51e7d
authored
2 years ago
by
Mikhail Svechnikov
Browse files
Options
Downloads
Patches
Plain Diff
restore failingSaveService test
parent
a1dc9363
No related branches found
No related tags found
1 merge request
!1293
GUI: simplify save/load machinery
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Unit/GUI/TestSaveService.cpp
+14
-17
14 additions, 17 deletions
Tests/Unit/GUI/TestSaveService.cpp
with
14 additions
and
17 deletions
Tests/Unit/GUI/TestSaveService.cpp
+
14
−
17
View file @
e7c51e7d
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment