diff options
Diffstat (limited to 'tests/auto/qpushbutton/tst_qpushbutton.cpp')
-rw-r--r-- | tests/auto/qpushbutton/tst_qpushbutton.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/qpushbutton/tst_qpushbutton.cpp b/tests/auto/qpushbutton/tst_qpushbutton.cpp index 7742f6b..db4f385 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() { |