diff options
author | Markku Heikkila <markku.heikkila@digia.com> | 2011-11-11 13:35:23 (GMT) |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2011-11-11 13:35:23 (GMT) |
commit | df819cfe17f6dfd089096063524932fc4975804f (patch) | |
tree | 99509989bc58170deda5694ce03fef58ce8f73f1 /tests | |
parent | ee3f763f3642d1a098e6293fbc586b34a3e6e8be (diff) | |
download | Qt-df819cfe17f6dfd089096063524932fc4975804f.zip Qt-df819cfe17f6dfd089096063524932fc4975804f.tar.gz Qt-df819cfe17f6dfd089096063524932fc4975804f.tar.bz2 |
Fixed wrong QGroupBox check state
Handle mouserelease only if mouse is pressed in QGroupBox.
Task-number: QTBUG-19170
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgroupbox/tst_qgroupbox.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qgroupbox/tst_qgroupbox.cpp b/tests/auto/qgroupbox/tst_qgroupbox.cpp index f1388bc..f3d26ef 100644 --- a/tests/auto/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/qgroupbox/tst_qgroupbox.cpp @@ -83,6 +83,7 @@ private slots: void toggledVsClicked(); void childrenAreDisabled(); void propagateFocus(); + void task_QTBUG_19170_ignoreMouseReleseEvent(); private: bool checked; @@ -473,5 +474,27 @@ void tst_QGroupBox::propagateFocus() QTRY_COMPARE(qApp->focusWidget(), static_cast<QWidget*>(&lineEdit)); } +void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleseEvent() +{ + QGroupBox box; + box.setCheckable(true); + box.setChecked(false); + box.setTitle("This is a test for QTBUG-19170"); + box.show(); + + QStyleOptionGroupBox option; + option.initFrom(&box); + option.subControls = QStyle::SubControls(QStyle::SC_All); + QRect rect = box.style()->subControlRect(QStyle::CC_GroupBox, &option, + QStyle::SC_GroupBoxCheckBox, &box); + + QTest::mouseClick(&box, Qt::LeftButton, 0, rect.center()); + QCOMPARE(box.isChecked(), true); + + box.setChecked(false); + QTest::mouseRelease(&box, Qt::LeftButton, 0, rect.center()); + QCOMPARE(box.isChecked(), false); +} + QTEST_MAIN(tst_QGroupBox) #include "tst_qgroupbox.moc" |