diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-19 10:41:57 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-19 10:43:14 (GMT) |
commit | 83b8d1aef2a840838bbe530794e1dd004e3a22d5 (patch) | |
tree | e4044e9df4ac15f28d45e98867d8c4c8a804d6da /tests/auto/qlistwidget | |
parent | 78b2e9421c47371b68f4c65a181a077ba3a226ac (diff) | |
download | Qt-83b8d1aef2a840838bbe530794e1dd004e3a22d5.zip Qt-83b8d1aef2a840838bbe530794e1dd004e3a22d5.tar.gz Qt-83b8d1aef2a840838bbe530794e1dd004e3a22d5.tar.bz2 |
clicking on a non focused ItemView would change the cirrent item twice
Task-number: QTBUG-8086
Reviewed-by: gabi
Diffstat (limited to 'tests/auto/qlistwidget')
-rw-r--r-- | tests/auto/qlistwidget/tst_qlistwidget.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qlistwidget/tst_qlistwidget.cpp b/tests/auto/qlistwidget/tst_qlistwidget.cpp index b3f1e1e..eb3fb6b 100644 --- a/tests/auto/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/qlistwidget/tst_qlistwidget.cpp @@ -132,6 +132,7 @@ private slots: void task199503_crashWhenCleared(); void task217070_scrollbarsAdjusted(); void task258949_keypressHangup(); + void QTBUG8086_currentItemChangedOnClick(); protected slots: @@ -1609,5 +1610,35 @@ void tst_QListWidget::task258949_keypressHangup() QCOMPARE(lw.currentIndex(), lw.model()->index(0,0)); } +void tst_QListWidget::QTBUG8086_currentItemChangedOnClick() +{ + qRegisterMetaType<QListWidgetItem*>("QListWidgetItem*"); + QWidget win; + QHBoxLayout layout(&win); + QListWidget list; + for (int i = 0 ; i < 4; ++i) + new QListWidgetItem(QString::number(i), &list); + + layout.addWidget(&list); + + QLineEdit edit; + layout.addWidget(&edit); + + edit.setFocus(); + win.show(); + + QSignalSpy spy(&list, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*))); + + QTest::qWaitForWindowShown(&win); + + QCOMPARE(spy.count(), 0); + + QTest::mouseClick(list.viewport(), Qt::LeftButton, 0, list.visualItemRect(list.item(2)).center()); + + QCOMPARE(spy.count(), 1); + +} + + QTEST_MAIN(tst_QListWidget) #include "tst_qlistwidget.moc" |