diff options
Diffstat (limited to 'tests/auto/widgets')
64 files changed, 608 insertions, 492 deletions
diff --git a/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro b/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro index 22f6bab497..c379e67ec5 100644 --- a/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro +++ b/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro @@ -4,5 +4,4 @@ TARGET = tst_qcolordialog QT += widgets testlib SOURCES += tst_qcolordialog.cpp - - +linux*: CONFIG += insignificant_test # Crashes on different Linux distros diff --git a/tests/auto/widgets/dialogs/qdialog/BLACKLIST b/tests/auto/widgets/dialogs/qdialog/BLACKLIST new file mode 100644 index 0000000000..3da7337784 --- /dev/null +++ b/tests/auto/widgets/dialogs/qdialog/BLACKLIST @@ -0,0 +1,2 @@ +[snapToDefaultButton] +osx diff --git a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro index 3a96827352..2a11a29420 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro +++ b/tests/auto/widgets/dialogs/qfiledialog/qfiledialog.pro @@ -21,3 +21,5 @@ wince* { } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } + +linux*: CONFIG += insignificant_test # Crashes on different Linux distros diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST new file mode 100644 index 0000000000..31fbc428c9 --- /dev/null +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -0,0 +1,4 @@ +[task256466_wrongStyle] +opensuse-13.1 +[setFont] +ubuntu-14.04 diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm index 6e4ad29190..0d29f5b7a2 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm @@ -36,7 +36,7 @@ void click_cocoa_button() { - QMacCocoaAutoReleasePool pool; + QMacAutoReleasePool pool; NSArray *windows = [NSApp windows]; for (NSWindow *window in windows) { // This is NOT how one should do RTTI, but since I don't want to leak the class too much... diff --git a/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST new file mode 100644 index 0000000000..a2670e8f36 --- /dev/null +++ b/tests/auto/widgets/dialogs/qprogressdialog/BLACKLIST @@ -0,0 +1,2 @@ +[autoShow:50_to_100_fast_0_compat] +osx diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST b/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST new file mode 100644 index 0000000000..7f55c2dae0 --- /dev/null +++ b/tests/auto/widgets/gestures/qgesturerecognizer/BLACKLIST @@ -0,0 +1,2 @@ +[panGesture:Two finger] +xcb diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index cd40c5541c..9d55852c2f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1223,6 +1223,7 @@ void tst_QGraphicsProxyWidget::mousePressReleaseEvent() QGraphicsScene scene; QGraphicsView view(&scene); + view.resize(500, 500); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); @@ -1231,7 +1232,6 @@ void tst_QGraphicsProxyWidget::mousePressReleaseEvent() QPushButton *widget = new QPushButton; QSignalSpy spy(widget, SIGNAL(clicked())); widget->resize(50, 50); - view.resize(100, 100); if (hasWidget) { proxy->setWidget(widget); proxy->show(); diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index 7bd0393760..ff29f99875 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp @@ -1282,33 +1282,16 @@ void tst_QGraphicsScene::removeItem() view.show(); QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); - QTest::mouseMove(view.viewport(), QPoint(-1, -1)); - { - QMouseEvent moveEvent(QEvent::MouseMove, view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)), Qt::NoButton, 0, 0); - QApplication::sendEvent(view.viewport(), &moveEvent); - } - qApp->processEvents(); // update - qApp->processEvents(); // draw - QVERIFY(!hoverItem->isHovered); + QTest::mouseMove(view.viewport(), view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)), Qt::NoButton); + QTRY_VERIFY(!hoverItem->isHovered); - { - QTest::qWait(250); - QTest::mouseMove(view.viewport(), view.mapFromScene(hoverItem->scenePos()), Qt::NoButton); - QTest::qWait(10); - QMouseEvent moveEvent(QEvent::MouseMove, view.mapFromScene(hoverItem->scenePos()), Qt::NoButton, 0, 0); - QApplication::sendEvent(view.viewport(), &moveEvent); - } - qApp->processEvents(); // update - qApp->processEvents(); // draw - QVERIFY(hoverItem->isHovered); + QTest::mouseMove(view.viewport(), view.mapFromScene(hoverItem->scenePos()), Qt::NoButton); + QTRY_VERIFY(hoverItem->isHovered); scene.removeItem(hoverItem); hoverItem->setAcceptsHoverEvents(false); scene.addItem(hoverItem); - qApp->processEvents(); // <- delayed update is called - qApp->processEvents(); // <- scene schedules pending update - qApp->processEvents(); // <- pending update is sent to view - QVERIFY(!hoverItem->isHovered); + QTRY_VERIFY(!hoverItem->isHovered); } void tst_QGraphicsScene::focusItem() @@ -3509,6 +3492,8 @@ void tst_QGraphicsScene::task160653_selectionChanged() QSignalSpy spy(&scene, SIGNAL(selectionChanged())); QGraphicsView view(&scene); + view.show(); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTest::mouseClick( view.viewport(), Qt::LeftButton, 0, view.mapFromScene(scene.items().first()->scenePos())); QCOMPARE(spy.count(), 1); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST index be7a7e398b..3cba8bad7e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST @@ -1,4 +1,18 @@ [task255529_transformationAnchorMouseAndViewportMargins] -ubuntu-14.04 +xcb [cursor] -ubuntu-14.04 +xcb +[cursor2] +xcb +[rubberBandExtendSelection] +xcb +[rotated_rubberBand] +xcb +[sendEvent] +xcb +[forwardMousePress] +xcb +[hoverLeave] +xcb +[resizeAnchor] +xcb diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 9b92c34fb5..ec2203e615 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -182,14 +182,6 @@ private slots: void QTBUG_45867_send_itemChildAddedChange_to_parent(); }; - -static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0) -{ - QTest::mouseMove(widget, point); - QMouseEvent event(QEvent::MouseMove, point, button, buttons, 0); - QApplication::sendEvent(widget, &event); -} - // Subclass that exposes the protected functions. class SubQGraphicsWidget : public QGraphicsWidget { public: @@ -197,7 +189,7 @@ public: : QGraphicsWidget(parent, windowFlags), eventCount(0) { } - void initStyleOption(QStyleOption *option) + void initStyleOption(QStyleOption *option) const { QGraphicsWidget::initStyleOption(option); } void call_changeEvent(QEvent* event) @@ -1110,8 +1102,8 @@ void tst_QGraphicsWidget::initStyleOption() { QGraphicsScene scene; QGraphicsView view(&scene); + view.resize(300, 300); view.show(); - QApplication::setActiveWindow(&view); QVERIFY(QTest::qWaitForWindowActive(&view)); view.setAlignment(Qt::AlignTop | Qt::AlignLeft); @@ -1133,10 +1125,8 @@ void tst_QGraphicsWidget::initStyleOption() } QFETCH(bool, underMouse); if (underMouse) { - view.resize(300, 300); - view.show(); - QVERIFY(QTest::qWaitForWindowActive(&view)); - sendMouseMove(view.viewport(), view.mapFromScene(widget->mapToScene(widget->boundingRect().center()))); + QCursor::setPos(view.viewport()->mapToGlobal(view.mapFromScene(widget->mapToScene(widget->boundingRect().center())))); + QTest::qWait(100); } QFETCH(QPalette, palette); diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 439eeff005..3bd4112122 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1154,7 +1154,7 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("unchecked, tristate, release") << (int)(Qt::Unchecked) - << (int)(defaultFlags | Qt::ItemIsTristate) + << (int)(defaultFlags | Qt::ItemIsAutoTristate) << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1163,7 +1163,7 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("partially checked, tristate, release") << (int)(Qt::PartiallyChecked) - << (int)(defaultFlags | Qt::ItemIsTristate) + << (int)(defaultFlags | Qt::ItemIsAutoTristate) << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1172,7 +1172,7 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("checked, tristate, release") << (int)(Qt::Checked) - << (int)(defaultFlags | Qt::ItemIsTristate) + << (int)(defaultFlags | Qt::ItemIsAutoTristate) << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index 3a6f1f933d..f92eb7c8f9 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp @@ -483,6 +483,7 @@ void tst_QItemView::spider() view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); view->show(); + QVERIFY(QTest::qWaitForWindowActive(view)); #if defined(Q_OS_WINCE) srandom(0); #else diff --git a/tests/auto/widgets/itemviews/qlistview/qlistview.pro b/tests/auto/widgets/itemviews/qlistview/qlistview.pro index 0623fc8ede..509303b62e 100644 --- a/tests/auto/widgets/itemviews/qlistview/qlistview.pro +++ b/tests/auto/widgets/itemviews/qlistview/qlistview.pro @@ -3,3 +3,4 @@ TARGET = tst_qlistview QT += widgets gui-private widgets-private core-private testlib SOURCES += tst_qlistview.cpp win32:!wince:!winrt: LIBS += -luser32 +linux*: CONFIG += insignificant_test # Crashes diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 32ca5ea7b7..b06a63365c 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -38,6 +38,7 @@ #include <qapplication.h> #include <qlistview.h> #include <private/qlistview_p.h> +#include <private/qcoreapplication_p.h> #include <qlistwidget.h> #include <qitemdelegate.h> #include <qstandarditemmodel.h> @@ -149,6 +150,7 @@ private slots: void testScrollToWithHidden(); void testViewOptions(); void taskQTBUG_39902_mutualScrollBars(); + void horizontalScrollingByVerticalWheelEvents(); }; // Testing get/set functions @@ -1219,7 +1221,7 @@ void tst_QListView::scrollTo() list << "Short item"; model.setStringList(list); lv.setModel(&model); - lv.setFixedSize(100, 200); + lv.setFixedSize(110, 200); topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); @@ -2434,5 +2436,52 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars() QTRY_VERIFY(!view->verticalScrollBar()->isVisible()); } +void tst_QListView::horizontalScrollingByVerticalWheelEvents() +{ + QListView lv; + lv.setWrapping(true); + + TestDelegate *delegate = new TestDelegate(&lv); + delegate->m_sizeHint = QSize(100, 100); + lv.setItemDelegate(delegate); + + QtTestModel model; + model.colCount = 1; + model.rCount = 100; + + lv.setModel(&model); + + lv.resize(300, 300); + lv.show(); + QTest::qWaitForWindowExposed(&lv); + + QPoint globalPos = lv.geometry().center(); + QPoint pos = lv.viewport()->geometry().center(); + + QWheelEvent wheelDownEvent(pos, globalPos, QPoint(0, 0), QPoint(0, -120), -120, Qt::Vertical, 0, 0); + QWheelEvent wheelUpEvent(pos, globalPos, QPoint(0, 0), QPoint(0, 120), 120, Qt::Vertical, 0, 0); + QWheelEvent wheelLeftDownEvent(pos, globalPos, QPoint(0, 0), QPoint(120, -120), -120, Qt::Vertical, 0, 0); + + int hValue = lv.horizontalScrollBar()->value(); + QApplication::sendEvent(lv.viewport(), &wheelDownEvent); + QVERIFY(lv.horizontalScrollBar()->value() > hValue); + + QApplication::sendEvent(lv.viewport(), &wheelUpEvent); + QVERIFY(lv.horizontalScrollBar()->value() == hValue); + + QApplication::sendEvent(lv.viewport(), &wheelLeftDownEvent); + QVERIFY(lv.horizontalScrollBar()->value() == hValue); + + // ensure that vertical wheel events are not converted when vertical + // scroll bar is not visible but vertical scrolling is possible + lv.setWrapping(false); + lv.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + QApplication::processEvents(); + + int vValue = lv.verticalScrollBar()->value(); + QApplication::sendEvent(lv.viewport(), &wheelDownEvent); + QVERIFY(lv.verticalScrollBar()->value() > vValue); +} + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST index fc231a4e30..329010a86e 100644 --- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST +++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST @@ -1,2 +1,4 @@ [moveCursorBiggerJump] osx +[resizeColumnsToContents] +ubuntu-14.04 diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 75f77f8107..e5abd6bc46 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -2249,11 +2249,11 @@ void tst_QTableView::resizeColumnsToContents_data() QTest::addColumn<int>("rowHeight"); QTest::addColumn<int>("columnWidth"); - QTest::newRow("10x10 grid shown 40x40") - << 10 << 10 << false << 40 << 40 << 40 << 40; + QTest::newRow("10x10 grid not shown 60x60") + << 10 << 10 << false << 60 << 60 << 60 << 60; - QTest::newRow("10x10 grid not shown 40x40") - << 10 << 10 << true << 40 << 40 << 41 << 41; + QTest::newRow("10x10 grid shown 60x60") + << 10 << 10 << true << 60 << 60 << 61 << 61; } void tst_QTableView::resizeColumnsToContents() @@ -4051,9 +4051,9 @@ void tst_QTableView::mouseWheel() QWheelEvent verticalEvent(pos, delta, 0, 0, Qt::Vertical); QWheelEvent horizontalEvent(pos, delta, 0, 0, Qt::Horizontal); QApplication::sendEvent(view.viewport(), &horizontalEvent); - QVERIFY(qAbs(view.horizontalScrollBar()->value() - horizontalPositon) < 10); + QVERIFY(qAbs(view.horizontalScrollBar()->value() - horizontalPositon) < 15); QApplication::sendEvent(view.viewport(), &verticalEvent); - QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10); + QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 15); } #endif // !QT_NO_WHEELEVENT diff --git a/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro b/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro index 3abd58e73d..e8406dab7b 100644 --- a/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro +++ b/tests/auto/widgets/itemviews/qtreeview/qtreeview.pro @@ -4,3 +4,5 @@ QT += widgets testlib QT += widgets-private gui-private core-private SOURCES += tst_qtreeview.cpp HEADERS += ../../../../shared/fakedirmodel.h + +win32: CONFIG += insignificant_test diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 5c881369a0..b63d6b5b89 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -1037,7 +1037,7 @@ void tst_QTreeWidget::checkState() QCOMPARE(firstChild->checkState(0), Qt::Checked); QCOMPARE(seccondChild->checkState(0), Qt::Unchecked); - item->setFlags(item->flags()|Qt::ItemIsTristate); + item->setFlags(item->flags()|Qt::ItemIsAutoTristate); QCOMPARE(item->checkState(0), Qt::PartiallyChecked); QCOMPARE(firstChild->checkState(0), Qt::Checked); QCOMPARE(seccondChild->checkState(0), Qt::Unchecked); @@ -3155,11 +3155,11 @@ void tst_QTreeWidget::setSelectionModel() void tst_QTreeWidget::task217309() { QTreeWidgetItem item; - item.setFlags(item.flags() | Qt::ItemIsTristate); + item.setFlags(item.flags() | Qt::ItemIsAutoTristate); QTreeWidgetItem subitem1; - subitem1.setFlags(subitem1.flags() | Qt::ItemIsTristate); + subitem1.setFlags(subitem1.flags() | Qt::ItemIsAutoTristate); QTreeWidgetItem subitem2; - subitem2.setFlags(subitem2.flags() | Qt::ItemIsTristate); + subitem2.setFlags(subitem2.flags() | Qt::ItemIsAutoTristate); item.addChild(&subitem1); item.addChild(&subitem2); subitem1.setCheckState(0, Qt::Checked); @@ -3180,7 +3180,7 @@ void tst_QTreeWidget::nonEditableTristate() QTreeWidget *tree = new QTreeWidget; QTreeWidgetItem *item = new QTreeWidgetItem(); tree->insertTopLevelItem(0, item); - item->setFlags(item->flags() | Qt::ItemIsTristate); + item->setFlags(item->flags() | Qt::ItemIsAutoTristate); item->setCheckState(0, Qt::Unchecked); QTreeWidgetItem *subitem1 = new QTreeWidgetItem(item); subitem1->setCheckState(0, Qt::Unchecked); diff --git a/tests/auto/widgets/kernel/qaction/BLACKLIST b/tests/auto/widgets/kernel/qaction/BLACKLIST index f67a3c471e..1ad524fdbf 100644 --- a/tests/auto/widgets/kernel/qaction/BLACKLIST +++ b/tests/auto/widgets/kernel/qaction/BLACKLIST @@ -1,2 +1,2 @@ [setStandardKeys] -ubuntu-14.04 +linux diff --git a/tests/auto/widgets/kernel/qactiongroup/BLACKLIST b/tests/auto/widgets/kernel/qactiongroup/BLACKLIST new file mode 100644 index 0000000000..fdc424b6ac --- /dev/null +++ b/tests/auto/widgets/kernel/qactiongroup/BLACKLIST @@ -0,0 +1,2 @@ +[QTBUG_14292_filesystem] +linux diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp index 8ce9941238..5e5d15841a 100644 --- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp +++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp @@ -42,6 +42,7 @@ class tst_QActionGroup : public QObject Q_OBJECT private slots: + void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void enabledPropagation(); void visiblePropagation(); void exclusive(); diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST new file mode 100644 index 0000000000..6abb1d9988 --- /dev/null +++ b/tests/auto/widgets/kernel/qapplication/BLACKLIST @@ -0,0 +1,4 @@ +[quitOnLastWindowClosed] +osx-10.10 +[touchEventPropagation] +xcb diff --git a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST b/tests/auto/widgets/kernel/qapplication/test/BLACKLIST new file mode 100644 index 0000000000..f4a9cb6166 --- /dev/null +++ b/tests/auto/widgets/kernel/qapplication/test/BLACKLIST @@ -0,0 +1,2 @@ +[quitOnLastWindowClosed] +osx-10.10 diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index 35a8636f0b..d935406ce8 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -48,17 +48,8 @@ class tst_QBoxLayout : public QObject { Q_OBJECT -public: - tst_QBoxLayout(); - virtual ~tst_QBoxLayout(); - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: + void cleanup(); void insertSpacerItem(); void insertLayout(); void sizeHint(); @@ -120,34 +111,15 @@ int CustomLayoutStyle::pixelMetric(PixelMetric metric, const QStyleOption * opti return QProxyStyle::pixelMetric(metric, option, widget); } - -tst_QBoxLayout::tst_QBoxLayout() -{ -} - -tst_QBoxLayout::~tst_QBoxLayout() -{ -} - -void tst_QBoxLayout::initTestCase() -{ -} - -void tst_QBoxLayout::cleanupTestCase() -{ -} - -void tst_QBoxLayout::init() -{ -} - void tst_QBoxLayout::cleanup() { + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QBoxLayout::insertSpacerItem() { - QWidget *window = new QWidget; + QWidget window; + window.setWindowTitle(QTest::currentTestFunction()); QSpacerItem *spacer1 = new QSpacerItem(20, 10, QSizePolicy::Expanding, QSizePolicy::Expanding); QSpacerItem *spacer2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -157,44 +129,43 @@ void tst_QBoxLayout::insertSpacerItem() layout->addSpacerItem(spacer1); layout->addWidget(new QLineEdit("Baaaaaaaaaaaaaaaaaaaaaaaaar")); layout->insertSpacerItem(0, spacer2); - window->setLayout(layout); + window.setLayout(layout); QVERIFY(layout->itemAt(0) == spacer2); QVERIFY(layout->itemAt(2) == spacer1); - window->show(); + window.show(); } void tst_QBoxLayout::insertLayout() { - QWidget *window = new QWidget; - QVBoxLayout *vbox = new QVBoxLayout(window); - QVBoxLayout *dummyParentLayout = new QVBoxLayout; + QWidget window; + QVBoxLayout *vbox = new QVBoxLayout(&window); + QScopedPointer<QVBoxLayout> dummyParentLayout(new QVBoxLayout); QHBoxLayout *subLayout = new QHBoxLayout; dummyParentLayout->addLayout(subLayout); - QCOMPARE(subLayout->parent(), dummyParentLayout); + QCOMPARE(subLayout->parent(), dummyParentLayout.data()); QCOMPARE(dummyParentLayout->count(), 1); // add subLayout to another layout QTest::ignoreMessage(QtWarningMsg, "QLayout::addChildLayout: layout \"\" already has a parent"); vbox->addLayout(subLayout); QCOMPARE((subLayout->parent() == vbox), (vbox->count() == 1)); - - delete dummyParentLayout; - delete window; } void tst_QBoxLayout::sizeHint() { - QWidget *window = new QWidget; + QWidget window; + window.setWindowTitle(QTest::currentTestFunction()); QHBoxLayout *lay1 = new QHBoxLayout; QHBoxLayout *lay2 = new QHBoxLayout; QLabel *label = new QLabel("widget twooooooooooooooooooooooooooooooooooooooooooooooooooooooo"); lay2->addWidget(label); lay1->addLayout(lay2); - window->setLayout(lay1); - window->show(); + window.setLayout(lay1); + window.show(); + QTest::qWaitForWindowExposed(&window); label->setText("foooooooo baaaaaaar"); QSize sh = lay1->sizeHint(); QApplication::processEvents(); @@ -207,24 +178,26 @@ void tst_QBoxLayout::sizeHint() void tst_QBoxLayout::sizeConstraints() { - QWidget *window = new QWidget; + QWidget window; + window.setWindowTitle(QTest::currentTestFunction()); QHBoxLayout *lay = new QHBoxLayout; lay->addWidget(new QLabel("foooooooooooooooooooooooooooooooooooo")); lay->addWidget(new QLabel("baaaaaaaaaaaaaaaaaaaaaaaaaaaaaar")); lay->setSizeConstraint(QLayout::SetFixedSize); - window->setLayout(lay); - window->show(); - QApplication::processEvents(); - QSize sh = window->sizeHint(); + window.setLayout(lay); + window.show(); + QTest::qWaitForWindowExposed(&window); + QSize sh = window.sizeHint(); lay->takeAt(1); - QVERIFY(sh.width() >= window->sizeHint().width() && - sh.height() >= window->sizeHint().height()); + QVERIFY(sh.width() >= window.sizeHint().width() && + sh.height() >= window.sizeHint().height()); } void tst_QBoxLayout::setGeometry() { QWidget toplevel; + toplevel.setWindowTitle(QTest::currentTestFunction()); setFrameless(&toplevel); QWidget w(&toplevel); QVBoxLayout *lay = new QVBoxLayout; @@ -247,33 +220,30 @@ void tst_QBoxLayout::setGeometry() void tst_QBoxLayout::setStyleShouldChangeSpacing() { - QWidget *window = new QWidget; - QHBoxLayout *hbox = new QHBoxLayout(window); + QWidget window; + window.setWindowTitle(QTest::currentTestFunction()); + QHBoxLayout *hbox = new QHBoxLayout(&window); QPushButton *pb1 = new QPushButton(tr("The spacing between this")); QPushButton *pb2 = new QPushButton(tr("and this button should depend on the style of the parent widget"));; pb1->setAttribute(Qt::WA_LayoutUsesWidgetRect); pb2->setAttribute(Qt::WA_LayoutUsesWidgetRect); hbox->addWidget(pb1); hbox->addWidget(pb2); - CustomLayoutStyle *style1 = new CustomLayoutStyle; + QScopedPointer<CustomLayoutStyle> style1(new CustomLayoutStyle); style1->hspacing = 6; - window->setStyle(style1); - window->show(); + window.setStyle(style1.data()); + window.show(); + QTest::qWaitForWindowExposed(&window); - QTest::qWait(100); int spacing = pb2->geometry().left() - pb1->geometry().right() - 1; QCOMPARE(spacing, 6); - CustomLayoutStyle *style2 = new CustomLayoutStyle(); + QScopedPointer<CustomLayoutStyle> style2(new CustomLayoutStyle()); style2->hspacing = 10; - window->setStyle(style2); + window.setStyle(style2.data()); QTest::qWait(100); spacing = pb2->geometry().left() - pb1->geometry().right() - 1; QCOMPARE(spacing, 10); - - delete window; - delete style1; - delete style2; } void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected() @@ -287,6 +257,7 @@ void tst_QBoxLayout::taskQTBUG_7103_minMaxWidthNotRespected() layout->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Fixed, QSizePolicy::Expanding)); QWidget widget; + widget.setWindowTitle(QTest::currentTestFunction()); widget.setLayout(layout); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -325,6 +296,7 @@ void tst_QBoxLayout::taskQTBUG_27420_takeAtShouldUnparentLayout() void tst_QBoxLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){ QWidget widget; + widget.setWindowTitle(QTest::currentTestFunction()); widget.setObjectName("347b469225a24a0ef05150a"); QVBoxLayout layout(&widget); layout.setObjectName("ef9e2b42298e0e6420105bb"); @@ -340,6 +312,7 @@ void tst_QBoxLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){ void tst_QBoxLayout::taskQTBUG_40609_addingLayoutToItself(){ QWidget widget; + widget.setWindowTitle(QTest::currentTestFunction()); widget.setObjectName("fe44e5cb6c08006597126a"); QVBoxLayout layout(&widget); layout.setObjectName("cc751dd0f50f62b05a62da"); diff --git a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp index b717c1deb1..e94dfa5754 100644 --- a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp @@ -73,6 +73,7 @@ void tst_QDesktopWidget::init() void tst_QDesktopWidget::cleanup() { + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QDesktopWidget::numScreens() diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 8588df7afa..d99e50e875 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp @@ -60,17 +60,8 @@ class tst_QFormLayout : public QObject { Q_OBJECT -public: - tst_QFormLayout(); - ~tst_QFormLayout(); - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: + void cleanup(); void rowCount(); void buddies(); void getItemPosition(); @@ -132,34 +123,15 @@ private slots: }; -tst_QFormLayout::tst_QFormLayout() -{ -} - -tst_QFormLayout::~tst_QFormLayout() -{ -} - -void tst_QFormLayout::initTestCase() -{ -} - -void tst_QFormLayout::cleanupTestCase() -{ -} - -void tst_QFormLayout::init() -{ -} - void tst_QFormLayout::cleanup() { + QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void tst_QFormLayout::rowCount() { - QWidget *w = new QWidget; - QFormLayout *fl = new QFormLayout(w); + QWidget w; + QFormLayout *fl = new QFormLayout(&w); fl->addRow(tr("Label 1"), new QLineEdit); fl->addRow(tr("Label 2"), new QLineEdit); @@ -174,14 +146,12 @@ void tst_QFormLayout::rowCount() QCOMPARE(fl->rowCount(), 6); //TODO: remove items - - delete w; } void tst_QFormLayout::buddies() { - QWidget *w = new QWidget; - QFormLayout *fl = new QFormLayout(w); + QWidget w; + QFormLayout *fl = new QFormLayout(&w); //normal buddy case QLineEdit *le = new QLineEdit; @@ -204,14 +174,12 @@ void tst_QFormLayout::buddies() QVERIFY(label3 == 0); //TODO: empty label? - - delete w; } void tst_QFormLayout::getItemPosition() { - QWidget *w = new QWidget; - QFormLayout *fl = new QFormLayout(w); + QWidget w; + QFormLayout *fl = new QFormLayout(&w); QList<QLabel*> labels; QList<QLineEdit*> fields; @@ -249,14 +217,12 @@ void tst_QFormLayout::getItemPosition() QCOMPARE(row, 2); QCOMPARE(role, QFormLayout::FieldRole); } - - delete w; } void tst_QFormLayout::wrapping() { - QWidget *w = new QWidget; - QFormLayout *fl = new QFormLayout(w); + QWidget w; + QFormLayout *fl = new QFormLayout(&w); fl->setRowWrapPolicy(QFormLayout::WrapLongRows); QLineEdit *le = new QLineEdit; @@ -264,14 +230,13 @@ void tst_QFormLayout::wrapping() le->setMinimumWidth(200); fl->addRow(lbl, le); - w->setFixedWidth(240); - w->show(); + w.setFixedWidth(240); + w.setWindowTitle(QTest::currentTestFunction()); + w.show(); QCOMPARE(le->geometry().y() > lbl->geometry().y(), true); //TODO: additional tests covering different wrapping cases - - delete w; } class CustomLayoutStyle : public QProxyStyle @@ -309,12 +274,12 @@ int CustomLayoutStyle::pixelMetric(PixelMetric metric, const QStyleOption * opti void tst_QFormLayout::spacing() { //TODO: confirm spacing behavior - QWidget *w = new QWidget; - CustomLayoutStyle *style = new CustomLayoutStyle; + QWidget w; + QScopedPointer<CustomLayoutStyle> style(new CustomLayoutStyle); style->hspacing = 5; style->vspacing = 10; - w->setStyle(style); - QFormLayout *fl = new QFormLayout(w); + w.setStyle(style.data()); + QFormLayout *fl = new QFormLayout(&w); QCOMPARE(style->hspacing, fl->horizontalSpacing()); QCOMPARE(style->vspacing, fl->verticalSpacing()); @@ -351,12 +316,10 @@ void tst_QFormLayout::spacing() QCheckBox *checkBox = new QCheckBox(tr("Yes")); fl->setWidget(0, QFormLayout::LabelRole, label); fl->setWidget(1, QFormLayout::FieldRole, checkBox); - w->resize(200, 100); - w->show(); - QVERIFY(QTest::qWaitForWindowExposed(w)); - - delete w; - delete style; + w.resize(200, 100); + w.setWindowTitle(QTest::currentTestFunction()); + w.show(); + QVERIFY(QTest::qWaitForWindowExposed(&w)); } void tst_QFormLayout::contentsRect() @@ -366,6 +329,7 @@ void tst_QFormLayout::contentsRect() QFormLayout form; w.setLayout(&form); form.addRow("Label", new QPushButton(&w)); + w.setWindowTitle(QTest::currentTestFunction()); w.show(); QVERIFY(QTest::qWaitForWindowExposed(&w)); int l, t, r, b; @@ -505,33 +469,39 @@ void tst_QFormLayout::setFormAlignment() void tst_QFormLayout::addRow() { - QFormLayout layout; - QWidget w1, w2, w3; - QHBoxLayout l1, l2, l3; - QLabel lbl1, lbl2; - - QCOMPARE(layout.rowCount(), 0); - - layout.addRow(&lbl1, &w1); - layout.addRow(&lbl2, &l1); - layout.addRow("Foo:", &w2); - layout.addRow("Bar:", &l2); - layout.addRow(&w3); - layout.addRow(&l3); - - QCOMPARE(layout.rowCount(), 6); - - QVERIFY(layout.itemAt(0, QFormLayout::LabelRole)->widget() == &lbl1); - QVERIFY(layout.itemAt(1, QFormLayout::LabelRole)->widget() == &lbl2); - QVERIFY(layout.itemAt(2, QFormLayout::LabelRole)->widget()->property("text") == "Foo:"); - QVERIFY(layout.itemAt(3, QFormLayout::LabelRole)->widget()->property("text") == "Bar:"); - QVERIFY(layout.itemAt(4, QFormLayout::LabelRole) == 0); - QVERIFY(layout.itemAt(5, QFormLayout::LabelRole) == 0); - - QVERIFY(layout.itemAt(0, QFormLayout::FieldRole)->widget() == &w1); - QVERIFY(layout.itemAt(1, QFormLayout::FieldRole)->layout() == &l1); - QVERIFY(layout.itemAt(2, QFormLayout::FieldRole)->widget() == &w2); - QVERIFY(layout.itemAt(3, QFormLayout::FieldRole)->layout() == &l2); + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + QWidget *w1 = new QWidget(&topLevel); + QWidget *w2 = new QWidget(&topLevel); + QWidget *w3 = new QWidget(&topLevel); + QHBoxLayout *l1 = new QHBoxLayout; + QHBoxLayout *l2 = new QHBoxLayout; + QHBoxLayout *l3 = new QHBoxLayout; + QLabel *lbl1 = new QLabel(&topLevel); + QLabel *lbl2 = new QLabel(&topLevel); + + QCOMPARE(layout->rowCount(), 0); + + layout->addRow(lbl1, w1); + layout->addRow(lbl2, l1); + layout->addRow("Foo:", w2); + layout->addRow("Bar:", l2); + layout->addRow(w3); + layout->addRow(l3); + + QCOMPARE(layout->rowCount(), 6); + + QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); + QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); + QVERIFY(layout->itemAt(2, QFormLayout::LabelRole)->widget()->property("text") == "Foo:"); + QVERIFY(layout->itemAt(3, QFormLayout::LabelRole)->widget()->property("text") == "Bar:"); + QVERIFY(layout->itemAt(4, QFormLayout::LabelRole) == 0); + QVERIFY(layout->itemAt(5, QFormLayout::LabelRole) == 0); + + QVERIFY(layout->itemAt(0, QFormLayout::FieldRole)->widget() == w1); + QVERIFY(layout->itemAt(1, QFormLayout::FieldRole)->layout() == l1); + QVERIFY(layout->itemAt(2, QFormLayout::FieldRole)->widget() == w2); + QVERIFY(layout->itemAt(3, QFormLayout::FieldRole)->layout() == l2); // ### should have a third role, FullRowRole? // QVERIFY(layout.itemAt(4, QFormLayout::FieldRole) == 0); // QVERIFY(layout.itemAt(5, QFormLayout::FieldRole) == 0); @@ -539,17 +509,24 @@ void tst_QFormLayout::addRow() void tst_QFormLayout::insertRow_QWidget_QWidget() { - QFormLayout layout; - QLabel lbl1, lbl2, lbl3, lbl4; - QLineEdit fld1, fld2, fld3, fld4; + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + QLabel *lbl1 = new QLabel(&topLevel); + QLabel *lbl2 = new QLabel(&topLevel); + QLabel *lbl3 = new QLabel(&topLevel); + QLabel *lbl4 = new QLabel(&topLevel); + QLineEdit *fld1 = new QLineEdit(&topLevel); + QLineEdit *fld2 = new QLineEdit(&topLevel); + QLineEdit *fld3 = new QLineEdit(&topLevel); + QLineEdit *fld4 = new QLineEdit(&topLevel); - layout.insertRow(0, &lbl1, &fld1); - QCOMPARE(layout.rowCount(), 1); + layout->insertRow(0, lbl1, fld1); + QCOMPARE(layout->rowCount(), 1); { int row = -1; QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); - layout.getWidgetPosition(&lbl1, &row, &role); + layout->getWidgetPosition(lbl1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::LabelRole)); } @@ -557,63 +534,68 @@ void tst_QFormLayout::insertRow_QWidget_QWidget() { int row = -1; QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); - layout.getWidgetPosition(&fld1, &row, &role); + layout->getWidgetPosition(fld1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::FieldRole)); } // check that negative values append - layout.insertRow(-2, &lbl2, &fld2); - QCOMPARE(layout.rowCount(), 2); + layout->insertRow(-2, lbl2, fld2); + QCOMPARE(layout->rowCount(), 2); - QVERIFY(layout.itemAt(0, QFormLayout::LabelRole)->widget() == &lbl1); - QVERIFY(layout.itemAt(1, QFormLayout::LabelRole)->widget() == &lbl2); + QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); + QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); // check that too large values append - layout.insertRow(100, &lbl3, &fld3); - QCOMPARE(layout.rowCount(), 3); - QCOMPARE(layout.count(), 6); + layout->insertRow(100, lbl3, fld3); + QCOMPARE(layout->rowCount(), 3); + QCOMPARE(layout->count(), 6); - layout.insertRow(3, (QWidget *)0, (QWidget *)0); - QCOMPARE(layout.rowCount(), 4); - QCOMPARE(layout.count(), 6); + layout->insertRow(3, (QWidget *)0, (QWidget *)0); + QCOMPARE(layout->rowCount(), 4); + QCOMPARE(layout->count(), 6); - layout.insertRow(4, (QWidget *)0, &fld4); - QCOMPARE(layout.rowCount(), 5); - QCOMPARE(layout.count(), 7); + layout->insertRow(4, (QWidget *)0, fld4); + QCOMPARE(layout->rowCount(), 5); + QCOMPARE(layout->count(), 7); - layout.insertRow(5, &lbl4, (QWidget *)0); - QCOMPARE(layout.rowCount(), 6); - QCOMPARE(layout.count(), 8); - - QVERIFY(layout.itemAt(0, QFormLayout::LabelRole)->widget() == &lbl1); - QVERIFY(layout.itemAt(1, QFormLayout::LabelRole)->widget() == &lbl2); - QVERIFY(layout.itemAt(2, QFormLayout::LabelRole)->widget() == &lbl3); - QVERIFY(layout.itemAt(3, QFormLayout::LabelRole) == 0); - QVERIFY(layout.itemAt(4, QFormLayout::LabelRole) == 0); - QVERIFY(layout.itemAt(5, QFormLayout::LabelRole)->widget() == &lbl4); - - QVERIFY(layout.itemAt(0, QFormLayout::FieldRole)->widget() == &fld1); - QVERIFY(layout.itemAt(1, QFormLayout::FieldRole)->widget() == &fld2); - QVERIFY(layout.itemAt(2, QFormLayout::FieldRole)->widget() == &fld3); - QVERIFY(layout.itemAt(3, QFormLayout::FieldRole) == 0); - QVERIFY(layout.itemAt(4, QFormLayout::FieldRole)->widget() == &fld4); - QVERIFY(layout.itemAt(5, QFormLayout::FieldRole) == 0); + layout->insertRow(5, lbl4, (QWidget *)0); + QCOMPARE(layout->rowCount(), 6); + QCOMPARE(layout->count(), 8); + + QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); + QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); + QVERIFY(layout->itemAt(2, QFormLayout::LabelRole)->widget() == lbl3); + QVERIFY(layout->itemAt(3, QFormLayout::LabelRole) == 0); + QVERIFY(layout->itemAt(4, QFormLayout::LabelRole) == 0); + QVERIFY(layout->itemAt(5, QFormLayout::LabelRole)->widget() == lbl4); + + QVERIFY(layout->itemAt(0, QFormLayout::FieldRole)->widget() == fld1); + QVERIFY(layout->itemAt(1, QFormLayout::FieldRole)->widget() == fld2); + QVERIFY(layout->itemAt(2, QFormLayout::FieldRole)->widget() == fld3); + QVERIFY(layout->itemAt(3, QFormLayout::FieldRole) == 0); + QVERIFY(layout->itemAt(4, QFormLayout::FieldRole)->widget() == fld4); + QVERIFY(layout->itemAt(5, QFormLayout::FieldRole) == 0); } void tst_QFormLayout::insertRow_QWidget_QLayout() { - QFormLayout layout; - QLabel lbl1, lbl2, lbl3, lbl4; - QHBoxLayout fld1, fld2, fld3, fld4; + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + QLabel *lbl1 = new QLabel(&topLevel); + QLabel *lbl2 = new QLabel(&topLevel); + QLabel *lbl3 = new QLabel(&topLevel); + QHBoxLayout *fld1 = new QHBoxLayout; + QHBoxLayout *fld2 = new QHBoxLayout; + QHBoxLayout *fld3 = new QHBoxLayout; - layout.insertRow(0, &lbl1, &fld1); - QCOMPARE(layout.rowCount(), 1); + layout->insertRow(0, lbl1, fld1); + QCOMPARE(layout->rowCount(), 1); { int row = -1; QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); - layout.getWidgetPosition(&lbl1, &row, &role); + layout->getWidgetPosition(lbl1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::LabelRole)); } @@ -621,77 +603,83 @@ void tst_QFormLayout::insertRow_QWidget_QLayout() { int row = -1; QFormLayout::ItemRole role = QFormLayout::ItemRole(-123); - layout.getLayoutPosition(&fld1, &row, &role); + layout->getLayoutPosition(fld1, &row, &role); QCOMPARE(row, 0); QCOMPARE(int(role), int(QFormLayout::FieldRole)); } // check that negative values append - layout.insertRow(-2, &lbl2, &fld2); - QCOMPARE(layout.rowCount(), 2); + layout->insertRow(-2, lbl2, fld2); + QCOMPARE(layout->rowCount(), 2); - QVERIFY(layout.itemAt(0, QFormLayout::LabelRole)->widget() == &lbl1); - QVERIFY(layout.itemAt(1, QFormLayout::LabelRole)->widget() == &lbl2); + QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); + QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); // check that too large values append - layout.insertRow(100, &lbl3, &fld3); - QCOMPARE(layout.rowCount(), 3); + layout->insertRow(100, lbl3, fld3); + QCOMPARE(layout->rowCount(), 3); - QVERIFY(layout.itemAt(0, QFormLayout::LabelRole)->widget() == &lbl1); - QVERIFY(layout.itemAt(1, QFormLayout::LabelRole)->widget() == &lbl2); - QVERIFY(layout.itemAt(2, QFormLayout::LabelRole)->widget() == &lbl3); + QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); + QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); + QVERIFY(layout->itemAt(2, QFormLayout::LabelRole)->widget() == lbl3); - QVERIFY(layout.itemAt(0, QFormLayout::FieldRole)->layout() == &fld1); - QVERIFY(layout.itemAt(1, QFormLayout::FieldRole)->layout() == &fld2); - QVERIFY(layout.itemAt(2, QFormLayout::FieldRole)->layout() == &fld3); + QVERIFY(layout->itemAt(0, QFormLayout::FieldRole)->layout() == fld1); + QVERIFY(layout->itemAt(1, QFormLayout::FieldRole)->layout() == fld2); + QVERIFY(layout->itemAt(2, QFormLayout::FieldRole)->layout() == fld3); } void tst_QFormLayout::insertRow_QString_QWidget() { - QFormLayout layout; - QLineEdit fld1, fld2, fld3; + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + QLineEdit *fld1 = new QLineEdit(&topLevel); + QLineEdit *fld2 = new QLineEdit(&topLevel); + QLineEdit *fld3 = new QLineEdit(&topLevel); - layout.insertRow(-5, "&Name:", &fld1); - QLabel *label1 = qobject_cast<QLabel *>(layout.itemAt(0, QFormLayout::LabelRole)->widget()); + layout->insertRow(-5, "&Name:", fld1); + QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label1 != 0); - QVERIFY(label1->buddy() == &fld1); + QVERIFY(label1->buddy() == fld1); - layout.insertRow(0, "&Email:", &fld2); - QLabel *label2 = qobject_cast<QLabel *>(layout.itemAt(0, QFormLayout::LabelRole)->widget()); + layout->insertRow(0, "&Email:", fld2); + QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label2 != 0); - QVERIFY(label2->buddy() == &fld2); + QVERIFY(label2->buddy() == fld2); - layout.insertRow(5, "&Age:", &fld3); - QLabel *label3 = qobject_cast<QLabel *>(layout.itemAt(2, QFormLayout::LabelRole)->widget()); + layout->insertRow(5, "&Age:", fld3); + QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget()); QVERIFY(label3 != 0); - QVERIFY(label3->buddy() == &fld3); + QVERIFY(label3->buddy() == fld3); } void tst_QFormLayout::insertRow_QString_QLayout() { - QFormLayout layout; - QHBoxLayout fld1, fld2, fld3; + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); + QHBoxLayout *fld1 = new QHBoxLayout; + QHBoxLayout *fld2 = new QHBoxLayout; + QHBoxLayout *fld3 = new QHBoxLayout; - layout.insertRow(-5, "&Name:", &fld1); - QLabel *label1 = qobject_cast<QLabel *>(layout.itemAt(0, QFormLayout::LabelRole)->widget()); + layout->insertRow(-5, "&Name:", fld1); + QLabel *label1 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label1 != 0); QVERIFY(label1->buddy() == 0); - QCOMPARE(layout.rowCount(), 1); + QCOMPARE(layout->rowCount(), 1); - layout.insertRow(0, "&Email:", &fld2); - QLabel *label2 = qobject_cast<QLabel *>(layout.itemAt(0, QFormLayout::LabelRole)->widget()); + layout->insertRow(0, "&Email:", fld2); + QLabel *label2 = qobject_cast<QLabel *>(layout->itemAt(0, QFormLayout::LabelRole)->widget()); QVERIFY(label2 != 0); QVERIFY(label2->buddy() == 0); - QCOMPARE(layout.rowCount(), 2); + QCOMPARE(layout->rowCount(), 2); - layout.insertRow(5, "&Age:", &fld3); - QLabel *label3 = qobject_cast<QLabel *>(layout.itemAt(2, QFormLayout::LabelRole)->widget()); + layout->insertRow(5, "&Age:", fld3); + QLabel *label3 = qobject_cast<QLabel *>(layout->itemAt(2, QFormLayout::LabelRole)->widget()); QVERIFY(label3 != 0); QVERIFY(label3->buddy() == 0); - QCOMPARE(layout.rowCount(), 3); + QCOMPARE(layout->rowCount(), 3); } void tst_QFormLayout::insertRow_QWidget() @@ -840,39 +828,40 @@ void tst_QFormLayout::setLayout() void tst_QFormLayout::itemAt() { - QFormLayout layout; + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); - QWidget w1; - QWidget w2; - QWidget w3; - QWidget w4; - QWidget w5; - QHBoxLayout l6; + QWidget *w1 = new QWidget(&topLevel); + QWidget *w2 = new QWidget(&topLevel); + QWidget *w3 = new QWidget(&topLevel); + QWidget *w4 = new QWidget(&topLevel); + QWidget *w5 = new QWidget(&topLevel); + QHBoxLayout *l6 = new QHBoxLayout; - layout.setWidget(5, QFormLayout::LabelRole, &w1); - layout.setWidget(3, QFormLayout::FieldRole, &w2); - layout.setWidget(3, QFormLayout::LabelRole, &w3); - layout.addRow(&w4, &w5); - layout.addRow("Foo:", &l6); + layout->setWidget(5, QFormLayout::LabelRole, w1); + layout->setWidget(3, QFormLayout::FieldRole, w2); + layout->setWidget(3, QFormLayout::LabelRole, w3); + layout->addRow(w4, w5); + layout->addRow("Foo:", l6); - QCOMPARE(layout.count(), 7); + QCOMPARE(layout->count(), 7); QBitArray scoreBoard(7); for (int i = 0; i < 7; ++i) { - QLayoutItem *item = layout.itemAt(i); + QLayoutItem *item = layout->itemAt(i); QVERIFY(item != 0); - if (item->widget() == &w1) { + if (item->widget() == w1) { scoreBoard[0] = true; - } else if (item->widget() == &w2) { + } else if (item->widget() == w2) { scoreBoard[1] = true; - } else if (item->widget() == &w3) { + } else if (item->widget() == w3) { scoreBoard[2] = true; - } else if (item->widget() == &w4) { + } else if (item->widget() == w4) { scoreBoard[3] = true; - } else if (item->widget() == &w5) { + } else if (item->widget() == w5) { scoreBoard[4] = true; - } else if (item->layout() == &l6) { + } else if (item->layout() == l6) { scoreBoard[5] = true; } else if (qobject_cast<QLabel *>(item->widget())) { scoreBoard[6] = true; @@ -883,26 +872,27 @@ void tst_QFormLayout::itemAt() void tst_QFormLayout::takeAt() { - QFormLayout layout; + QWidget topLevel; + QFormLayout *layout = new QFormLayout(&topLevel); - QWidget w1; - QWidget w2; - QWidget w3; - QWidget w4; - QWidget w5; - QHBoxLayout l6; + QWidget *w1 = new QWidget(&topLevel); + QWidget *w2 = new QWidget(&topLevel); + QWidget *w3 = new QWidget(&topLevel); + QWidget *w4 = new QWidget(&topLevel); + QWidget *w5 = new QWidget(&topLevel); + QHBoxLayout *l6 = new QHBoxLayout; - layout.setWidget(5, QFormLayout::LabelRole, &w1); - layout.setWidget(3, QFormLayout::FieldRole, &w2); - layout.setWidget(3, QFormLayout::LabelRole, &w3); - layout.addRow(&w4, &w5); - layout.addRow("Foo:", &l6); + layout->setWidget(5, QFormLayout::LabelRole, w1); + layout->setWidget(3, QFormLayout::FieldRole, w2); + layout->setWidget(3, QFormLayout::LabelRole, w3); + layout->addRow(w4, w5); + layout->addRow("Foo:", l6); - QCOMPARE(layout.count(), 7); + QCOMPARE(layout->count(), 7); for (int i = 6; i >= 0; --i) { - layout.takeAt(0); - QCOMPARE(layout.count(), i); + layout->takeAt(0); + QCOMPARE(layout->count(), i); } } @@ -917,6 +907,7 @@ void tst_QFormLayout::layoutAlone() QHBoxLayout hlay; layout.setLayout(1, QFormLayout::LabelRole, &hlay); QCOMPARE(layout.count(), 2); + w.setWindowTitle(QTest::currentTestFunction()); w.show(); layout.activate(); QTest::qWait(500); diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 7f3c289fb4..1e67c675ef 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp @@ -60,18 +60,9 @@ class tst_QGridLayout : public QObject { Q_OBJECT -public: - tst_QGridLayout(); - virtual ~tst_QGridLayout(); - - -public slots: +private slots: void initTestCase(); - void cleanupTestCase(); - void init(); void cleanup(); - -private slots: void getItemPosition(); void itemAtPosition(); void badDistributionBug(); @@ -97,76 +88,72 @@ private slots: void taskQTBUG_40609_addingLayoutToItself(); void replaceWidget(); void dontCrashWhenExtendsToEnd(); - -private: - QWidget *testWidget; - QGridLayout *testLayout; - QWidget *w1; - QWidget *w2; - QWidget *w3; - QSpacerItem *sp; - - QGridLayout *m_grid; - QWidget *m_toplevel; }; - -tst_QGridLayout::tst_QGridLayout() +void tst_QGridLayout::initTestCase() { - m_grid = 0; - m_toplevel = 0; +#ifdef Q_OS_WINCE //disable magic for WindowsCE + qApp->setAutoMaximizeThreshold(-1); +#endif } -tst_QGridLayout::~tst_QGridLayout() +static inline int visibleTopLevelWidgetCount() { - delete m_toplevel; + int result= 0; + foreach (const QWidget *topLevel, QApplication::topLevelWidgets()) { + if (topLevel->isVisible()) + ++result; + } + return result; } -void tst_QGridLayout::initTestCase() +void tst_QGridLayout::cleanup() { -#ifdef Q_OS_WINCE //disable magic for WindowsCE - qApp->setAutoMaximizeThreshold(-1); -#endif - // Create the test class - testWidget = new QWidget(0); + // Verify that no visible top levels are leaked. Cannot check for + // topLevelWidgets().isEmpty() here since the data driven test layoutSpacing() + // will appear to "leak" top levels due to it creating widgets in the test data. + QCOMPARE(visibleTopLevelWidgetCount(), 0); +} - testLayout = new QGridLayout(testWidget); +class ItemTestWidget : public QWidget { +public: + ItemTestWidget(); + + QGridLayout *testLayout; + QWidget *w1; + QWidget *w2; + QWidget *w3; + QSpacerItem *sp; +}; + +ItemTestWidget::ItemTestWidget() + : testLayout(new QGridLayout(this)) + , w1(new QWidget(this)) + , w2(new QWidget(this)) + , w3(new QWidget(this)) + , sp(new QSpacerItem(4, 4)) +{ + setObjectName("testWidget"); + setWindowTitle(QTest::currentTestFunction()); - w1 = new QWidget(testWidget); w1->setPalette(QPalette(Qt::red)); testLayout->addWidget(w1, 0, 0); - w2 = new QWidget(testWidget); testLayout->addWidget(w2, 1, 1, 2, 2); w2->setPalette(QPalette(Qt::green)); - w3 = new QWidget(testWidget); testLayout->addWidget(w3, 0, 1, 1, 2); w3->setPalette(QPalette(Qt::blue)); - sp = new QSpacerItem(4, 4); testLayout->addItem(sp, 1, 3, 2, 1); - - testWidget->resize( 200, 200 ); - testWidget->show(); -} - -void tst_QGridLayout::cleanupTestCase() -{ - delete testWidget; - testWidget = 0; -} - -void tst_QGridLayout::init() -{ -} - -void tst_QGridLayout::cleanup() -{ } void tst_QGridLayout::getItemPosition() { + ItemTestWidget testWidget; + testWidget.resize(200, 200); + testWidget.show(); + QLayoutItem *item; int counter = 0; @@ -175,28 +162,28 @@ void tst_QGridLayout::getItemPosition() bool seenW3 = false; bool seenSpacer = false; - while ((item = testLayout->itemAt(counter))) { + while ((item = testWidget.testLayout->itemAt(counter))) { QWidget *w = item->widget(); int r,c,rs,cs; - testLayout->getItemPosition(counter, &r, &c, &rs, &cs); + testWidget.testLayout->getItemPosition(counter, &r, &c, &rs, &cs); // qDebug() << "item" << counter << "has" <<r << c << rs << cs; - if (w == w1) { + if (w == testWidget.w1) { QVERIFY(!seenW1); seenW1 = true; QCOMPARE(r, 0); QCOMPARE(c, 0); QCOMPARE(rs, 1); QCOMPARE(cs, 1); - } else if (w == w2) { + } else if (w == testWidget.w2) { QVERIFY(!seenW2); seenW2 = true; QCOMPARE(r, 1); QCOMPARE(c, 1); QCOMPARE(rs, 2); QCOMPARE(cs, 2); - } else if (w == w3) { + } else if (w == testWidget.w3) { QVERIFY(!seenW3); seenW3 = true; QCOMPARE(r, 0); @@ -223,16 +210,20 @@ void tst_QGridLayout::getItemPosition() void tst_QGridLayout::itemAtPosition() { + ItemTestWidget testWidget; + testWidget.resize(200, 200); + testWidget.show(); + void *table[4][5] = { - { w1, w3, w3, 0, 0 }, - { 0, w2, w2, sp, 0 }, - { 0, w2, w2, sp, 0 }, + { testWidget.w1, testWidget.w3,testWidget.w3, 0, 0 }, + { 0, testWidget.w2, testWidget.w2, testWidget.sp, 0 }, + { 0, testWidget.w2, testWidget.w2, testWidget.sp, 0 }, { 0, 0, 0, 0, 0 } }; for (int row = 0; row < 4; ++row) { for (int col = 0; col < 5; ++col) { - QLayoutItem *item = testLayout->itemAtPosition(row, col); + QLayoutItem *item = testWidget.testLayout->itemAtPosition(row, col); QVERIFY(item == table[row][col] || (item && item->widget() == table[row][col])); } @@ -860,32 +851,31 @@ void tst_QGridLayout::minMaxSize() } } QApplication::setStyle(style); - if (!m_grid) - m_grid = new QGridLayout(); - if (!m_toplevel) { - m_toplevel = new QWidget(); - setFrameless(m_toplevel); - } + QWidget toplevel; + toplevel.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag())); + setFrameless(&toplevel); + QGridLayout *grid = new QGridLayout; if (fixedSize.isValid()) { - m_toplevel->setFixedSize(fixedSize); + toplevel.setFixedSize(fixedSize); } else { - m_toplevel->setMinimumSize(QSize(0,0)); - m_toplevel->setMaximumSize(QSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX)); + toplevel.setMinimumSize(QSize(0,0)); + toplevel.setMaximumSize(QSize(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX)); } // Do a two-pass one using the real testdata, the other pass enables heightForWidth // on the widget, but the heightForWidth() function just return sizeHint().width() for (int pass = 0; pass < 2; ++pass) { - m_toplevel->hide(); + toplevel.hide(); QApplication::processEvents(); QTest::qWait(20); // Test if removeItem uninitializes data properly - while (m_grid->count()) { - QLayoutItem *item = m_grid->itemAt(0); - m_grid->removeItem(item); + while (grid->count()) { + QLayoutItem *item = grid->itemAt(0); + grid->removeItem(item); delete item->widget(); delete item; } - m_toplevel->setLayout(m_grid); + toplevel.setLayout(grid); // a layout with a top-level parent widget QList<QPointer<SizeHinterFrame> > sizehinters; @@ -899,29 +889,29 @@ void tst_QGridLayout::minMaxSize() QSizePolicy sp = sh->sizePolicy(); sp.setHorizontalPolicy((QSizePolicy::Policy)sizePolicy); sh->setSizePolicy(sp); - sh->setParent(m_toplevel); + sh->setParent(&toplevel); if (si.minSize.isValid()) sh->setMinimumSize(si.minSize); if (si.maxSize.isValid()) sh->setMaximumSize(si.maxSize); sizehinters.append(sh); - m_grid->addWidget(sh, i, j); + grid->addWidget(sh, i, j); } } - m_toplevel->show(); - QVERIFY(QTest::qWaitForWindowExposed(m_toplevel)); - m_toplevel->adjustSize(); + toplevel.show(); + QVERIFY(QTest::qWaitForWindowExposed(&toplevel)); + toplevel.adjustSize(); QTest::qWait(240); // wait for the implicit adjustSize // If the following fails we might have to wait longer. // If that does not help there is likely a problem with the implicit adjustSize in show() if (!fixedSize.isValid()) { // Note that this can fail if the desktop has large fonts on windows. - QTRY_COMPARE(m_toplevel->size(), m_toplevel->sizeHint()); + QTRY_COMPARE(toplevel.size(), toplevel.sizeHint()); } // We are relying on the order here... for (int pi = 0; pi < sizehinters.count(); ++pi) { - QPoint pt = sizehinters.at(pi)->mapTo(m_toplevel, QPoint(0, 0)); + QPoint pt = sizehinters.at(pi)->mapTo(&toplevel, QPoint(0, 0)); QCOMPARE(pt, sizeinfos.at(pi).expectedPos); } } diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index d661c074ac..3bdd335fa6 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -66,6 +66,7 @@ public: virtual ~tst_QLayout(); private slots: + void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void getSetCheck(); void geometry(); void smartMaxSize(); diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 7b9eaa418f..f206a5fe9a 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -108,6 +108,7 @@ public slots: public slots: void initTestCase(); void cleanupTestCase(); + void cleanup() { QCOMPARE(QApplication::topLevelWidgets().size(), 1); } private slots: void number_data(); diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp index 6c88f8731b..0f8c9d1c9e 100644 --- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp +++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp @@ -44,6 +44,7 @@ class tst_QSizePolicy : public QObject Q_OBJECT private Q_SLOTS: + void cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); } void qtest(); void defaultValues(); void getSetCheck_data() { data(); } @@ -51,6 +52,8 @@ private Q_SLOTS: void dataStream(); void horizontalStretch(); void verticalStretch(); + void qhash_data() { data(); } + void qhash(); private: void data() const; }; @@ -149,8 +152,6 @@ void tst_QSizePolicy::getSetCheck() QCOMPARE(sp.expandingDirections(), ed); } -#undef FETCH_TEST_DATA - static void makeRow(QSizePolicy sp, QSizePolicy::Policy hp, QSizePolicy::Policy vp, int hst, int vst, QSizePolicy::ControlType ct, bool hfw, bool wfh, Qt::Orientations orients) @@ -314,5 +315,21 @@ void tst_QSizePolicy::verticalStretch() QCOMPARE(sp.verticalStretch(), 255); } +void tst_QSizePolicy::qhash() +{ + FETCH_TEST_DATA; + Q_UNUSED(ed); + + QSizePolicy sp2(hp, vp, ct); + sp2.setVerticalStretch(vst); + sp2.setHorizontalStretch(hst); + if (hfw) sp2.setHeightForWidth(true); + if (wfh) sp2.setWidthForHeight(true); + QCOMPARE(sp, sp2); + QCOMPARE(qHash(sp), qHash(sp2)); +} + +#undef FETCH_TEST_DATA + QTEST_MAIN(tst_QSizePolicy) #include "tst_qsizepolicy.moc" diff --git a/tests/auto/widgets/kernel/qtooltip/BLACKLIST b/tests/auto/widgets/kernel/qtooltip/BLACKLIST new file mode 100644 index 0000000000..f8d062cc46 --- /dev/null +++ b/tests/auto/widgets/kernel/qtooltip/BLACKLIST @@ -0,0 +1,4 @@ +[whatsThis] +ubuntu-14.04 +[task183679] +opensuse-13.1 diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 591aa9e40f..78ccbe302a 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -12,7 +12,7 @@ osx ubuntu-14.04 osx [focusProxyAndInputMethods] -ubuntu-14.04 +linux [touchEventSynthesizedMouseEvent] ubuntu-14.04 [grabMouse] @@ -28,73 +28,17 @@ osx [stackUnder] osx [raise] -osx-10.9 +osx [widgetAt] osx [sheetOpacity] osx [resizeEvent] osx -[setWindowGeometry:100,123 200x200, flags 0] -osx-10.10 -[windowMoveResize:100,123 200x200, flags 0] -osx-10.10 -[setWindowGeometry:100,122 200x200, flags 0] -osx-10.9 -[windowMoveResize:100,122 200x200, flags 0] -osx-10.9 -[setWindowGeometry:100,100 824x564, flags 0] -osx-10.10 -[windowMoveResize:100,100 824x564, flags 0] -osx-10.10 -[setWindowGeometry:100,100 824x516, flags 0] -osx-10.10 -[windowMoveResize:100,100 824x516, flags 0] -osx-10.10 -[setWindowGeometry:100,73 200x0, flags 0] -osx-10.10 -[windowMoveResize:100,73 200x0, flags 0] -osx-10.10 -[setWindowGeometry:100,100 824x519, flags 0] -osx-10.10 -[windowMoveResize:100,100 824x519, flags 0] -osx-10.10 -[setWindowGeometry:100,100 824x518, flags 0] -osx-10.10 -[windowMoveResize:100,100 824x518, flags 0] -osx-10.10 -[setWindowGeometry:100,72 200x0, flags 0] -osx-10.9 -[windowMoveResize:100,72 200x0, flags 0] -osx-10.9 -[setWindowGeometry:100,122 952x574, flags 0] -osx-10.9 -[windowMoveResize:100,122 952x574, flags 0] -osx-10.9 -[setWindowGeometry:100,122 952x578, flags 0] -osx-10.9 -[windowMoveResize:100,122 952x578, flags 0] -osx-10.9 -[setWindowGeometry:100,122 952x576, flags 0] -osx-10.9 -[windowMoveResize:100,122 952x576, flags 0] -osx-10.9 -[setWindowGeometry:100,100 824x521, flags 0] -osx-10.10 -[windowMoveResize:100,100 824x521, flags 0] -osx-10.10 -[setWindowGeometry:100,122 952x577, flags 0] -osx-10.9 -[windowMoveResize:100,122 952x577, flags 0] -osx-10.9 -[setWindowGeometry:100,122 952x580, flags 0] -osx-10.9 -[windowMoveResize:100,122 952x580, flags 0] -osx-10.9 -[windowMoveResize:130,72 0x0, flags 0] -osx-10.9 -[windowMoveResize:130,122 0x200, flags 0] -osx-10.9 +[setWindowGeometry] +osx +[windowMoveResize] +osx [childEvents] osx [renderInvisible] @@ -114,9 +58,9 @@ osx [showMinimizedKeepsFocus] osx-10.10 [moveWindowInShowEvent:1] -osx-10.9 +osx [moveWindowInShowEvent:2] -osx-10.9 +osx [taskQTBUG_4055_sendSyntheticEnterLeave] osx [syntheticEnterLeave] @@ -128,10 +72,14 @@ osx-10.10 [hideOpaqueChildWhileHidden] osx [resizeStaticContentsChildWidget_QTBUG35282] -osx-10.9 +osx [lower] osx [setClearAndResizeMask] osx [setToolTip] osx-10.9 +[moveInResizeEvent] +ubuntu-14.04 +[moveChild:right] +osx diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index a0d94d2dc9..68ccaef43f 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -3441,7 +3441,8 @@ void tst_QWidget::testDeletionInEventHandlers() w = new Widget; w->show(); w->deleteThis = true; - QTest::mouseRelease(w, Qt::LeftButton); + QMouseEvent me(QEvent::MouseButtonRelease, QPoint(1, 1), Qt::LeftButton, Qt::LeftButton, 0); + qApp->notify(w, &me); QVERIFY(w == 0); delete w; @@ -3479,7 +3480,7 @@ void tst_QWidget::testDeletionInEventHandlers() w->setMouseTracking(true); w->show(); w->deleteThis = true; - QMouseEvent me(QEvent::MouseMove, QPoint(0, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier); + me = QMouseEvent(QEvent::MouseMove, QPoint(0, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier); QApplication::sendEvent(w, &me); QVERIFY(w == 0); delete w; @@ -6007,10 +6008,13 @@ void tst_QWidget::childEvents() expected = EventRecorder::EventList() << qMakePair(&widget, QEvent::Polish) + << qMakePair(&widget, QEvent::PlatformSurface) << qMakePair(&widget, QEvent::WinIdChange) + << qMakePair(&widget, QEvent::WindowIconChange) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) << qMakePair(&widget, QEvent::Show) + << qMakePair(&widget, QEvent::CursorChange) << qMakePair(&widget, QEvent::ShowToParent); QVERIFY2(spy.eventList() == expected, @@ -6022,13 +6026,9 @@ void tst_QWidget::childEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) -#if defined(Q_OS_OSX) || defined(Q_OS_QNX) << qMakePair(&widget, QEvent::UpdateLater) -#endif << qMakePair(&widget, QEvent::UpdateRequest); - if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) - QEXPECT_FAIL("", EventRecorder::msgExpectFailQtBug26424(expected, spy.eventList()).constData(), Continue); QVERIFY2(spy.eventList() == expected, EventRecorder::msgEventListMismatch(expected, spy.eventList()).constData()); } @@ -6097,10 +6097,13 @@ void tst_QWidget::childEvents() << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::ChildPolished) << qMakePair(&widget, QEvent::ChildPolished) + << qMakePair(&widget, QEvent::PlatformSurface) << qMakePair(&widget, QEvent::WinIdChange) + << qMakePair(&widget, QEvent::WindowIconChange) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) << qMakePair(&widget, QEvent::Show) + << qMakePair(&widget, QEvent::CursorChange) << qMakePair(&widget, QEvent::ShowToParent); QVERIFY2(spy.eventList() == expected, @@ -6113,13 +6116,9 @@ void tst_QWidget::childEvents() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) -#if defined(Q_OS_OSX) || defined(Q_OS_QNX) << qMakePair(&widget, QEvent::UpdateLater) -#endif << qMakePair(&widget, QEvent::UpdateRequest); - if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) - QEXPECT_FAIL("", EventRecorder::msgExpectFailQtBug26424(expected, spy.eventList()).constData(), Continue); QVERIFY2(spy.eventList() == expected, EventRecorder::msgEventListMismatch(expected, spy.eventList()).constData()); } @@ -6190,10 +6189,13 @@ void tst_QWidget::childEvents() EventRecorder::EventList() << qMakePair(&widget, QEvent::Polish) << qMakePair(&widget, QEvent::ChildPolished) + << qMakePair(&widget, QEvent::PlatformSurface) << qMakePair(&widget, QEvent::WinIdChange) + << qMakePair(&widget, QEvent::WindowIconChange) << qMakePair(&widget, QEvent::Move) << qMakePair(&widget, QEvent::Resize) << qMakePair(&widget, QEvent::Show) + << qMakePair(&widget, QEvent::CursorChange) << qMakePair(&widget, QEvent::ShowToParent); QVERIFY2(spy.eventList() == expected, @@ -6206,13 +6208,9 @@ void tst_QWidget::childEvents() << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) -#if defined(Q_OS_OSX) || defined(Q_OS_QNX) << qMakePair(&widget, QEvent::UpdateLater) -#endif << qMakePair(&widget, QEvent::UpdateRequest); - if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) - QEXPECT_FAIL("", EventRecorder::msgExpectFailQtBug26424(expected, spy.eventList()).constData(), Continue); QVERIFY2(spy.eventList() == expected, EventRecorder::msgEventListMismatch(expected, spy.eventList()).constData()); } @@ -8957,7 +8955,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() int numEnterEvents, numMouseMoveEvents; }; - QCursor::setPos(QPoint(0,0)); + QCursor::setPos(QPoint(0,0)); SELParent parent; parent.move(200, 200); @@ -8965,8 +8963,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() SELChild child(&parent); child.resize(200, 200); parent.show(); - QVERIFY(QTest::qWaitForWindowExposed(&parent)); - QTest::qWait(150); + QVERIFY(QTest::qWaitForWindowActive(&parent)); QCursor::setPos(child.mapToGlobal(QPoint(100, 100))); // Make sure the cursor has entered the child. @@ -9714,8 +9711,9 @@ void tst_QWidget::grabMouse() QVERIFY(QTest::qWaitForWindowActive(&w)); QStringList expectedLog; - grabber->grabMouse(); QPoint mousePos = QPoint(w.width() / 2, 10); + QTest::mouseMove(w.windowHandle(), mousePos); + grabber->grabMouse(); const int step = w.height() / 5; for ( ; mousePos.y() < w.height() ; mousePos.ry() += step) { QTest::mouseClick(w.windowHandle(), Qt::LeftButton, 0, mousePos); @@ -10385,6 +10383,9 @@ public: void tst_QWidget::keyboardModifiers() { KeyboardWidget w; + w.resize(300, 300); + w.show(); + QVERIFY(QTest::qWaitForWindowActive(&w)); QTest::mouseClick(&w, Qt::LeftButton, Qt::ControlModifier); QCOMPARE(w.m_eventCounter, 1); QCOMPARE(int(w.m_modifiers), int(Qt::ControlModifier)); diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 148c2352a5..4bdb299213 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -97,6 +97,8 @@ private slots: void tst_resize_count(); void tst_move_count(); + + void tst_eventfilter_on_toplevel(); }; void tst_QWidget_window::initTestCase() @@ -762,5 +764,48 @@ void tst_QWidget_window::tst_move_count() QTRY_VERIFY(move.moveCount >= 1); } +class EventFilter : public QObject +{ +public: + int eventCount; + + EventFilter() + : QObject(), + eventCount(0) + { + } + + static QEvent::Type filterEventType() + { + static int type = QEvent::registerEventType(); + return static_cast<QEvent::Type>(type); + } + +protected: + bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE + { + if (e->type() == filterEventType()) + ++eventCount; + + return QObject::eventFilter(o, e); + } +}; + +void tst_QWidget_window::tst_eventfilter_on_toplevel() +{ + QWidget w; + EventFilter filter; + w.installEventFilter(&filter); + w.show(); + QVERIFY(QTest::qWaitForWindowActive(&w)); + QVERIFY(w.isWindow()); + QCOMPARE(filter.eventCount, 0); + + // send an event not handled in a special way by QWidgetWindow::event, + // and check that it's received by the event filter + QCoreApplication::postEvent(w.windowHandle(), new QEvent(EventFilter::filterEventType())); + QTRY_COMPARE(filter.eventCount, 1); +} + QTEST_MAIN(tst_QWidget_window) #include "tst_qwidget_window.moc" diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp index df54d22a2f..d10ce054b0 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp @@ -55,6 +55,8 @@ class tst_QWidgetAction : public QObject { Q_OBJECT private slots: + void initTestCase(); + void cleanup(); void defaultWidget(); void visibilityUpdate(); void customWidget(); @@ -65,6 +67,19 @@ private slots: void releaseWidgetCrash(); }; +void tst_QWidgetAction::initTestCase() +{ + // Disable menu/combo animations to prevent the alpha widgets from getting in the + // way in popup(), failing the top level leak check in cleanup(). + QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false); + QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false); +} + +void tst_QWidgetAction::cleanup() +{ + QVERIFY(QApplication::topLevelWidgets().isEmpty()); +} + void tst_QWidgetAction::defaultWidget() { { diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST new file mode 100644 index 0000000000..cf78fb47c2 --- /dev/null +++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST @@ -0,0 +1,2 @@ +[hoverColors] +ubuntu-14.04 diff --git a/tests/auto/widgets/util/qcompleter/BLACKLIST b/tests/auto/widgets/util/qcompleter/BLACKLIST index ffbcc94a1f..fdc424b6ac 100644 --- a/tests/auto/widgets/util/qcompleter/BLACKLIST +++ b/tests/auto/widgets/util/qcompleter/BLACKLIST @@ -1,2 +1,2 @@ [QTBUG_14292_filesystem] -ubuntu-14.04 +linux diff --git a/tests/auto/widgets/widgets/qdockwidget/BLACKLIST b/tests/auto/widgets/widgets/qdockwidget/BLACKLIST new file mode 100644 index 0000000000..60adfb9f4b --- /dev/null +++ b/tests/auto/widgets/widgets/qdockwidget/BLACKLIST @@ -0,0 +1,2 @@ +[restoreDockWidget] +ubuntu-14.04 diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png Binary files differindex a75833c89c..00447760ec 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png Binary files differindex d656ac56f0..4c809a2c80 100644 --- a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png diff --git a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST index b8640e9ac3..63da2e3ae3 100644 --- a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST +++ b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST @@ -1,2 +1,5 @@ [updateScrollBars] osx +[tileSubWindows] +osx +xcb diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 46d3177a56..7e0e752f02 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -78,6 +78,7 @@ public slots: private slots: void getSetCheck(); void addActionsAndClear(); + void addActionsConnect(); void keyboardNavigation_data(); void keyboardNavigation(); @@ -264,6 +265,34 @@ void tst_QMenu::addActionsAndClear() QCOMPARE(menus[0]->actions().count(), 0); } +static void testFunction() { } + +void tst_QMenu::addActionsConnect() +{ + QMenu menu; + const QString text = QLatin1String("bla"); + const QIcon icon; + menu.addAction(text, &menu, SLOT(deleteLater())); + menu.addAction(text, &menu, &QMenu::deleteLater); + menu.addAction(text, testFunction); + menu.addAction(text, &menu, testFunction); + menu.addAction(icon, text, &menu, SLOT(deleteLater())); + menu.addAction(icon, text, &menu, &QMenu::deleteLater); + menu.addAction(icon, text, testFunction); + menu.addAction(icon, text, &menu, testFunction); +#ifndef QT_NO_SHORTCUT + const QKeySequence keySequence(Qt::CTRL + Qt::Key_C); + menu.addAction(text, &menu, SLOT(deleteLater()), keySequence); + menu.addAction(text, &menu, &QMenu::deleteLater, keySequence); + menu.addAction(text, testFunction, keySequence); + menu.addAction(text, &menu, testFunction, keySequence); + menu.addAction(icon, text, &menu, SLOT(deleteLater()), keySequence); + menu.addAction(icon, text, &menu, &QMenu::deleteLater, keySequence); + menu.addAction(icon, text, testFunction, keySequence); + menu.addAction(icon, text, &menu, testFunction, keySequence); +#endif // !QT_NO_SHORTCUT +} + // We have a separate mouseActivation test for Windows mobile #ifndef Q_OS_WINCE void tst_QMenu::mouseActivation() @@ -334,8 +363,10 @@ void tst_QMenu::keyboardNavigation_data() QTest::newRow("data9") << Qt::Key(Qt::Key_Down) << Qt::KeyboardModifiers(Qt::NoModifier) << 3 << 0 << false << false<< true; QTest::newRow("data10") << Qt::Key(Qt::Key_Return) << Qt::KeyboardModifiers(Qt::NoModifier) << 3 << 0 << false << true << false; - // Test shortcuts. - QTest::newRow("shortcut0") << Qt::Key(Qt::Key_V) << Qt::KeyboardModifiers(Qt::AltModifier) << 5 << 0 << true << true << false; + if (qApp->platformName().toLower() != QStringLiteral("xcb")) { + // Test shortcuts. + QTest::newRow("shortcut0") << Qt::Key(Qt::Key_V) << Qt::KeyboardModifiers(Qt::AltModifier) << 5 << 0 << true << true << false; + } } void tst_QMenu::keyboardNavigation() diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST new file mode 100644 index 0000000000..725b8e93b4 --- /dev/null +++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST @@ -0,0 +1,2 @@ +[clearAndGrab] +opensuse-13.1 diff --git a/tests/auto/widgets/widgets/qsizegrip/BLACKLIST b/tests/auto/widgets/widgets/qsizegrip/BLACKLIST new file mode 100644 index 0000000000..2c874bcb57 --- /dev/null +++ b/tests/auto/widgets/widgets/qsizegrip/BLACKLIST @@ -0,0 +1,2 @@ +[hideAndShowOnWindowStateChange:Qt::Window] +xcb diff --git a/tests/auto/widgets/widgets/qspinbox/BLACKLIST b/tests/auto/widgets/widgets/qspinbox/BLACKLIST new file mode 100644 index 0000000000..5bf6c3beed --- /dev/null +++ b/tests/auto/widgets/widgets/qspinbox/BLACKLIST @@ -0,0 +1,3 @@ +[editingFinished] +osx-10.8 +osx-10.9 diff --git a/tests/auto/widgets/widgets/qtabbar/BLACKLIST b/tests/auto/widgets/widgets/qtabbar/BLACKLIST new file mode 100644 index 0000000000..b000b08444 --- /dev/null +++ b/tests/auto/widgets/widgets/qtabbar/BLACKLIST @@ -0,0 +1,2 @@ +[sizeHints] +ubuntu-14.04 diff --git a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp index 24de35ce89..642abc3add 100644 --- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp @@ -67,6 +67,7 @@ private slots: void allowedAreas(); void orientation(); void addAction(); + void addActionConnect(); void insertAction(); void addSeparator(); void insertSeparator(); @@ -361,6 +362,23 @@ void tst_QToolBar::addAction() } } +static void testFunction() { } + +void tst_QToolBar::addActionConnect() +{ + QToolBar tb; + const QString text = QLatin1String("bla"); + const QIcon icon; + tb.addAction(text, &tb, SLOT(deleteLater())); + tb.addAction(text, &tb, &QMenu::deleteLater); + tb.addAction(text, testFunction); + tb.addAction(text, &tb, testFunction); + tb.addAction(icon, text, &tb, SLOT(deleteLater())); + tb.addAction(icon, text, &tb, &QMenu::deleteLater); + tb.addAction(icon, text, testFunction); + tb.addAction(icon, text, &tb, testFunction); +} + void tst_QToolBar::insertAction() { QToolBar tb; |