From 9720de39cc510d487181dcf45fceac41bd652d3f Mon Sep 17 00:00:00 2001 From: Joachim Wuttke <j.wuttke@fz-juelich.de> Date: Thu, 18 Jul 2024 14:42:01 +0200 Subject: [PATCH] rm TestComboProperty --- Tests/Unit/GUI/TestComboProperty.cpp | 87 ---------------------------- 1 file changed, 87 deletions(-) delete mode 100644 Tests/Unit/GUI/TestComboProperty.cpp diff --git a/Tests/Unit/GUI/TestComboProperty.cpp b/Tests/Unit/GUI/TestComboProperty.cpp deleted file mode 100644 index 375b0244809..00000000000 --- a/Tests/Unit/GUI/TestComboProperty.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#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"); -} -- GitLab