summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpushbutton
diff options
context:
space:
mode:
authorChris Meyer <cmeyer1969@gmail.com>2010-11-09 10:03:26 -0800
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2011-08-12 11:24:34 +0200
commit98babb1408712a14098a9a75b31c4e9603afdbc0 (patch)
treea0d54c7fdd14eb92e9a2ee91273ded60bb5f56b0 /tests/auto/qpushbutton
parent31abffa0f2feba60b7cee94d41f1e76f92e31ac0 (diff)
Fix bug QTBUG-13901, Mac style button rect
Make sure that clicks in the corners of buttons with Mac style are treated properly. Added test case.
Diffstat (limited to 'tests/auto/qpushbutton')
-rw-r--r--tests/auto/qpushbutton/tst_qpushbutton.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp
index 7742f6b567..db4f385f30 100644
--- a/tests/auto/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/qpushbutton/tst_qpushbutton.cpp
@@ -91,6 +91,9 @@ private slots:
void animateClick();
void toggle();
void clicked();
+#ifdef Q_OS_MAC
+ void macClicked();
+#endif
void toggled();
void isEnabled();
void defaultAndAutoDefault();
@@ -469,6 +472,34 @@ void tst_QPushButton::clicked()
QCOMPARE( release_count, (uint)10 );
}
+#ifdef Q_OS_MAC
+// test that the corners of a mac style button are not treated as clicks.
+// but that if a style is applied, they are.
+void tst_QPushButton::macClicked()
+{
+ QPushButton *macTestWidget = new QPushButton( "Push button" );
+ macTestWidget->show();
+ connect( macTestWidget, SIGNAL(clicked()), this, SLOT(onClicked()) );
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, QPoint(1,1) );
+ QVERIFY( click_count == 0 );
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, macTestWidget->rect().center() );
+ QVERIFY( click_count == 1 );
+
+ resetCounters();
+ macTestWidget->setStyleSheet("background: white;");
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, QPoint(1,1) );
+ QVERIFY( click_count == 1 );
+
+ QTest::mouseClick( macTestWidget, Qt::LeftButton, 0, macTestWidget->rect().center() );
+ QVERIFY( click_count == 2 );
+
+ delete macTestWidget;
+}
+#endif
+
/*
void tst_QPushButton::group()
{