summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets
diff options
context:
space:
mode:
authorMarkku Heikkila <markku.heikkila@digia.com>2011-11-11 14:35:23 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-14 10:34:24 +0100
commitd7695e82ac7a835160ffe3424a745e31eec2a32e (patch)
treea9fb67021a4aeac638a0e877bb8a4008774df369 /tests/auto/widgets/widgets
parentad20e965d731164504521a7dac91f3e40e3455d8 (diff)
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> (cherry picked from commit df819cfe17f6dfd089096063524932fc4975804f) Change-Id: Idf819cfe17f6dfd089096063524932fc4975804f
Diffstat (limited to 'tests/auto/widgets/widgets')
-rw-r--r--tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
index 8568ef01d1..21360d8899 100644
--- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
+++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp
@@ -81,6 +81,7 @@ private slots:
void toggledVsClicked();
void childrenAreDisabled();
void propagateFocus();
+ void task_QTBUG_19170_ignoreMouseReleseEvent();
private:
bool checked;
@@ -471,5 +472,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"