diff options
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r-- | tests/auto/widgets/kernel/kernel.pro | 3 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qaction/tst_qaction.cpp | 18 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp | 20 |
3 files changed, 39 insertions, 2 deletions
diff --git a/tests/auto/widgets/kernel/kernel.pro b/tests/auto/widgets/kernel/kernel.pro index af85a2bd13..5c5868e607 100644 --- a/tests/auto/widgets/kernel/kernel.pro +++ b/tests/auto/widgets/kernel/kernel.pro @@ -22,3 +22,6 @@ SUBDIRS=\ darwin:SUBDIRS -= \ # Uses native recognizers qgesturerecognizer \ + +!qtConfig(shortcut): SUBDIRS -= \ + qshortcut diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index 1247f48dd0..66a82d512d 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp @@ -57,18 +57,24 @@ private slots: void setIconText(); void setUnknownFont(); void actionEvent(); +#if QT_CONFIG(shortcut) void setStandardKeys(); void alternateShortcuts(); void enabledVisibleInteraction(); void task200823_tooltip(); +#endif void task229128TriggeredSignalWithoutActiongroup(); void task229128TriggeredSignalWhenInActiongroup(); +#if QT_CONFIG(shortcut) void repeat(); +#endif void setData(); +#if QT_CONFIG(shortcut) void keysequence(); // QTBUG-53381 void disableShortcutsWithBlockedWidgets_data(); void disableShortcutsWithBlockedWidgets(); void shortcutFromKeyEvent(); // QTBUG-48325 +#endif private: QEvent::Type m_lastEventType; @@ -221,6 +227,8 @@ void tst_QAction::actionEvent() QCOMPARE(m_lastAction, &a); } +#if QT_CONFIG(shortcut) + //basic testing of standard keys void tst_QAction::setStandardKeys() { @@ -367,6 +375,8 @@ void tst_QAction::task200823_tooltip() QCOMPARE(action->toolTip(), ref); } +#endif // QT_CONFIG(shortcut) + void tst_QAction::task229128TriggeredSignalWithoutActiongroup() { // test without a group @@ -408,6 +418,8 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup() QCOMPARE(actionSpy.count(), 1); } +#if QT_CONFIG(shortcut) + void tst_QAction::repeat() { if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) @@ -452,6 +464,8 @@ void tst_QAction::repeat() QCOMPARE(spy.count(), 2); } +#endif // QT_CONFIG(shortcut) + void tst_QAction::setData() // QTBUG-62006 { QAction act(nullptr); @@ -467,6 +481,8 @@ void tst_QAction::setData() // QTBUG-62006 QCOMPARE(spy.count(), 1); } +#if QT_CONFIG(shortcut) + void tst_QAction::disableShortcutsWithBlockedWidgets_data() { QTest::addColumn<Qt::ShortcutContext>("shortcutContext"); @@ -556,5 +572,7 @@ void tst_QAction::shortcutFromKeyEvent() QCOMPARE(testWidget.shortcutOverrideCount, 1); } +#endif // QT_CONFIG(shortcut) + QTEST_MAIN(tst_QAction) #include "tst_qaction.moc" diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index c6760000f4..45a35fe4f1 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -99,7 +99,9 @@ class tst_QFormLayout : public QObject private slots: void cleanup(); void rowCount(); +#if QT_CONFIG(shortcut) void buddies(); +#endif void getItemPosition(); void wrapping(); void spacing(); @@ -190,6 +192,8 @@ void tst_QFormLayout::rowCount() //TODO: remove items } +#if QT_CONFIG(shortcut) + void tst_QFormLayout::buddies() { QWidget w; @@ -218,6 +222,8 @@ void tst_QFormLayout::buddies() //TODO: empty label? } +#endif // QT_CONFIG(shortcut) + void tst_QFormLayout::getItemPosition() { QWidget w; @@ -687,17 +693,21 @@ void tst_QFormLayout::insertRow_QString_QWidget() layout->insertRow(-5, "&Name:", fld1); QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label1 != 0); +#if QT_CONFIG(shortcut) QCOMPARE(label1->buddy(), fld1); - +#endif layout->insertRow(0, "&Email:", fld2); QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label2 != 0); +#if QT_CONFIG(shortcut) QCOMPARE(label2->buddy(), fld2); - +#endif layout->insertRow(5, "&Age:", fld3); QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget()); QVERIFY(label3 != 0); +#if QT_CONFIG(shortcut) QCOMPARE(label3->buddy(), fld3); +#endif } void tst_QFormLayout::insertRow_QString_QLayout() @@ -711,21 +721,27 @@ void tst_QFormLayout::insertRow_QString_QLayout() layout->insertRow(-5, "&Name:", fld1); QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label1 != 0); +#if QT_CONFIG(shortcut) QVERIFY(!label1->buddy()); +#endif QCOMPARE(layout->rowCount(), 1); layout->insertRow(0, "&Email:", fld2); QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label2 != 0); +#if QT_CONFIG(shortcut) QVERIFY(!label2->buddy()); +#endif QCOMPARE(layout->rowCount(), 2); layout->insertRow(5, "&Age:", fld3); QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget()); QVERIFY(label3 != 0); +#if QT_CONFIG(shortcut) QVERIFY(!label3->buddy()); +#endif QCOMPARE(layout->rowCount(), 3); } |