From 4af31f8a48eccb9f2d6085f413e272801c94c588 Mon Sep 17 00:00:00 2001
From: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date: Thu, 18 Jul 2024 13:46:04 +0200
Subject: [PATCH] ComboProperty: rm unused fct selectedIndices

---
 GUI/Model/Descriptor/ComboProperty.h |  2 --
 Tests/Unit/GUI/TestComboProperty.cpp | 47 ----------------------------
 2 files changed, 49 deletions(-)

diff --git a/GUI/Model/Descriptor/ComboProperty.h b/GUI/Model/Descriptor/ComboProperty.h
index 69cb583165d..b242eec229b 100644
--- a/GUI/Model/Descriptor/ComboProperty.h
+++ b/GUI/Model/Descriptor/ComboProperty.h
@@ -51,8 +51,6 @@ public:
 
     QVariant variant() const;
 
-    QVector<int> selectedIndices() const { return m_selected_indices; }
-
     void setSelected(int index, bool value = true);
     void setSelected(const QString& name, bool value = true);
 
diff --git a/Tests/Unit/GUI/TestComboProperty.cpp b/Tests/Unit/GUI/TestComboProperty.cpp
index 5c2d2842a08..b262ec22a17 100644
--- a/Tests/Unit/GUI/TestComboProperty.cpp
+++ b/Tests/Unit/GUI/TestComboProperty.cpp
@@ -28,7 +28,6 @@ TEST_F(TestComboProperty, initialState)
     EXPECT_EQ(combo.values(), QStringList());
     EXPECT_EQ(combo.toolTips(), QStringList());
     EXPECT_EQ(combo.currentIndex(), -1);
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>());
 }
 
 TEST_F(TestComboProperty, factoryMethods)
@@ -40,7 +39,6 @@ TEST_F(TestComboProperty, factoryMethods)
     EXPECT_EQ(combo.values(), expected);
     EXPECT_EQ(combo.currentIndex(), -1);
     EXPECT_EQ(combo.currentValue(), "");
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>());
 }
 
 TEST_F(TestComboProperty, setValues)
@@ -52,7 +50,6 @@ TEST_F(TestComboProperty, setValues)
     EXPECT_EQ(combo.values(), expectedValues);
     EXPECT_EQ(combo.currentValue(), "a1");
     EXPECT_EQ(combo.currentIndex(), 0);
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>({0}));
 
     // setting values from setter, old values have to be overriden
     QStringList newValues = QStringList() << "b1"
@@ -62,7 +59,6 @@ TEST_F(TestComboProperty, setValues)
     EXPECT_EQ(combo.currentValue(), "b1");
     EXPECT_EQ(combo.values(), newValues);
     EXPECT_EQ(combo.currentIndex(), 0);
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>({0}));
 
     // setting new/old values through setter, old value should be preserved
     newValues = QStringList() << "c1"
@@ -72,7 +68,6 @@ TEST_F(TestComboProperty, setValues)
     EXPECT_EQ(combo.currentValue(), "b1");
     EXPECT_EQ(combo.values(), newValues);
     EXPECT_EQ(combo.currentIndex(), 1);
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>({1}));
 }
 
 TEST_F(TestComboProperty, setCurrentIndex)
@@ -83,55 +78,13 @@ TEST_F(TestComboProperty, setCurrentIndex)
     combo << "c1"
           << "c2";
     EXPECT_EQ(combo.currentIndex(), 0);
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>({0}));
 
     combo.setCurrentValue("c2");
     EXPECT_EQ(combo.currentIndex(), 1);
-    EXPECT_EQ(combo.selectedIndices(), QVector<int>({1}));
 
     combo.setCurrentIndex(0);
     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)
 {
     ComboProperty c1;
-- 
GitLab