summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp32
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp62
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp8
-rw-r--r--tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp8
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp78
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp34
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp62
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST121
-rw-r--r--tests/auto/widgets/kernel/qwidget/qwidget.pro2
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp57
-rw-r--r--tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp66
-rw-r--r--tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp45
-rw-r--r--tests/auto/widgets/widgets/qmenu/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qmenubar/BLACKLIST2
16 files changed, 532 insertions, 54 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index fecc14f541..e62ce3ceb5 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -564,6 +564,11 @@ void tst_QDialog::snapToDefaultButton()
topLeftPos = QPoint(topLeftPos.x() + 100, topLeftPos.y() + 100);
QPoint startingPos(topLeftPos.x() + 250, topLeftPos.y() + 250);
QCursor::setPos(startingPos);
+#ifdef Q_OS_OSX
+ // On OS X we use CGEventPost to move the cursor, it needs at least
+ // some time before the event handled and the position really set.
+ QTest::qWait(100);
+#endif
QCOMPARE(QCursor::pos(), startingPos);
QDialog dialog;
QPushButton *button = new QPushButton(&dialog);
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index da0c5532a5..9b92c34fb5 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -179,6 +179,7 @@ private slots:
void task250119_shortcutContext();
void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
void QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems();
+ void QTBUG_45867_send_itemChildAddedChange_to_parent();
};
@@ -3490,5 +3491,36 @@ void tst_QGraphicsWidget::QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems()
//This should not crash
}
+void tst_QGraphicsWidget::QTBUG_45867_send_itemChildAddedChange_to_parent()
+{
+ class GraphicsItem : public QGraphicsItem
+ {
+ public:
+ int m_itemChildAddedChangeNotificationsCount;
+
+ GraphicsItem()
+ : QGraphicsItem(),
+ m_itemChildAddedChangeNotificationsCount(0)
+ {
+ }
+
+ QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(); }
+
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE {}
+
+ protected:
+ QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE
+ {
+ if (change == QGraphicsItem::ItemChildAddedChange)
+ ++m_itemChildAddedChangeNotificationsCount;
+ return QGraphicsItem::itemChange(change, value);
+ }
+ };
+
+ GraphicsItem item;
+ QGraphicsWidget widget(&item);
+ QCOMPARE(item.m_itemChildAddedChangeNotificationsCount, 1);
+}
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 22245707cc..9b8b306e00 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -48,6 +48,7 @@
#include <QtWidgets/QScrollBar>
#include <QtWidgets/QDialog>
#include <QtWidgets/QStyledItemDelegate>
+#include <QtWidgets/QStyleFactory>
#if defined(Q_OS_WIN) || defined(Q_OS_WINCE)
# include <windows.h>
@@ -2350,11 +2351,34 @@ void tst_QListView::testViewOptions()
QCOMPARE(options.decorationPosition, QStyleOptionViewItem::Top);
}
+// make sure we have no transient scroll bars
+class TempStyleSetter
+{
+public:
+ TempStyleSetter()
+ : m_oldStyle(qApp->style())
+ {
+ m_oldStyle->setParent(0);
+ QListView tempView;
+ if (QApplication::style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, tempView.horizontalScrollBar()))
+ QApplication::setStyle(QStyleFactory::create("Fusion"));
+ }
+
+ ~TempStyleSetter()
+ {
+ QApplication::setStyle(m_oldStyle);
+ }
+private:
+ QStyle* m_oldStyle;
+};
+
void tst_QListView::taskQTBUG_39902_mutualScrollBars()
{
QWidget window;
window.resize(400, 300);
QListView *view = new QListView(&window);
+ // make sure we have no transient scroll bars
+ TempStyleSetter styleSetter;
QStandardItemModel model(200, 1);
const QSize itemSize(100, 20);
for (int i = 0; i < model.rowCount(); ++i)
@@ -2372,6 +2396,44 @@ void tst_QListView::taskQTBUG_39902_mutualScrollBars()
view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
// this will end up in a stack overflow, if QTBUG-39902 is not fixed
QTest::qWait(100);
+
+ // these tests do not apply with transient scroll bars enabled
+ QVERIFY (!view->style()->styleHint(QStyle::SH_ScrollBar_Transient, 0, view->horizontalScrollBar()));
+
+ // make it double as large, no scroll bars should be visible
+ view->resize((itemSize.width() + view->frameWidth() * 2) * 2, (model.rowCount() * itemSize.height() + view->frameWidth() * 2) * 2);
+ QTRY_VERIFY(!view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(!view->verticalScrollBar()->isVisible());
+
+ // make it half the size, both scroll bars should be visible
+ view->resize((itemSize.width() + view->frameWidth() * 2) / 2, (model.rowCount() * itemSize.height() + view->frameWidth() * 2) / 2);
+ QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(view->verticalScrollBar()->isVisible());
+
+ // make it double as large, no scroll bars should be visible
+ view->resize((itemSize.width() + view->frameWidth() * 2) * 2, (model.rowCount() * itemSize.height() + view->frameWidth() * 2) * 2);
+ QTRY_VERIFY(!view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(!view->verticalScrollBar()->isVisible());
+
+ // now, coming from the double size, resize it to the exactly matching size, still no scroll bars should be visible again
+ view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
+ QTRY_VERIFY(!view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(!view->verticalScrollBar()->isVisible());
+
+ // now remove just one single pixel in height -> both scroll bars will show up since they depend on each other
+ view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2 - 1);
+ QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(view->verticalScrollBar()->isVisible());
+
+ // now remove just one single pixel in with -> both scroll bars will show up since they depend on each other
+ view->resize(itemSize.width() + view->frameWidth() * 2 - 1, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
+ QTRY_VERIFY(view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(view->verticalScrollBar()->isVisible());
+
+ // finally, coming from a size being to small, resize back to the exactly matching size -> both scroll bars should disappear again
+ view->resize(itemSize.width() + view->frameWidth() * 2, model.rowCount() * itemSize.height() + view->frameWidth() * 2);
+ QTRY_VERIFY(!view->horizontalScrollBar()->isVisible());
+ QTRY_VERIFY(!view->verticalScrollBar()->isVisible());
}
void tst_QListView::horizontalScrollingByVerticalWheelEvents()
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index 6786ae9aa2..dcbdbe824a 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -605,21 +605,21 @@ void tst_QListWidget::insertItems()
void tst_QListWidget::itemAssignment()
{
QListWidgetItem itemInWidget("inWidget", testWidget);
- itemInWidget.setFlags(itemInWidget.flags() | Qt::ItemIsTristate);
+ itemInWidget.setFlags(itemInWidget.flags() | Qt::ItemIsUserTristate);
QListWidgetItem itemOutsideWidget("outsideWidget");
QVERIFY(itemInWidget.listWidget());
QCOMPARE(itemInWidget.text(), QString("inWidget"));
- QVERIFY(itemInWidget.flags() & Qt::ItemIsTristate);
+ QVERIFY(itemInWidget.flags() & Qt::ItemIsUserTristate);
QVERIFY(!itemOutsideWidget.listWidget());
QCOMPARE(itemOutsideWidget.text(), QString("outsideWidget"));
- QVERIFY(!(itemOutsideWidget.flags() & Qt::ItemIsTristate));
+ QVERIFY(!(itemOutsideWidget.flags() & Qt::ItemIsUserTristate));
itemOutsideWidget = itemInWidget;
QVERIFY(!itemOutsideWidget.listWidget());
QCOMPARE(itemOutsideWidget.text(), QString("inWidget"));
- QVERIFY(itemOutsideWidget.flags() & Qt::ItemIsTristate);
+ QVERIFY(itemOutsideWidget.flags() & Qt::ItemIsUserTristate);
}
void tst_QListWidget::item_data()
diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
index a4c6e13979..36bc23910c 100644
--- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp
@@ -281,21 +281,21 @@ void tst_QTableWidget::itemAssignment()
{
QTableWidgetItem itemInWidget("inWidget");
testWidget->setItem(0, 0, &itemInWidget);
- itemInWidget.setFlags(itemInWidget.flags() | Qt::ItemIsTristate);
+ itemInWidget.setFlags(itemInWidget.flags() | Qt::ItemIsUserTristate);
QTableWidgetItem itemOutsideWidget("outsideWidget");
QVERIFY(itemInWidget.tableWidget());
QCOMPARE(itemInWidget.text(), QString("inWidget"));
- QVERIFY(itemInWidget.flags() & Qt::ItemIsTristate);
+ QVERIFY(itemInWidget.flags() & Qt::ItemIsUserTristate);
QVERIFY(!itemOutsideWidget.tableWidget());
QCOMPARE(itemOutsideWidget.text(), QString("outsideWidget"));
- QVERIFY(!(itemOutsideWidget.flags() & Qt::ItemIsTristate));
+ QVERIFY(!(itemOutsideWidget.flags() & Qt::ItemIsUserTristate));
itemOutsideWidget = itemInWidget;
QVERIFY(!itemOutsideWidget.tableWidget());
QCOMPARE(itemOutsideWidget.text(), QString("inWidget"));
- QVERIFY(itemOutsideWidget.flags() & Qt::ItemIsTristate);
+ QVERIFY(itemOutsideWidget.flags() & Qt::ItemIsUserTristate);
}
void tst_QTableWidget::item_data()
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 3ead172d82..1324027af6 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -255,6 +255,7 @@ private slots:
void taskQTBUG_8176_emitOnExpandAll();
void taskQTBUG_34717_collapseAtBottom();
void taskQTBUG_37813_crash();
+ void taskQTBUG_45697_crash();
void testInitialFocus();
};
@@ -4385,5 +4386,82 @@ void tst_QTreeView::taskQTBUG_37813_crash()
#endif // QT_BUILD_INTERNAL
}
+// QTBUG-45697: Using a QTreeView with a multi-column model filtered by QSortFilterProxyModel,
+// when sorting the source model while the widget is not yet visible and showing the widget
+// later on, corruption occurs in QTreeView.
+class Qtbug45697TestWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ static const int columnCount = 3;
+
+ explicit Qtbug45697TestWidget();
+ int timerTick() const { return m_timerTick; }
+
+public slots:
+ void slotTimer();
+
+private:
+ QTreeView *m_treeView;
+ QStandardItemModel *m_model;
+ QSortFilterProxyModel *m_sortFilterProxyModel;
+ int m_timerTick;
+};
+
+Qtbug45697TestWidget::Qtbug45697TestWidget()
+ : m_treeView(new QTreeView(this))
+ , m_model(new QStandardItemModel(0, Qtbug45697TestWidget::columnCount, this))
+ , m_sortFilterProxyModel(new QSortFilterProxyModel(this))
+ , m_timerTick(0)
+ {
+ QVBoxLayout *vBoxLayout = new QVBoxLayout(this);
+ vBoxLayout->addWidget(m_treeView);
+
+ for (char sortChar = 'z'; sortChar >= 'a' ; --sortChar) {
+ QList<QStandardItem *> items;
+ for (int column = 0; column < Qtbug45697TestWidget::columnCount; ++column) {
+ const QString text = QLatin1Char(sortChar) + QLatin1String(" ") + QString::number(column);
+ items.append(new QStandardItem(text));
+ }
+ m_model->appendRow(items);
+ }
+
+ m_sortFilterProxyModel->setSourceModel(m_model);
+ m_treeView->setModel(m_sortFilterProxyModel);
+
+ QHeaderView *headerView = m_treeView->header();
+ for (int s = 1, lastSection = headerView->count() - 1; s < lastSection; ++s )
+ headerView->setSectionResizeMode(s, QHeaderView::ResizeToContents);
+
+ QTimer *timer = new QTimer(this);
+ timer->setInterval(50);
+ connect(timer, &QTimer::timeout, this, &Qtbug45697TestWidget::slotTimer);
+ timer->start();
+}
+
+void Qtbug45697TestWidget::slotTimer()
+{
+ switch (m_timerTick++) {
+ case 0:
+ m_model->sort(0);
+ break;
+ case 1:
+ show();
+ break;
+ default:
+ close();
+ break;
+ }
+}
+
+void tst_QTreeView::taskQTBUG_45697_crash()
+{
+ Qtbug45697TestWidget testWidget;
+ testWidget.setWindowTitle(QTest::currentTestFunction());
+ testWidget.resize(400, 400);
+ testWidget.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(100, 100));
+ QTRY_VERIFY(testWidget.timerTick() >= 2);
+}
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index c9a1a64135..c33fd5a951 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -178,6 +178,12 @@ private slots:
void settableStyleHints_data();
void settableStyleHints(); // Needs to run last as it changes style hints.
+
+protected slots:
+ void quitApplication();
+
+private:
+ bool quitApplicationTriggered;
};
class EventSpy : public QObject
@@ -235,6 +241,7 @@ public:
static char *argv0;
tst_QApplication::tst_QApplication()
+ : quitApplicationTriggered(false)
{
#ifdef Q_OS_WINCE
// Clean up environment previously to launching test
@@ -719,11 +726,8 @@ void tst_QApplication::quitOnLastWindowClosed()
{
int argc = 0;
QApplication app(argc, 0);
- QTimer timer;
- timer.setInterval(100);
QSignalSpy spy(&app, SIGNAL(aboutToQuit()));
- QSignalSpy spy2(&timer, SIGNAL(timeout()));
CloseEventTestWindow mainWindow;
@@ -733,14 +737,14 @@ void tst_QApplication::quitOnLastWindowClosed()
mainWindow.show();
QVERIFY(QTest::qWaitForWindowExposed(&mainWindow));
- timer.start();
- QTimer::singleShot(1000, &mainWindow, SLOT(close())); // This should quit the application
- QTimer::singleShot(2000, &app, SLOT(quit())); // This makes sure we quit even if it didn't
+ QTimer::singleShot(1000, &mainWindow, SLOT(close())); // This should NOT quit the application (see CloseEventTestWindow)
+ quitApplicationTriggered = false;
+ QTimer::singleShot(2000, this, SLOT(quitApplication())); // This actually quits the application.
app.exec();
QCOMPARE(spy.count(), 1);
- QVERIFY(spy2.count() > 15); // Should be around 20 if closing did not caused the quit
+ QVERIFY(quitApplicationTriggered);
}
{
int argc = 0;
@@ -768,24 +772,20 @@ void tst_QApplication::quitOnLastWindowClosed()
QApplication app(argc, 0);
QVERIFY(app.quitOnLastWindowClosed());
- QTimer timer;
- timer.setInterval(100);
- QSignalSpy timerSpy(&timer, SIGNAL(timeout()));
-
QWindow w;
w.show();
QWidget wid;
wid.show();
- timer.start();
QTimer::singleShot(1000, &wid, SLOT(close())); // This should NOT quit the application because the
// QWindow is still there.
- QTimer::singleShot(2000, &app, SLOT(quit())); // This causes the quit.
+ quitApplicationTriggered = false;
+ QTimer::singleShot(2000, this, SLOT(quitApplication())); // This causes the quit.
app.exec();
- QVERIFY(timerSpy.count() > 15); // Should be around 20 if closing did not caused the quit
+ QVERIFY(quitApplicationTriggered); // Should be around 20 if closing did not caused the quit
}
{ // QTBUG-31569: If the last widget with Qt::WA_QuitOnClose set is closed, other
// widgets that don't have the attribute set should be closed automatically.
@@ -2406,6 +2406,12 @@ void tst_QApplication::globalStaticObjectDestruction()
#endif
}
+void tst_QApplication::quitApplication()
+{
+ quitApplicationTriggered = true;
+ qApp->quit();
+}
+
//QTEST_APPLESS_MAIN(tst_QApplication)
int main(int argc, char *argv[])
{
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index ebd99be786..0de9e188a0 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -34,30 +34,32 @@
#include <QtTest/QtTest>
#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qscreen.h>
class tst_QToolTip : public QObject
{
Q_OBJECT
-public:
- tst_QToolTip() {}
- virtual ~tst_QToolTip() {}
-
-public slots:
- void initTestCase() {}
- void cleanupTestCase() {}
- void init() {}
- void cleanup() {}
-
private slots:
-
- // task-specific tests below me
+ void init();
+ void cleanup();
void task183679_data();
void task183679();
void whatsThis();
void setPalette();
};
+void tst_QToolTip::init()
+{
+ QVERIFY(!QToolTip::isVisible());
+}
+
+void tst_QToolTip::cleanup()
+{
+ QTRY_VERIFY(QApplication::topLevelWidgets().isEmpty());
+}
+
class Widget_task183679 : public QWidget
{
Q_OBJECT
@@ -100,12 +102,14 @@ void tst_QToolTip::task183679()
#endif
Widget_task183679 widget;
+ widget.move(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(50, 50));
+ widget.setWindowTitle(QLatin1String(QTest::currentTestFunction())
+ + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag()));
widget.show();
QApplication::setActiveWindow(&widget);
QVERIFY(QTest::qWaitForWindowActive(&widget));
widget.showDelayedToolTip(100);
- QTest::qWait(300);
QTRY_VERIFY(QToolTip::isVisible());
QTest::keyPress(&widget, key);
@@ -116,26 +120,31 @@ void tst_QToolTip::task183679()
QTest::qWait(1500);
QCOMPARE(QToolTip::isVisible(), visible);
+ if (visible)
+ QToolTip::hideText();
}
-#include <QWhatsThis>
+static QWidget *findWhatsThat()
+{
+ foreach (QWidget *widget, QApplication::topLevelWidgets()) {
+ if (widget->inherits("QWhatsThat"))
+ return widget;
+ }
+ return Q_NULLPTR;
+}
void tst_QToolTip::whatsThis()
{
qApp->setStyleSheet( "QWidget { font-size: 72px; }" );
- QWhatsThis::showText(QPoint(0,0), "THis is text");
- QTest::qWait(400);
- QWidget *whatsthis = 0;
- foreach (QWidget *widget, QApplication::topLevelWidgets()) {
- if (widget->inherits("QWhatsThat")) {
- whatsthis = widget;
- break;
- }
- }
- QVERIFY(whatsthis);
+ QWhatsThis::showText(QPoint(0, 0), "This is text");
+
+ QWidget *whatsthis = Q_NULLPTR;
+ QTRY_VERIFY( (whatsthis = findWhatsThat()) );
QVERIFY(whatsthis->isVisible());
- QVERIFY(whatsthis->height() > 100); // Test QTBUG-2416
- qApp->setStyleSheet("");
+ const int whatsThisHeight = whatsthis->height();
+ qApp->setStyleSheet(QString());
+ QWhatsThis::hideText();
+ QVERIFY2(whatsThisHeight > 100, QByteArray::number(whatsThisHeight)); // Test QTBUG-2416
}
@@ -167,6 +176,7 @@ void tst_QToolTip::setPalette()
newPalette.setColor(QPalette::ToolTipText, Qt::blue);
QToolTip::setPalette(newPalette);
QCOMPARE(toolTip->palette(), newPalette);
+ QToolTip::hideText();
}
QTEST_MAIN(tst_QToolTip)
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index ed40f98051..591aa9e40f 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -1,11 +1,16 @@
+# OSX QTBUG-25300 QTBUG-45502
[normalGeometry]
ubuntu-14.04
+osx
[saveRestoreGeometry]
ubuntu-14.04
+osx
[restoreVersion1Geometry]
ubuntu-14.04
+osx
[updateWhileMinimized]
ubuntu-14.04
+osx
[focusProxyAndInputMethods]
ubuntu-14.04
[touchEventSynthesizedMouseEvent]
@@ -14,3 +19,119 @@ ubuntu-14.04
ubuntu-14.04
[largerThanScreen_QTBUG30142]
ubuntu-14.04
+[windowState]
+osx
+[showMaximized]
+osx
+[setGeometry]
+osx
+[stackUnder]
+osx
+[raise]
+osx-10.9
+[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
+[childEvents]
+osx
+[renderInvisible]
+osx
+[optimizedResizeMove]
+osx
+[optimizedResize_topLevel]
+osx
+[render_systemClip]
+osx
+[update]
+osx
+[doubleRepaint]
+osx
+[childAt_unifiedToolBar]
+osx
+[showMinimizedKeepsFocus]
+osx-10.10
+[moveWindowInShowEvent:1]
+osx-10.9
+[moveWindowInShowEvent:2]
+osx-10.9
+[taskQTBUG_4055_sendSyntheticEnterLeave]
+osx
+[syntheticEnterLeave]
+osx
+[maskedUpdate]
+osx
+[hideWhenFocusWidgetIsChild]
+osx-10.10
+[hideOpaqueChildWhileHidden]
+osx
+[resizeStaticContentsChildWidget_QTBUG35282]
+osx-10.9
+[lower]
+osx
+[setClearAndResizeMask]
+osx
+[setToolTip]
+osx-10.9
diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro
index 30e1048247..aae083d45e 100644
--- a/tests/auto/widgets/kernel/qwidget/qwidget.pro
+++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro
@@ -21,5 +21,3 @@ x11 {
}
!wince*:win32:!winrt: LIBS += -luser32 -lgdi32
-
-mac:CONFIG+=insignificant_test # QTBUG-25300, QTBUG-23695
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 10c553bd3e..68ccaef43f 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -436,6 +436,7 @@ private slots:
void grabKeyboard();
void touchEventSynthesizedMouseEvent();
+ void touchUpdateOnNewTouch();
void styleSheetPropagation();
@@ -3335,8 +3336,6 @@ void tst_QWidget::widgetAt()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
#endif
- if (!QGuiApplication::platformName().compare(QLatin1String("cocoa"), Qt::CaseInsensitive))
- QEXPECT_FAIL("", "Window mask not implemented on Mac QTBUG-22326", Continue);
QTRY_VERIFY((wr = QApplication::widgetAt(testPos)));
QTRY_COMPARE(wr->objectName(), w1->objectName());
@@ -3355,8 +3354,6 @@ void tst_QWidget::widgetAt()
#if defined(Q_OS_WINCE)
QEXPECT_FAIL("", "Windows CE does only support rectangular regions", Continue); //See also task 147191
#endif
- if (!QGuiApplication::platformName().compare(QLatin1String("cocoa"), Qt::CaseInsensitive))
- QEXPECT_FAIL("", "Window mask not implemented on Mac QTBUG-22326", Continue);
QTRY_VERIFY(QApplication::widgetAt(testPos) == w1.data());
QTRY_VERIFY(QApplication::widgetAt(testPos + QPoint(1, 1)) == w2.data());
}
@@ -9757,6 +9754,9 @@ class TouchMouseWidget : public QWidget {
public:
explicit TouchMouseWidget(QWidget *parent = 0)
: QWidget(parent),
+ m_touchBeginCount(0),
+ m_touchUpdateCount(0),
+ m_touchEndCount(0),
m_touchEventCount(0),
m_acceptTouch(false),
m_mouseEventCount(0),
@@ -9783,6 +9783,12 @@ protected:
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
+ if (e->type() == QEvent::TouchBegin)
+ ++m_touchBeginCount;
+ else if (e->type() == QEvent::TouchUpdate)
+ ++m_touchUpdateCount;
+ else if (e->type() == QEvent::TouchEnd)
+ ++m_touchEndCount;
++m_touchEventCount;
if (m_acceptTouch)
e->accept();
@@ -9807,6 +9813,9 @@ protected:
}
public:
+ int m_touchBeginCount;
+ int m_touchUpdateCount;
+ int m_touchEndCount;
int m_touchEventCount;
bool m_acceptTouch;
int m_mouseEventCount;
@@ -9923,6 +9932,46 @@ void tst_QWidget::touchEventSynthesizedMouseEvent()
}
}
+void tst_QWidget::touchUpdateOnNewTouch()
+{
+ QTouchDevice *device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+
+ TouchMouseWidget widget;
+ widget.setAcceptTouch(true);
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(new QWidget);
+ widget.setLayout(layout);
+ widget.show();
+
+ QWindow* window = widget.windowHandle();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QCOMPARE(widget.m_touchBeginCount, 0);
+ QCOMPARE(widget.m_touchUpdateCount, 0);
+ QCOMPARE(widget.m_touchEndCount, 0);
+ QTest::touchEvent(window, device).press(0, QPoint(20, 20), window);
+ QCOMPARE(widget.m_touchBeginCount, 1);
+ QCOMPARE(widget.m_touchUpdateCount, 0);
+ QCOMPARE(widget.m_touchEndCount, 0);
+ QTest::touchEvent(window, device).move(0, QPoint(25, 25), window);
+ QCOMPARE(widget.m_touchBeginCount, 1);
+ QCOMPARE(widget.m_touchUpdateCount, 1);
+ QCOMPARE(widget.m_touchEndCount, 0);
+ QTest::touchEvent(window, device).stationary(0).press(1, QPoint(40, 40), window);
+ QCOMPARE(widget.m_touchBeginCount, 1);
+ QCOMPARE(widget.m_touchUpdateCount, 2);
+ QCOMPARE(widget.m_touchEndCount, 0);
+ QTest::touchEvent(window, device).stationary(1).release(0, QPoint(25, 25), window);
+ QCOMPARE(widget.m_touchBeginCount, 1);
+ QCOMPARE(widget.m_touchUpdateCount, 3);
+ QCOMPARE(widget.m_touchEndCount, 0);
+ QTest::touchEvent(window, device).release(1, QPoint(40, 40), window);
+ QCOMPARE(widget.m_touchBeginCount, 1);
+ QCOMPARE(widget.m_touchUpdateCount, 3);
+ QCOMPARE(widget.m_touchEndCount, 1);
+}
+
void tst_QWidget::styleSheetPropagation()
{
QTableView tw;
diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index 9c549365ff..38b473e5ae 100644
--- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -90,6 +90,7 @@ private slots:
// void buttons();
void testDelete();
+ void testSignalEmissionAfterDelete_QTBUG_45835();
void testRemove();
void testMultipleAdd();
void testStandardButtonMapping_data();
@@ -111,6 +112,7 @@ private:
tst_QDialogButtonBox::tst_QDialogButtonBox()
{
+ qRegisterMetaType<QAbstractButton *>();
}
tst_QDialogButtonBox::~tst_QDialogButtonBox()
@@ -414,6 +416,70 @@ void tst_QDialogButtonBox::testDelete()
QCOMPARE(buttonBox.buttons().count(), 0);
}
+class ObjectDeleter : public QObject
+{
+ Q_OBJECT
+public slots:
+ void deleteButton(QAbstractButton *button)
+ {
+ delete button;
+ }
+
+ void deleteSender()
+ {
+ delete sender();
+ }
+};
+
+void tst_QDialogButtonBox::testSignalEmissionAfterDelete_QTBUG_45835()
+{
+ {
+ QDialogButtonBox buttonBox;
+ QCOMPARE(buttonBox.buttons().count(), 0);
+
+ QSignalSpy buttonClickedSpy(&buttonBox, &QDialogButtonBox::clicked);
+ QVERIFY(buttonClickedSpy.isValid());
+
+ QSignalSpy buttonBoxAcceptedSpy(&buttonBox, &QDialogButtonBox::accepted);
+ QVERIFY(buttonBoxAcceptedSpy.isValid());
+
+ QPushButton *button = buttonBox.addButton("Test", QDialogButtonBox::AcceptRole);
+ QCOMPARE(buttonBox.buttons().count(), 1);
+
+ ObjectDeleter objectDeleter;
+ connect(&buttonBox, &QDialogButtonBox::clicked, &objectDeleter, &ObjectDeleter::deleteButton);
+
+ button->click();
+
+ QCOMPARE(buttonBox.buttons().count(), 0);
+ QCOMPARE(buttonClickedSpy.count(), 1);
+ QCOMPARE(buttonBoxAcceptedSpy.count(), 1);
+ }
+
+ {
+ QPointer<QDialogButtonBox> buttonBox(new QDialogButtonBox);
+ QCOMPARE(buttonBox->buttons().count(), 0);
+
+ QSignalSpy buttonClickedSpy(buttonBox.data(), &QDialogButtonBox::clicked);
+ QVERIFY(buttonClickedSpy.isValid());
+
+ QSignalSpy buttonBoxAcceptedSpy(buttonBox.data(), &QDialogButtonBox::accepted);
+ QVERIFY(buttonBoxAcceptedSpy.isValid());
+
+ QPushButton *button = buttonBox->addButton("Test", QDialogButtonBox::AcceptRole);
+ QCOMPARE(buttonBox->buttons().count(), 1);
+
+ ObjectDeleter objectDeleter;
+ connect(buttonBox.data(), &QDialogButtonBox::clicked, &objectDeleter, &ObjectDeleter::deleteSender);
+
+ button->click();
+
+ QVERIFY(buttonBox.isNull());
+ QCOMPARE(buttonClickedSpy.count(), 1);
+ QCOMPARE(buttonBoxAcceptedSpy.count(), 0);
+ }
+}
+
void tst_QDialogButtonBox::testMultipleAdd()
{
// Add a button into the thing multiple times.
diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
index ade9f72543..2bbc2e05b7 100644
--- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp
@@ -764,6 +764,8 @@ void tst_QDockWidget::restoreDockWidget()
restoreWindow.show();
QVERIFY(QTest::qWaitForWindowExposed(&restoreWindow));
QTRY_VERIFY(dock->isFloating());
+ if (!QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive))
+ QSKIP("Skip due to Window manager positioning issues", Abort);
QTRY_COMPARE(dock->pos(), dockPos);
}
}
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 9417541040..adedc601a9 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -304,6 +304,7 @@ private slots:
void undoRedoAndEchoModes();
void clearButton();
+ void clearButtonVisibleAfterSettingText_QTBUG_45518();
void sideWidgets();
void shouldShowPlaceholderText_data();
@@ -4273,6 +4274,50 @@ void tst_QLineEdit::clearButton()
QVERIFY(!clearButton->isEnabled());
}
+void tst_QLineEdit::clearButtonVisibleAfterSettingText_QTBUG_45518()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("This test requires a developer build");
+#else
+ QLineEdit edit;
+ edit.setMinimumWidth(200);
+ centerOnScreen(&edit);
+ QLineEditIconButton *clearButton;
+ clearButton = edit.findChild<QLineEditIconButton *>();
+ QVERIFY(!clearButton);
+
+ edit.setText(QStringLiteral("some text"));
+ edit.show();
+ QVERIFY(QTest::qWaitForWindowActive(&edit));
+
+ QVERIFY(!edit.isClearButtonEnabled());
+
+ clearButton = edit.findChild<QLineEditIconButton *>();
+ QVERIFY(!clearButton);
+
+ edit.setClearButtonEnabled(true);
+ QVERIFY(edit.isClearButtonEnabled());
+
+ clearButton = edit.findChild<QLineEditIconButton *>();
+ QVERIFY(clearButton);
+ QVERIFY(clearButton->isVisible());
+
+ QTRY_VERIFY(clearButton->opacity() > 0);
+ QTRY_COMPARE(clearButton->cursor().shape(), Qt::ArrowCursor);
+
+ QTest::mouseClick(clearButton, Qt::LeftButton, 0, clearButton->rect().center());
+ QTRY_COMPARE(edit.text(), QString());
+
+ QTRY_COMPARE(clearButton->opacity(), qreal(0));
+ QTRY_COMPARE(clearButton->cursor().shape(), clearButton->parentWidget()->cursor().shape());
+
+ edit.setClearButtonEnabled(false);
+ QVERIFY(!edit.isClearButtonEnabled());
+ clearButton = edit.findChild<QLineEditIconButton *>();
+ QVERIFY(!clearButton);
+#endif // QT_BUILD_INTERNAL
+}
+
void tst_QLineEdit::sideWidgets()
{
QWidget testWidget;
diff --git a/tests/auto/widgets/widgets/qmenu/BLACKLIST b/tests/auto/widgets/widgets/qmenu/BLACKLIST
new file mode 100644
index 0000000000..de49d5ff45
--- /dev/null
+++ b/tests/auto/widgets/widgets/qmenu/BLACKLIST
@@ -0,0 +1,2 @@
+[task258920_mouseBorder]
+osx
diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
index 53ea4a9148..424ab2ceed 100644
--- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
@@ -2,3 +2,5 @@
ubuntu-14.04
[taskQTBUG4965_escapeEaten]
ubuntu-14.04
+[task256322_highlight]
+osx