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
4af31f8a
Commit
4af31f8a
authored
8 months ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
ComboProperty: rm unused fct selectedIndices
parent
604ad985
No related branches found
No related tags found
1 merge request
!2669
ComboProperty: rm many unused member fcts and operators
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/Model/Descriptor/ComboProperty.h
+0
-2
0 additions, 2 deletions
GUI/Model/Descriptor/ComboProperty.h
Tests/Unit/GUI/TestComboProperty.cpp
+0
-47
0 additions, 47 deletions
Tests/Unit/GUI/TestComboProperty.cpp
with
0 additions
and
49 deletions
GUI/Model/Descriptor/ComboProperty.h
+
0
−
2
View file @
4af31f8a
...
@@ -51,8 +51,6 @@ public:
...
@@ -51,8 +51,6 @@ public:
QVariant
variant
()
const
;
QVariant
variant
()
const
;
QVector
<
int
>
selectedIndices
()
const
{
return
m_selected_indices
;
}
void
setSelected
(
int
index
,
bool
value
=
true
);
void
setSelected
(
int
index
,
bool
value
=
true
);
void
setSelected
(
const
QString
&
name
,
bool
value
=
true
);
void
setSelected
(
const
QString
&
name
,
bool
value
=
true
);
...
...
This diff is collapsed.
Click to expand it.
Tests/Unit/GUI/TestComboProperty.cpp
+
0
−
47
View file @
4af31f8a
...
@@ -28,7 +28,6 @@ TEST_F(TestComboProperty, initialState)
...
@@ -28,7 +28,6 @@ TEST_F(TestComboProperty, initialState)
EXPECT_EQ
(
combo
.
values
(),
QStringList
());
EXPECT_EQ
(
combo
.
values
(),
QStringList
());
EXPECT_EQ
(
combo
.
toolTips
(),
QStringList
());
EXPECT_EQ
(
combo
.
toolTips
(),
QStringList
());
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
());
}
}
TEST_F
(
TestComboProperty
,
factoryMethods
)
TEST_F
(
TestComboProperty
,
factoryMethods
)
...
@@ -40,7 +39,6 @@ TEST_F(TestComboProperty, factoryMethods)
...
@@ -40,7 +39,6 @@ TEST_F(TestComboProperty, factoryMethods)
EXPECT_EQ
(
combo
.
values
(),
expected
);
EXPECT_EQ
(
combo
.
values
(),
expected
);
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
EXPECT_EQ
(
combo
.
currentValue
(),
""
);
EXPECT_EQ
(
combo
.
currentValue
(),
""
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
());
}
}
TEST_F
(
TestComboProperty
,
setValues
)
TEST_F
(
TestComboProperty
,
setValues
)
...
@@ -52,7 +50,6 @@ TEST_F(TestComboProperty, setValues)
...
@@ -52,7 +50,6 @@ TEST_F(TestComboProperty, setValues)
EXPECT_EQ
(
combo
.
values
(),
expectedValues
);
EXPECT_EQ
(
combo
.
values
(),
expectedValues
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a1"
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a1"
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
}));
// setting values from setter, old values have to be overriden
// setting values from setter, old values have to be overriden
QStringList
newValues
=
QStringList
()
<<
"b1"
QStringList
newValues
=
QStringList
()
<<
"b1"
...
@@ -62,7 +59,6 @@ TEST_F(TestComboProperty, setValues)
...
@@ -62,7 +59,6 @@ TEST_F(TestComboProperty, setValues)
EXPECT_EQ
(
combo
.
currentValue
(),
"b1"
);
EXPECT_EQ
(
combo
.
currentValue
(),
"b1"
);
EXPECT_EQ
(
combo
.
values
(),
newValues
);
EXPECT_EQ
(
combo
.
values
(),
newValues
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
}));
// setting new/old values through setter, old value should be preserved
// setting new/old values through setter, old value should be preserved
newValues
=
QStringList
()
<<
"c1"
newValues
=
QStringList
()
<<
"c1"
...
@@ -72,7 +68,6 @@ TEST_F(TestComboProperty, setValues)
...
@@ -72,7 +68,6 @@ TEST_F(TestComboProperty, setValues)
EXPECT_EQ
(
combo
.
currentValue
(),
"b1"
);
EXPECT_EQ
(
combo
.
currentValue
(),
"b1"
);
EXPECT_EQ
(
combo
.
values
(),
newValues
);
EXPECT_EQ
(
combo
.
values
(),
newValues
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
1
}));
}
}
TEST_F
(
TestComboProperty
,
setCurrentIndex
)
TEST_F
(
TestComboProperty
,
setCurrentIndex
)
...
@@ -83,55 +78,13 @@ TEST_F(TestComboProperty, setCurrentIndex)
...
@@ -83,55 +78,13 @@ TEST_F(TestComboProperty, setCurrentIndex)
combo
<<
"c1"
combo
<<
"c1"
<<
"c2"
;
<<
"c2"
;
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
}));
combo
.
setCurrentValue
(
"c2"
);
combo
.
setCurrentValue
(
"c2"
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
1
}));
combo
.
setCurrentIndex
(
0
);
combo
.
setCurrentIndex
(
0
);
EXPECT_EQ
(
combo
.
currentValue
(),
"c1"
);
EXPECT_EQ
(
combo
.
currentValue
(),
"c1"
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
}));
}
}
TEST_F
(
TestComboProperty
,
selectedIndices
)
{
QStringList
expectedValues
=
QStringList
()
<<
"a1"
<<
"a2"
<<
"a3"
;
ComboProperty
combo
=
ComboProperty
()
<<
expectedValues
;
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a1"
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
}));
// selecting already selected element, nothing should change
combo
.
setSelected
(
0
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a1"
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
}));
// deselecting index
combo
.
setSelected
(
0
,
false
);
EXPECT_EQ
(
combo
.
currentIndex
(),
-
1
);
EXPECT_EQ
(
combo
.
currentValue
(),
""
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
());
// selecting two indeces
combo
.
setSelected
(
1
,
true
);
combo
.
setSelected
(
2
,
true
);
EXPECT_EQ
(
combo
.
currentIndex
(),
1
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a2"
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
1
,
2
}));
// selecting by name
combo
.
setSelected
(
"a2"
,
false
);
combo
.
setSelected
(
"a1"
,
true
);
EXPECT_EQ
(
combo
.
currentIndex
(),
0
);
EXPECT_EQ
(
combo
.
currentValue
(),
"a1"
);
EXPECT_EQ
(
combo
.
selectedIndices
(),
QVector
<
int
>
({
0
,
2
}));
}
TEST_F
(
TestComboProperty
,
comboEquality
)
TEST_F
(
TestComboProperty
,
comboEquality
)
{
{
ComboProperty
c1
;
ComboProperty
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