From 06efa1f53e04c58c5fdf5de10d4097052da38cc4 Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Thu, 18 Jul 2024 13:48:17 +0200 Subject: [PATCH] ComboProperty: rm unused operators < == != --- GUI/Model/Descriptor/ComboProperty.cpp | 20 -------- GUI/Model/Descriptor/ComboProperty.h | 3 -- Tests/Unit/GUI/TestComboProperty.cpp | 65 -------------------------- 3 files changed, 88 deletions(-) diff --git a/GUI/Model/Descriptor/ComboProperty.cpp b/GUI/Model/Descriptor/ComboProperty.cpp index cb17abc2000..8ce95d9db5e 100644 --- a/GUI/Model/Descriptor/ComboProperty.cpp +++ b/GUI/Model/Descriptor/ComboProperty.cpp @@ -107,26 +107,6 @@ ComboProperty& ComboProperty::operator<<(const QStringList& str) return *this; } -bool ComboProperty::operator==(const ComboProperty& other) const -{ - if (m_selected_indices != other.m_selected_indices) - return false; - if (m_values != other.m_values) - return false; - return true; -} - -bool ComboProperty::operator!=(const ComboProperty& other) const -{ - return !(*this == other); -} - -bool ComboProperty::operator<(const ComboProperty& other) const -{ - return m_selected_indices.size() < other.m_selected_indices.size() - && m_values.size() < other.m_values.size(); -} - //! Constructs variant enclosing given ComboProperty. QVariant ComboProperty::variant() const diff --git a/GUI/Model/Descriptor/ComboProperty.h b/GUI/Model/Descriptor/ComboProperty.h index b242eec229b..7b3183dbfd3 100644 --- a/GUI/Model/Descriptor/ComboProperty.h +++ b/GUI/Model/Descriptor/ComboProperty.h @@ -45,9 +45,6 @@ public: ComboProperty& operator<<(const QString& str); ComboProperty& operator<<(const QStringList& str); - bool operator==(const ComboProperty& other) const; - bool operator!=(const ComboProperty& other) const; - bool operator<(const ComboProperty& other) const; QVariant variant() const; diff --git a/Tests/Unit/GUI/TestComboProperty.cpp b/Tests/Unit/GUI/TestComboProperty.cpp index b262ec22a17..375b0244809 100644 --- a/Tests/Unit/GUI/TestComboProperty.cpp +++ b/Tests/Unit/GUI/TestComboProperty.cpp @@ -85,68 +85,3 @@ TEST_F(TestComboProperty, setCurrentIndex) combo.setCurrentIndex(0); EXPECT_EQ(combo.currentValue(), "c1"); } -TEST_F(TestComboProperty, comboEquality) -{ - ComboProperty c1; - ComboProperty c2; - EXPECT_TRUE(c1 == c2); - - c1 << "a1" - << "a2"; - c2 << "a1" - << "a2"; - EXPECT_TRUE(c1 == c2); - EXPECT_FALSE(c1 != c2); - - c2 << "a3"; - EXPECT_TRUE(c1 != c2); - EXPECT_FALSE(c1 == c2); - c2.setCurrentValue("a2"); - EXPECT_TRUE(c1 != c2); - EXPECT_FALSE(c1 == c2); - - c1 << "a3"; - c1.setCurrentValue("a2"); - EXPECT_TRUE(c1 == c2); - EXPECT_FALSE(c1 != c2); - - // with selection indices - c1 = ComboProperty() << "a1" - << "a2" - << "a3"; - c2 = ComboProperty() << "a1" - << "a2" - << "a3"; - EXPECT_TRUE(c1 == c2); - - c2.setSelected(0, false); - c2.setSelected(2, true); - EXPECT_TRUE(c1 != c2); -} - -//! Check equality of ComboPeroperty's variants. -//! If comparators are not registered, the behavior is undefined. - -TEST_F(TestComboProperty, variantEquality) -{ - ComboProperty c1 = ComboProperty() << "a1" - << "a2"; - ComboProperty c2 = ComboProperty() << "a1" - << "a2"; - - if (Comparators::registered()) { - EXPECT_TRUE(c1.variant() == c2.variant()); - - c2 << "a3"; - c2.setCurrentValue("a2"); - - EXPECT_TRUE(c1.variant() != c2.variant()); - EXPECT_FALSE(c1.variant() == c2.variant()); - - c1 << "a3"; - c1.setCurrentValue("a2"); - - EXPECT_TRUE(c1.variant() == c2.variant()); - EXPECT_FALSE(c1.variant() != c2.variant()); - } -} -- GitLab