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
1e09b18c
Commit
1e09b18c
authored
7 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
Unit test for SurfaceDensity appearance in ParticleLayoutItem
parent
f1085f5b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Tests/UnitTests/GUI/TestGUI.cpp
+1
-0
1 addition, 0 deletions
Tests/UnitTests/GUI/TestGUI.cpp
Tests/UnitTests/GUI/TestParticleLayoutItem.h
+49
-0
49 additions, 0 deletions
Tests/UnitTests/GUI/TestParticleLayoutItem.h
with
50 additions
and
0 deletions
Tests/UnitTests/GUI/TestGUI.cpp
+
1
−
0
View file @
1e09b18c
...
...
@@ -45,6 +45,7 @@
#include
"TestSessionItemData.h"
#include
"TestSessionItemTags.h"
#include
"TestMessageService.h"
#include
"TestParticleLayoutItem.h"
int
main
(
int
argc
,
char
**
argv
)
{
QCoreApplication
app
(
argc
,
argv
);
...
...
This diff is collapsed.
Click to expand it.
Tests/UnitTests/GUI/TestParticleLayoutItem.h
0 → 100644
+
49
−
0
View file @
1e09b18c
#include
"InterferenceFunctionItems.h"
#include
"ParticleLayoutItem.h"
#include
"SampleModel.h"
#include
"SessionItemUtils.h"
#include
"google_test.h"
class
TestParticleLayoutItem
:
public
::
testing
::
Test
{
public:
~
TestParticleLayoutItem
();
};
TestParticleLayoutItem
::~
TestParticleLayoutItem
()
=
default
;
using
namespace
SessionItemUtils
;
//! Checks enabled/disabled status of TotalDensity when adding interference function items.
TEST_F
(
TestParticleLayoutItem
,
densityAppearance
)
{
SampleModel
model
;
auto
layout
=
dynamic_cast
<
ParticleLayoutItem
*>
(
model
.
insertNewItem
(
Constants
::
ParticleLayoutType
));
// empty layout should have TotalDensity enabled
EXPECT_TRUE
(
layout
->
getItem
(
ParticleLayoutItem
::
P_TOTAL_DENSITY
)
->
isEnabled
());
// adding radial paracrystal shouldn't change it
auto
interference
=
model
.
insertNewItem
(
Constants
::
InterferenceFunctionRadialParaCrystalType
,
model
.
indexOfItem
(
layout
),
-
1
,
ParticleLayoutItem
::
T_INTERFERENCE
);
EXPECT_TRUE
(
layout
->
getItem
(
ParticleLayoutItem
::
P_TOTAL_DENSITY
)
->
isEnabled
());
// removing paracrystal, TotalDensity still enabled
layout
->
takeRow
(
ParentRow
(
*
interference
));
EXPECT_TRUE
(
layout
->
getItem
(
ParticleLayoutItem
::
P_TOTAL_DENSITY
)
->
isEnabled
());
delete
interference
;
// adding 2d interference, TotalDensity should be disabled
interference
=
model
.
insertNewItem
(
Constants
::
InterferenceFunction2DLatticeType
,
model
.
indexOfItem
(
layout
),
-
1
,
ParticleLayoutItem
::
T_INTERFERENCE
);
EXPECT_FALSE
(
layout
->
getItem
(
ParticleLayoutItem
::
P_TOTAL_DENSITY
)
->
isEnabled
());
// removing 2D interference, TotalIntensity should be reenabled
layout
->
takeRow
(
ParentRow
(
*
interference
));
EXPECT_TRUE
(
layout
->
getItem
(
ParticleLayoutItem
::
P_TOTAL_DENSITY
)
->
isEnabled
());
delete
interference
;
}
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