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
9720de39
Commit
9720de39
authored
8 months ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
rm TestComboProperty
parent
f9a37a6c
No related branches found
No related tags found
1 merge request
!2669
ComboProperty: rm many unused member fcts and operators
Pipeline
#151664
passed
8 months ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Unit/GUI/TestComboProperty.cpp
+0
-87
0 additions, 87 deletions
Tests/Unit/GUI/TestComboProperty.cpp
with
0 additions
and
87 deletions
Tests/Unit/GUI/TestComboProperty.cpp
deleted
100644 → 0
+
0
−
87
View file @
f9a37a6c
#include
"GUI/Model/Descriptor/ComboProperty.h"
#include
"Tests/GTestWrapper/google_test.h"
#include
"Tests/Unit/GUI/Utils.h"
//! Helper class to register custom variants comparators and to report
//! unit tests if comparators should be tested.
class
Comparators
{
public:
static
void
registerComparators
()
{
m_is_registered
=
true
;
}
static
bool
registered
()
{
return
m_is_registered
;
}
private
:
static
bool
m_is_registered
;
};
bool
Comparators
::
m_is_registered
=
false
;
class
TestComboProperty
:
public
::
testing
::
Test
{
public:
TestComboProperty
()
{
Comparators
::
registerComparators
();
}
};
TEST_F
(
TestComboProperty
,
initialState
)
{
ComboProperty
combo
;
EXPECT_EQ
(
combo
.
currentValue
(),
""
);
EXPECT_EQ
(
combo
.
values
(),
QStringList
());
EXPECT_EQ
(
combo
.
toolTips
(),
QStringList
());
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
}
TEST_F
(
TestComboProperty
,
factoryMethods
)
{
// initialization from list sets values only, no index selected
QStringList
expected
=
QStringList
()
<<
"a1"
<<
"a2"
;
ComboProperty
combo
=
ComboProperty
::
fromList
(
expected
);
EXPECT_EQ
(
combo
.
values
(),
expected
);
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
EXPECT_EQ
(
combo
.
currentValue
(),
""
);
}
TEST_F
(
TestComboProperty
,
setValues
)
{
// seting values through stream
QStringList
expectedValues
=
QStringList
()
<<
"a1"
<<
"a2"
;
ComboProperty
combo
=
ComboProperty
()
<<
expectedValues
;
EXPECT_EQ
(
combo
.
values
(),
expectedValues
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a1"
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
// setting values from setter, old values have to be overriden
QStringList
newValues
=
QStringList
()
<<
"b1"
<<
"b2"
<<
"b3"
;
combo
.
setValues
(
newValues
);
EXPECT_EQ
(
combo
.
currentValue
(),
"b1"
);
EXPECT_EQ
(
combo
.
values
(),
newValues
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
// setting new/old values through setter, old value should be preserved
newValues
=
QStringList
()
<<
"c1"
<<
"b1"
<<
"c2"
;
combo
.
setValues
(
newValues
);
EXPECT_EQ
(
combo
.
currentValue
(),
"b1"
);
EXPECT_EQ
(
combo
.
values
(),
newValues
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
}
TEST_F
(
TestComboProperty
,
setCurrentIndex
)
{
ComboProperty
combo
;
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
combo
<<
"c1"
<<
"c2"
;
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
combo
.
setCurrentValue
(
"c2"
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
combo
.
setCurrentIndex
(
0
);
EXPECT_EQ
(
combo
.
currentValue
(),
"c1"
);
}
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