From b743da8cff8b72a371214c1959e34d8cf9086aa3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 6 Aug 2009 10:51:53 +0200 Subject: Fixed QComboBox test on slow window manager --- tests/auto/qcombobox/tst_qcombobox.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auto/qcombobox/tst_qcombobox.cpp') diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 67c9ac9e17..bd11fa412e 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2092,7 +2092,7 @@ void tst_QComboBox::task190205_setModelAdjustToContents() #endif // box should be resized to the same size as correctBox - QCOMPARE(box.size(), correctBox.size()); + QTRY_COMPARE(box.size(), correctBox.size()); } void tst_QComboBox::task248169_popupWithMinimalSize() @@ -2199,7 +2199,7 @@ void tst_QComboBox::noScrollbar() QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible()); QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible()); } - + { QTableWidget *table = new QTableWidget(2,2); QComboBox comboBox; -- cgit v1.2.3 From 8c621378e79a417fc7512691bf07023c1496aac0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 7 Aug 2009 09:58:29 +0200 Subject: Fixes: QComboBox keyboard search not working properly when current index is -1 If the current index is invalid, start would be (0,0) but would be skiped Task-number: 220195 Reviewed-by: thierry --- tests/auto/qcombobox/tst_qcombobox.cpp | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'tests/auto/qcombobox/tst_qcombobox.cpp') diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index bd11fa412e..4797698531 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -139,6 +139,7 @@ private slots: void task190205_setModelAdjustToContents(); void task248169_popupWithMinimalSize(); void task247863_keyBoardSelection(); + void task220195_keyBoardSelection2(); void setModelColumn(); void noScrollbar_data(); void noScrollbar(); @@ -2138,6 +2139,40 @@ void tst_QComboBox::task247863_keyBoardSelection() QCOMPARE(spy.count(), 1); } +void tst_QComboBox::task220195_keyBoardSelection2() +{ + QComboBox combo; + combo.setEditable(false); + combo.addItem( QLatin1String("foo1")); + combo.addItem( QLatin1String("foo2")); + combo.addItem( QLatin1String("foo3")); + combo.show(); + QApplication::setActiveWindow(&combo); + QTest::qWait(100); + + combo.setCurrentIndex(-1); + QVERIFY(combo.currentText().isNull()); + + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo1")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo2")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo3")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo1")); + QTest::qWait(QApplication::keyboardInputInterval() + 30); + + combo.setCurrentIndex(1); + QCOMPARE(combo.currentText(), QLatin1String("foo2")); + QTest::keyClick(&combo, 'f'); + QCOMPARE(combo.currentText(), QLatin1String("foo3")); +} + + void tst_QComboBox::setModelColumn() { QStandardItemModel model(5,3); @@ -2238,5 +2273,6 @@ void tst_QComboBox::task253944_itemDelegateIsReset() QCOMPARE(comboBox.itemDelegate(), itemDelegate); } + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" -- cgit v1.2.3