diff options
Diffstat (limited to 'tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp')
-rw-r--r-- | tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp index eb108a40de..e5a891912f 100644 --- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp +++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp @@ -34,7 +34,9 @@ #include <qapplication.h> #include <qpainter.h> #include <qstyleoption.h> -#include <qkeysequence.h> +#if QT_CONFIG(shortcut) +# include <qkeysequence.h> +#endif #include <qevent.h> #include <qgridlayout.h> #include <qabstractbutton.h> @@ -59,7 +61,9 @@ private slots: void setText(); void setIcon(); +#if QT_CONFIG(shortcut) void setShortcut(); +#endif void animateClick(); @@ -68,7 +72,9 @@ private slots: void isChecked(); void toggled(); void setEnabled(); +#if QT_CONFIG(shortcut) void shortcutEvents(); +#endif void stopRepeatTimer(); void mouseReleased(); // QTBUG-53244 @@ -164,8 +170,10 @@ void tst_QAbstractButton::init() testWidget->setEnabled( true ); testWidget->setDown( false ); testWidget->setAutoRepeat( false ); +#if QT_CONFIG(shortcut) QKeySequence seq; testWidget->setShortcut( seq ); +#endif toggle_count = 0; press_count = 0; @@ -336,17 +344,17 @@ void tst_QAbstractButton::setText() QCOMPARE( testWidget->text(), QString("simple") ); testWidget->setText("&ersand"); QCOMPARE( testWidget->text(), QString("&ersand") ); -#ifndef Q_OS_MAC // no mneonics on Mac. +#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac. QCOMPARE( testWidget->shortcut(), QKeySequence("ALT+A")); #endif testWidget->setText("te&st"); QCOMPARE( testWidget->text(), QString("te&st") ); -#ifndef Q_OS_MAC // no mneonics on Mac. +#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac. QCOMPARE( testWidget->shortcut(), QKeySequence("ALT+S")); #endif testWidget->setText("foo"); QCOMPARE( testWidget->text(), QString("foo") ); -#ifndef Q_OS_MAC // no mneonics on Mac. +#if QT_CONFIG(shortcut) && !defined(Q_OS_DARWIN) // no mnemonics on Mac. QCOMPARE( testWidget->shortcut(), QKeySequence()); #endif } @@ -471,6 +479,7 @@ void tst_QAbstractButton::toggled() testWidget->setCheckable(false); } +#if QT_CONFIG(shortcut) void tst_QAbstractButton::setShortcut() { if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) @@ -502,6 +511,7 @@ void tst_QAbstractButton::setShortcut() // qDebug() << click_count; } +#endif // QT_CONFIG(shortcut) void tst_QAbstractButton::animateClick() { @@ -512,6 +522,8 @@ void tst_QAbstractButton::animateClick() QTRY_VERIFY( !testWidget->isDown() ); } +#if QT_CONFIG(shortcut) + void tst_QAbstractButton::shortcutEvents() { MyButton button; @@ -535,6 +547,8 @@ void tst_QAbstractButton::shortcutEvents() QCOMPARE(clickedSpy.count(), 3); } +#endif // QT_CONFIG(shortcut) + void tst_QAbstractButton::stopRepeatTimer() { MyButton button; |