summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVitaly Fanaskov <vitaly.fanaskov@qt.io>2020-02-05 10:53:19 +0100
committerVitaly Fanaskov <vitaly.fanaskov@qt.io>2020-02-11 10:37:10 +0100
commit11dc7b35c8c3957bd19087a5e3ae7cfc4f1a3343 (patch)
tree085d4730b93683229e7db306084171a0ceb7007b /tests
parente541a3f099798e2258116d3c031b35274d789783 (diff)
QComboBox: deprecate currentIndexChanged(const QString&)
Task-number: QTBUG-81845 Change-Id: Ia0ff5321423a5d3d4853bd425dd7236926f16047 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index c934f8e27b..c5be8a3f16 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -1208,8 +1208,7 @@ void tst_QComboBox::currentIndex()
QVERIFY(testWidget->currentText().isEmpty());
// spy on currentIndexChanged
- QSignalSpy indexChangedInt(testWidget, SIGNAL(currentIndexChanged(int)));
- QSignalSpy indexChangedString(testWidget, SIGNAL(currentIndexChanged(QString)));
+ QSignalSpy indexChangedSpy(testWidget, SIGNAL(currentIndexChanged(int, QString)));
// stuff items into it
foreach(QString text, initialItems) {
@@ -1233,16 +1232,12 @@ void tst_QComboBox::currentIndex()
QCOMPARE(testWidget->currentText(), expectedCurrentText);
// check that signal count is correct
- QCOMPARE(indexChangedInt.count(), expectedSignalCount);
- QCOMPARE(indexChangedString.count(), expectedSignalCount);
+ QCOMPARE(indexChangedSpy.count(), expectedSignalCount);
// compare with last sent signal values
- if (indexChangedInt.count())
- QCOMPARE(indexChangedInt.at(indexChangedInt.count() - 1).at(0).toInt(),
- testWidget->currentIndex());
- if (indexChangedString.count())
- QCOMPARE(indexChangedString.at(indexChangedString.count() - 1).at(0).toString(),
- testWidget->currentText());
+ if (indexChangedSpy.count())
+ QCOMPARE(indexChangedSpy.at(indexChangedSpy.count() - 1).at(0).toInt(),
+ testWidget->currentIndex());
if (edit) {
testWidget->setCurrentIndex(-1);
@@ -2341,7 +2336,8 @@ public:
{
QStringList list;
list << "one" << "two";
- connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));
+ connect(this, SIGNAL(currentIndexChanged(int, QString)),
+ this, SLOT(onCurrentIndexChanged(int)));
addItems(list);
}
public slots:
@@ -2767,7 +2763,7 @@ void tst_QComboBox::resetModel()
};
QComboBox cb;
StringListModel model({"1", "2"});
- QSignalSpy spy(&cb, QOverload<int>::of(&QComboBox::currentIndexChanged));
+ QSignalSpy spy(&cb, QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged));
QCOMPARE(spy.count(), 0);
QCOMPARE(cb.currentIndex(), -1); //no selection