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
d12a0172
Commit
d12a0172
authored
4 years ago
by
Matthias
Browse files
Options
Downloads
Patches
Plain Diff
add unit test (which fails without the fix)
parent
275cf833
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/UnitTests/GUI/TestSaveService.cpp
+32
-0
32 additions, 0 deletions
Tests/UnitTests/GUI/TestSaveService.cpp
with
32 additions
and
0 deletions
Tests/UnitTests/GUI/TestSaveService.cpp
+
32
−
0
View file @
d12a0172
...
...
@@ -118,12 +118,44 @@ TEST_F(TestSaveService, test_saveService) {
EXPECT_EQ
(
spySaveService
.
count
(),
1
);
EXPECT_TRUE
(
ProjectUtils
::
exists
(
projectFileName
));
EXPECT_FALSE
(
service
.
isSaving
());
// after save, document should be in non-modified state, project file name should be updated
EXPECT_EQ
(
document
->
projectFileName
(),
projectFileName
);
EXPECT_FALSE
(
document
->
isModified
());
}
//! Testing SaveService on simple documents (no heavy data).
//! SaveService should be not be able to save project file; state of service has to be !isSaving()
//! Regression test for issue #1136 ("After a failed project saving, no saving takes place any more;
//! crash when changing projects")
TEST_F
(
TestSaveService
,
test_failingSaveService
)
{
const
QString
projectDir
(
"test_failingSaveService"
);
// do NOT create dir in order to force saving to fail
const
QString
projectFileName
(
projectDir
+
"/document.pro"
);
ApplicationModels
models
;
std
::
unique_ptr
<
ProjectDocument
>
document
(
new
ProjectDocument
);
document
->
setApplicationModels
(
&
models
);
modify_models
(
&
models
);
EXPECT_FALSE
(
ProjectUtils
::
exists
(
projectFileName
));
SaveService
service
;
QSignalSpy
spySaveService
(
&
service
,
SIGNAL
(
projectSaved
()));
service
.
setDocument
(
document
.
get
());
EXPECT_THROW
(
service
.
save
(
projectFileName
),
GUIHelpers
::
Error
);
EXPECT_EQ
(
spySaveService
.
count
(),
0
);
EXPECT_FALSE
(
ProjectUtils
::
exists
(
projectFileName
));
EXPECT_FALSE
(
service
.
isSaving
());
// after failed save, document should still be in modified state
EXPECT_TRUE
(
document
->
isModified
());
}
//! Testing SaveService on documents having nonXML data.
//! SaveService should be able to save project file (in main thread) and project nonXML
//! in second thread.
...
...
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