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
fbfb6dd1
Commit
fbfb6dd1
authored
6 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Patches
Plain Diff
More tests: moving middle layer on top
parent
189f1b98
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/TestMultiLayerItem.h
+85
-0
85 additions, 0 deletions
Tests/UnitTests/GUI/TestMultiLayerItem.h
with
85 additions
and
0 deletions
Tests/UnitTests/GUI/TestMultiLayerItem.h
+
85
−
0
View file @
fbfb6dd1
...
...
@@ -13,6 +13,7 @@ public:
TestMultiLayerItem
::~
TestMultiLayerItem
()
=
default
;
//! Testing layer appearance (enabled, disabled) in a MultiLayer made of two default layers.
//! In two layer system top and bottom layers should have disabled thickness and roughness.
TEST_F
(
TestMultiLayerItem
,
test_twoLayerSystem
)
{
...
...
@@ -40,3 +41,87 @@ TEST_F(TestMultiLayerItem, test_twoLayerSystem)
EXPECT_EQ
(
bottom
->
getGroupItem
(
LayerItem
::
P_ROUGHNESS
)
->
modelType
(),
Constants
::
LayerZeroRoughnessType
);
}
//! Testing layer appearance (enabled, disabled) in a MultiLayer made of three default layers.
//! In three layer system middle layer's thickness/roughness should be enabled.
TEST_F
(
TestMultiLayerItem
,
test_threeLayerSystem
)
{
SampleModel
model
;
auto
multilayer
=
model
.
insertNewItem
(
Constants
::
MultiLayerType
);
auto
top
=
model
.
insertNewItem
(
Constants
::
LayerType
,
model
.
indexOfItem
(
multilayer
));
auto
middle
=
model
.
insertNewItem
(
Constants
::
LayerType
,
model
.
indexOfItem
(
multilayer
));
auto
bottom
=
model
.
insertNewItem
(
Constants
::
LayerType
,
model
.
indexOfItem
(
multilayer
));
// Thickness property should be disabled for top and bottom layers and enabled for middle
EXPECT_FALSE
(
top
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
EXPECT_TRUE
(
middle
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
EXPECT_FALSE
(
bottom
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
// Thickness value should be 0.0 for top and bottom layers
EXPECT_EQ
(
top
->
getItemValue
(
LayerItem
::
P_THICKNESS
).
toDouble
(),
0.0
);
EXPECT_EQ
(
middle
->
getItemValue
(
LayerItem
::
P_THICKNESS
).
toDouble
(),
0.0
);
EXPECT_EQ
(
bottom
->
getItemValue
(
LayerItem
::
P_THICKNESS
).
toDouble
(),
0.0
);
// Roughness group property should be disabled for top, and enabled for other layers
EXPECT_FALSE
(
top
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
EXPECT_TRUE
(
middle
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
EXPECT_TRUE
(
bottom
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
// Default roughness should be "LayerZeroRoughness"
EXPECT_EQ
(
top
->
getGroupItem
(
LayerItem
::
P_ROUGHNESS
)
->
modelType
(),
Constants
::
LayerZeroRoughnessType
);
EXPECT_EQ
(
middle
->
getGroupItem
(
LayerItem
::
P_ROUGHNESS
)
->
modelType
(),
Constants
::
LayerZeroRoughnessType
);
EXPECT_EQ
(
bottom
->
getGroupItem
(
LayerItem
::
P_ROUGHNESS
)
->
modelType
(),
Constants
::
LayerZeroRoughnessType
);
}
//! Testing middle layer appearance when it is moved to the top.
//! In three layer system, the moving of middle layer on top should lead to the disabling
//! of roughness/thickness.
TEST_F
(
TestMultiLayerItem
,
test_movingMiddleLayerOnTop
)
{
SampleModel
model
;
auto
multilayer
=
model
.
insertNewItem
(
Constants
::
MultiLayerType
);
auto
top
=
model
.
insertNewItem
(
Constants
::
LayerType
,
model
.
indexOfItem
(
multilayer
));
auto
middle
=
model
.
insertNewItem
(
Constants
::
LayerType
,
model
.
indexOfItem
(
multilayer
));
auto
bottom
=
model
.
insertNewItem
(
Constants
::
LayerType
,
model
.
indexOfItem
(
multilayer
));
const
double
thickness
=
10.0
;
middle
->
setItemValue
(
LayerItem
::
P_THICKNESS
,
thickness
);
// Thickness property should be disabled for top and bottom layers and enabled for middle
EXPECT_FALSE
(
top
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
EXPECT_TRUE
(
middle
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
EXPECT_FALSE
(
bottom
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
// Roughness group property should be disabled for top, and enabled for other layers
EXPECT_FALSE
(
top
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
EXPECT_TRUE
(
middle
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
EXPECT_TRUE
(
bottom
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
// Thickness value should be 0.0 for top and bottom layers
EXPECT_EQ
(
top
->
getItemValue
(
LayerItem
::
P_THICKNESS
).
toDouble
(),
0.0
);
EXPECT_EQ
(
middle
->
getItemValue
(
LayerItem
::
P_THICKNESS
).
toDouble
(),
thickness
);
EXPECT_EQ
(
bottom
->
getItemValue
(
LayerItem
::
P_THICKNESS
).
toDouble
(),
0.0
);
// Moving middle layer to top
model
.
moveItem
(
middle
,
multilayer
,
0
,
MultiLayerItem
::
T_LAYERS
);
// checking that middle is top now, and top layer is middle now
EXPECT_EQ
(
middle
,
multilayer
->
getChildrenOfType
(
Constants
::
LayerType
).
at
(
0
));
EXPECT_EQ
(
top
,
multilayer
->
getChildrenOfType
(
Constants
::
LayerType
).
at
(
1
));
// Thickness and roughness of middle layer should be disabled now
EXPECT_FALSE
(
middle
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
EXPECT_FALSE
(
middle
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
// Thickness and roughness of former top layer should be enabled now
EXPECT_TRUE
(
top
->
getItem
(
LayerItem
::
P_THICKNESS
)
->
isEnabled
());
EXPECT_TRUE
(
top
->
getItem
(
LayerItem
::
P_ROUGHNESS
)
->
isEnabled
());
}
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