summaryrefslogtreecommitdiff
path: root/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2013-08-28 21:09:18 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-02 16:26:21 +0200
commit8f4b6f1cd166986f219e72a584fe19379880c2c5 (patch)
tree05b9994cb753d9cbf1485dc7f421eb162b69f3f0 /tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
parent0a3eb0fe443f8158d81d97cde8f0c9a9632fb9f0 (diff)
downloadqtbase-8f4b6f1cd166986f219e72a584fe19379880c2c5.tar.gz
item delegates: fix clicking on tristate checkboxes.
QCheckBox cycles through the 3 states, but item delegates didn't do that. Change-Id: Iad1e464341033ca357925fe8064f53bb584459f4 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp')
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 538cc7bb4c..439725b257 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -1198,6 +1198,57 @@ void tst_QItemDelegate::editorEvent_data()
<< (int)(Qt::LeftButton)
<< true
<< (int)(Qt::Unchecked);
+
+ QTest::newRow("unchecked, tristate, release")
+ << QRect(0, 0, 20, 20)
+ << QString("foo")
+ << (int)(Qt::Unchecked)
+ << (int)(Qt::ItemIsEditable
+ |Qt::ItemIsSelectable
+ |Qt::ItemIsUserCheckable
+ |Qt::ItemIsTristate
+ |Qt::ItemIsEnabled
+ |Qt::ItemIsDragEnabled
+ |Qt::ItemIsDropEnabled)
+ << true
+ << (int)(QEvent::MouseButtonRelease)
+ << (int)(Qt::LeftButton)
+ << true
+ << (int)(Qt::PartiallyChecked);
+
+ QTest::newRow("partially checked, tristate, release")
+ << QRect(0, 0, 20, 20)
+ << QString("foo")
+ << (int)(Qt::PartiallyChecked)
+ << (int)(Qt::ItemIsEditable
+ |Qt::ItemIsSelectable
+ |Qt::ItemIsUserCheckable
+ |Qt::ItemIsTristate
+ |Qt::ItemIsEnabled
+ |Qt::ItemIsDragEnabled
+ |Qt::ItemIsDropEnabled)
+ << true
+ << (int)(QEvent::MouseButtonRelease)
+ << (int)(Qt::LeftButton)
+ << true
+ << (int)(Qt::Checked);
+
+ QTest::newRow("checked, tristate, release")
+ << QRect(0, 0, 20, 20)
+ << QString("foo")
+ << (int)(Qt::Checked)
+ << (int)(Qt::ItemIsEditable
+ |Qt::ItemIsSelectable
+ |Qt::ItemIsUserCheckable
+ |Qt::ItemIsTristate
+ |Qt::ItemIsEnabled
+ |Qt::ItemIsDragEnabled
+ |Qt::ItemIsDropEnabled)
+ << true
+ << (int)(QEvent::MouseButtonRelease)
+ << (int)(Qt::LeftButton)
+ << true
+ << (int)(Qt::Unchecked);
}
void tst_QItemDelegate::editorEvent()