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.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp39
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/BLACKLIST5
-rw-r--r--tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/BLACKLIST2
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp10
-rw-r--r--tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp34
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST6
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp16
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp78
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp14
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp12
-rw-r--r--tests/auto/widgets/itemviews/itemviews.pro4
-rw-r--r--tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp144
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp86
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp80
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp30
-rw-r--r--tests/auto/widgets/itemviews/qtableview/BLACKLIST2
-rw-r--r--tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp29
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp63
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp47
-rw-r--r--tests/auto/widgets/kernel/qaction/BLACKLIST2
-rw-r--r--tests/auto/widgets/kernel/qaction/tst_qaction.cpp6
-rw-r--r--tests/auto/widgets/kernel/qactiongroup/BLACKLIST2
-rw-r--r--tests/auto/widgets/kernel/qapplication/BLACKLIST2
-rw-r--r--tests/auto/widgets/kernel/qapplication/test/BLACKLIST2
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp2
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp4
-rw-r--r--tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp2
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp6
-rw-r--r--tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp2
-rw-r--r--tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp2
-rw-r--r--tests/auto/widgets/kernel/qtooltip/BLACKLIST4
-rw-r--r--tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwidget/BLACKLIST18
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp23
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/BLACKLIST4
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp10
-rw-r--r--tests/auto/widgets/styles/qstyle/tst_qstyle.cpp30
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST6
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp4
-rw-r--r--tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp19
-rw-r--r--tests/auto/widgets/widgets/qcombobox/BLACKLIST4
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp16
-rw-r--r--tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp44
-rw-r--r--tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp2
-rw-r--r--tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp97
-rw-r--r--tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp149
-rw-r--r--tests/auto/widgets/widgets/qmenubar/BLACKLIST4
-rw-r--r--tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp95
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/BLACKLIST13
-rw-r--r--tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp16
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp2
-rw-r--r--tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp2
-rw-r--r--tests/auto/widgets/widgets/qscrollbar/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets/qspinbox/BLACKLIST3
-rw-r--r--tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp59
-rw-r--r--tests/auto/widgets/widgets/qtabbar/BLACKLIST1
66 files changed, 1007 insertions, 382 deletions
diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
index d704d212dd..7e246b5366 100644
--- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
+++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp
@@ -243,7 +243,7 @@ void tst_QDialog::showMaximized()
dialog.showMaximized();
QVERIFY(dialog.isMaximized());
QVERIFY(dialog.isVisible());
-#if QT_CONFIG(sizegrip) && !defined(Q_OS_DARWIN) && !defined(Q_OS_IRIX) && !defined(Q_OS_HPUX)
+#if QT_CONFIG(sizegrip) && !defined(Q_OS_DARWIN) && !defined(Q_OS_HPUX)
QVERIFY(!sizeGrip->isVisible());
#endif
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 71efe1d59a..40a7d56432 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -102,6 +102,7 @@ private slots:
void mkdir();
void deleteFile();
+ void deleteDirectory();
void caseSensitivity();
@@ -884,6 +885,44 @@ void tst_QFileSystemModel::deleteFile()
QVERIFY(!newFile.exists());
}
+void tst_QFileSystemModel::deleteDirectory()
+{
+ // QTBUG-65683: Verify that directories can be removed recursively despite
+ // file system watchers being active on them or their sub-directories (Windows).
+ // Create a temporary directory, a nested directory and expand a treeview
+ // to show them to ensure watcher creation. Then delete the directory.
+ QTemporaryDir dirToBeDeleted(flatDirTestPath + QStringLiteral("/deleteDirectory-XXXXXX"));
+ QVERIFY(dirToBeDeleted.isValid());
+ const QString dirToBeDeletedPath = dirToBeDeleted.path();
+ const QString nestedTestDir = QStringLiteral("test");
+ QVERIFY(QDir(dirToBeDeletedPath).mkpath(nestedTestDir));
+ const QString nestedTestDirPath = dirToBeDeletedPath + QLatin1Char('/') + nestedTestDir;
+ QFile testFile(nestedTestDirPath + QStringLiteral("/test.txt"));
+ QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Text));
+ testFile.write("Hello\n");
+ testFile.close();
+
+ QFileSystemModel model;
+ const QModelIndex rootIndex = model.setRootPath(flatDirTestPath);
+ QTreeView treeView;
+ treeView.setWindowTitle(QTest::currentTestFunction());
+ treeView.setModel(&model);
+ treeView.setRootIndex(rootIndex);
+
+ const QModelIndex dirToBeDeletedPathIndex = model.index(dirToBeDeletedPath);
+ QVERIFY(dirToBeDeletedPathIndex.isValid());
+ treeView.setExpanded(dirToBeDeletedPathIndex, true);
+ const QModelIndex nestedTestDirIndex = model.index(nestedTestDirPath);
+ QVERIFY(nestedTestDirIndex.isValid());
+ treeView.setExpanded(nestedTestDirIndex, true);
+
+ treeView.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&treeView));
+
+ QVERIFY(model.remove(dirToBeDeletedPathIndex));
+ dirToBeDeleted.setAutoRemove(false);
+}
+
static QString flipCase(QString s)
{
for (int i = 0, size = s.size(); i < size; ++i) {
diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST
deleted file mode 100644
index 07f3a41df3..0000000000
--- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST
+++ /dev/null
@@ -1,5 +0,0 @@
-[task256466_wrongStyle]
-opensuse-13.1
-opensuse-42.1
-rhel-7.1
-rhel-7.2
diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
index 62286d703f..259de49c67 100644
--- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
+++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp
@@ -338,7 +338,7 @@ class SelfDestructParent : public QWidget
Q_OBJECT
public:
explicit SelfDestructParent(int delay = 100)
- : QWidget(Q_NULLPTR)
+ : QWidget(nullptr)
{
QTimer::singleShot(delay, this, SLOT(deleteLater()));
}
diff --git a/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
index 36e47830d0..da52809aad 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
+++ b/tests/auto/widgets/dialogs/qmessagebox/BLACKLIST
@@ -1,2 +1,2 @@
[defaultButton]
-osx ci
+*
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 6a16e48394..a5058f4b6c 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -134,10 +134,10 @@ class ExecCloseHelper : public QObject
public:
enum { CloseWindow = -1 };
- explicit ExecCloseHelper(QObject *parent = Q_NULLPTR)
- : QObject(parent), m_key(0), m_timerId(0), m_testCandidate(Q_NULLPTR) { }
+ explicit ExecCloseHelper(QObject *parent = nullptr)
+ : QObject(parent), m_key(0), m_timerId(0), m_testCandidate(nullptr) { }
- void start(int key, QWidget *testCandidate = Q_NULLPTR)
+ void start(int key, QWidget *testCandidate = nullptr)
{
m_key = key;
m_testCandidate = testCandidate;
@@ -147,7 +147,7 @@ public:
bool done() const { return !m_timerId; }
protected:
- void timerEvent(QTimerEvent *te) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *te) override;
private:
int m_key;
@@ -172,7 +172,7 @@ void ExecCloseHelper::timerEvent(QTimerEvent *te)
QKeyEvent *ke = new QKeyEvent(QEvent::KeyPress, m_key, Qt::NoModifier);
QCoreApplication::postEvent(m_testCandidate, ke);
}
- m_testCandidate = Q_NULLPTR;
+ m_testCandidate = nullptr;
killTimer(m_timerId);
m_timerId = m_key = 0;
}
diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
index 44b7894c53..00d640e55e 100644
--- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
+++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp
@@ -255,10 +255,10 @@ class QTestTranslator : public QTranslator
public:
explicit QTestTranslator(QString str) : m_str(qMove(str)) {}
- QString translate(const char *, const char *sourceText, const char *, int) const Q_DECL_OVERRIDE
+ QString translate(const char *, const char *sourceText, const char *, int) const override
{ return m_str + sourceText + m_str; }
- bool isEmpty() const Q_DECL_OVERRIDE { return false; }
+ bool isEmpty() const override { return false; }
};
template <typename Translator>
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST
deleted file mode 100644
index abfa7a3329..0000000000
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[ensureUpdateOnTextItem]
-osx-10.10
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 2220ef8d2f..26831002ce 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -1101,11 +1101,11 @@ void tst_QGraphicsItem::visible()
scene.addItem(item);
QVERIFY(item->isVisible());
- QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
+ QCOMPARE(scene.items(QPointF(0, 0)).value(0, nullptr), item);
item->setVisible(false);
QVERIFY(scene.items(QPointF(0, 0)).isEmpty());
item->setVisible(true);
- QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item);
+ QCOMPARE(scene.items(QPointF(0, 0)).value(0, nullptr), item);
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
event.setButton(Qt::LeftButton);
@@ -5494,16 +5494,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2()
QGraphicsScene scene;
scene.addItem(parent);
- QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
+ QCOMPARE(scene.items(QPointF(5, 5)).value(0, nullptr), (QGraphicsItem *)parent);
QVERIFY(scene.items(QPointF(15, 5)).isEmpty());
QVERIFY(scene.items(QPointF(5, 15)).isEmpty());
QVERIFY(scene.items(QPointF(60, 60)).isEmpty());
QVERIFY(scene.items(QPointF(140, 60)).isEmpty());
QVERIFY(scene.items(QPointF(60, 140)).isEmpty());
QVERIFY(scene.items(QPointF(140, 140)).isEmpty());
- QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2);
- QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
- QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)child2);
+ QCOMPARE(scene.items(QPointF(75, 100)).value(0, nullptr), (QGraphicsItem *)child1);
+ QCOMPARE(scene.items(QPointF(100, 75)).value(0, nullptr), (QGraphicsItem *)child1);
QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
image.fill(0);
@@ -5538,9 +5538,9 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3()
grandchild->setPos( 50, 50 );
parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
- QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent);
- QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
- QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(25, 25)).value(0, nullptr), (QGraphicsItem *)parent);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)child);
+ QCOMPARE(scene.items(QPointF(125, 125)).value(0, nullptr), (QGraphicsItem *)grandchild);
QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
// Move child to fully overlap the parent. The grandchild should
@@ -5548,9 +5548,9 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3()
child->prepareGeometryChange();
child->setPos( 0, 0 );
- QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child);
- QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
- QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(25, 25)).value(0, nullptr), (QGraphicsItem *)child);
+ QCOMPARE(scene.items(QPointF(75, 75)).value(0, nullptr), (QGraphicsItem *)grandchild);
+ QCOMPARE(scene.items(QPointF(125, 125)).value(0, nullptr), (QGraphicsItem *)grandchild);
QVERIFY(scene.items(QPointF(175, 175)).isEmpty());
}
@@ -5823,8 +5823,8 @@ void tst_QGraphicsItem::itemClippingDiscovery()
rightRectItem->setParentItem(clipItem);
// The rects item are both visible at these points.
- QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem);
- QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem);
+ QCOMPARE(scene.items(QPointF(10, 10)).value(0, nullptr), (QGraphicsItem *)leftRectItem);
+ QCOMPARE(scene.items(QPointF(90, 90)).value(0, nullptr), (QGraphicsItem *)rightRectItem);
// The ellipse clips the rects now.
clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape);
@@ -5864,7 +5864,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
// First test that both items are searched if no optimization flags are set
- QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
+ QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, nullptr);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -5875,7 +5875,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls;
// Repeat the test to make sure that no caching/indexing is in effect
- item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
+ item = scene.items(QPointF(25, 5)).value(0, nullptr);
QCOMPARE(item, childOutsideShape);
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
@@ -5888,7 +5888,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape()
// Set the optimization flag and make sure that the child is not returned
// and that the child's boundingRect() method is never called.
parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape);
- item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR);
+ item = scene.items(QPointF(25, 5)).value(0, nullptr);
QVERIFY(!(item));
QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls);
diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 0f5277710c..97f3eb4a60 100644
--- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -894,7 +894,7 @@ public:
: QProxyStyle(key),
horizontalSpacing(-1), verticalSpacing(-1) {}
- virtual int pixelMetric(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ virtual int pixelMetric(QStyle::PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (pm == QStyle::PM_LayoutHorizontalSpacing && horizontalSpacing >= 0) {
return horizontalSpacing;
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
deleted file mode 100644
index 16f3534921..0000000000
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST
+++ /dev/null
@@ -1,6 +0,0 @@
-[hoverEnterLeaveEvent]
-ubuntu-14.04
-rhel-7.1
-rhel-7.2
-[QTBUG_6986_sendMouseEventToAlienWidget]
-rhel-7.1
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 07d195b3e8..8287b9ebdd 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -1471,6 +1471,15 @@ protected:
}
};
+// ### work around missing QVector ctor from iterator pair:
+static QVector<QRect> rects(const QRegion &region)
+{
+ QVector<QRect> result;
+ for (QRect r : region)
+ result.push_back(r);
+ return result;
+}
+
void tst_QGraphicsProxyWidget::scrollUpdate()
{
ScrollWidget *widget = new ScrollWidget;
@@ -1492,10 +1501,10 @@ void tst_QGraphicsProxyWidget::scrollUpdate()
// QRect(0, 0, 200, 12) is the first update, expanded (-2, -2, 2, 2)
// QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2),
// intersected with the above update.
- QCOMPARE(view.paintEventRegion.rects(),
+ QCOMPARE(rects(view.paintEventRegion),
QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
QCOMPARE(widget->npaints, 2);
- QCOMPARE(widget->paintEventRegion.rects(),
+ QCOMPARE(rects(widget->paintEventRegion),
QVector<QRect>() << QRect(0, 0, 200, 12) << QRect(0, 12, 102, 10));
}
@@ -2661,9 +2670,6 @@ void tst_QGraphicsProxyWidget::childPos_data()
void tst_QGraphicsProxyWidget::childPos()
{
-#ifdef Q_OS_IRIX
- QSKIP("This test is not reliable on IRIX.");
-#endif
QFETCH(bool, moveCombo);
QFETCH(QPoint, comboPos);
QFETCH(QPointF, proxyPos);
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index bfdb540c2b..fe8571abf1 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -254,6 +254,7 @@ private slots:
void zeroScale();
void focusItemChangedSignal();
void minimumRenderSize();
+ void checkTouchPointsEllipseDiameters();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -295,7 +296,7 @@ void tst_QGraphicsScene::construction()
static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y)
{
- return scene.items(QPointF(x, y)).value(0, Q_NULLPTR);
+ return scene.items(QPointF(x, y)).value(0, nullptr);
}
void tst_QGraphicsScene::sceneRect()
@@ -4764,6 +4765,81 @@ void tst_QGraphicsScene::minimumRenderSize()
QVERIFY(smallChild->repaints > smallerGrandChild->repaints);
}
+class TouchItem : public QGraphicsRectItem
+{
+public:
+ TouchItem() : QGraphicsRectItem(QRectF(-10, -10, 20, 20)),
+ seenTouch(false)
+ {
+ setAcceptTouchEvents(true);
+ setFlag(QGraphicsItem::ItemIgnoresTransformations);
+ }
+ bool seenTouch;
+ QList<QTouchEvent::TouchPoint> touchPoints;
+protected:
+ bool sceneEvent(QEvent *event) override
+ {
+ switch (event->type()) {
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ seenTouch = true;
+ touchPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ event->accept();
+ return true;
+ default:
+ break;
+ }
+ return QGraphicsRectItem::sceneEvent(event);
+ }
+};
+
+void tst_QGraphicsScene::checkTouchPointsEllipseDiameters()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ scene.setSceneRect(1, 1, 198, 198);
+ view.scale(1.5, 1.5);
+ view.setFocus();
+ TouchItem *rect = new TouchItem;
+ scene.addItem(rect);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
+ const QSizeF ellipseDiameters(10.0, 10.0);
+ QTouchEvent::TouchPoint touchPoint(0);
+ touchPoint.setState(Qt::TouchPointPressed);
+ touchPoint.setPos(view.mapFromScene(rect->mapToScene(rect->boundingRect().center())));
+ touchPoint.setScreenPos(view.mapToGlobal(touchPoint.pos().toPoint()));
+ touchPoint.setEllipseDiameters(ellipseDiameters);
+
+ QList<QTouchEvent::TouchPoint> touchPoints = { touchPoint };
+
+ QTouchDevice *testDevice = QTest::createTouchDevice(QTouchDevice::TouchPad);
+ QTouchEvent touchEvent(QEvent::TouchBegin,
+ testDevice,
+ Qt::NoModifier,
+ Qt::TouchPointPressed,
+ touchPoints);
+ QApplication::sendEvent(view.viewport(), &touchEvent);
+ QVERIFY(rect->seenTouch);
+ QVERIFY(rect->touchPoints.size() == 1);
+ QCOMPARE(ellipseDiameters, rect->touchPoints.first().ellipseDiameters());
+
+ rect->seenTouch = false;
+ rect->touchPoints.clear();
+ QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
+ testDevice,
+ Qt::NoModifier,
+ Qt::TouchPointMoved,
+ touchPoints);
+ QApplication::sendEvent(view.viewport(), &touchEvent);
+ QVERIFY(rect->seenTouch);
+ QVERIFY(rect->touchPoints.size() == 1);
+ QCOMPARE(ellipseDiameters, rect->touchPoints.first().ellipseDiameters());
+}
+
void tst_QGraphicsScene::taskQTBUG_15977_renderWithDeviceCoordinateCache()
{
QGraphicsScene scene;
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
index 40d106e3ba..bc83dad714 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/BLACKLIST
@@ -14,3 +14,5 @@ xcb
xcb
[resizeAnchor]
xcb
+[update2]
+opensuse-42.3
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index f624bb6a5f..3d5df7506d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -2464,9 +2464,9 @@ void tst_QGraphicsView::viewportUpdateMode()
// The view gets two updates for the update scene updates.
QTRY_VERIFY(!view.lastUpdateRegions.isEmpty());
#ifndef Q_OS_MAC //cocoa doesn't support drawing regions
- QCOMPARE(view.lastUpdateRegions.last().rects().size(), 2);
- QCOMPARE(view.lastUpdateRegions.last().rects().at(0).size(), QSize(14, 14));
- QCOMPARE(view.lastUpdateRegions.last().rects().at(1).size(), QSize(14, 14));
+ QCOMPARE(view.lastUpdateRegions.last().rectCount(), 2);
+ QCOMPARE(view.lastUpdateRegions.last().begin()[0].size(), QSize(14, 14));
+ QCOMPARE(view.lastUpdateRegions.last().begin()[1].size(), QSize(14, 14));
#endif
// Set full update mode.
@@ -2481,8 +2481,8 @@ void tst_QGraphicsView::viewportUpdateMode()
qApp->processEvents();
// The view gets one full viewport update for the update scene updates.
- QCOMPARE(view.lastUpdateRegions.last().rects().size(), 1);
- QCOMPARE(view.lastUpdateRegions.last().rects().at(0).size(), view.viewport()->size());
+ QCOMPARE(view.lastUpdateRegions.last().rectCount(), 1);
+ QCOMPARE(view.lastUpdateRegions.last().begin()[0].size(), view.viewport()->size());
view.lastUpdateRegions.clear();
// Set smart update mode
@@ -2499,8 +2499,8 @@ void tst_QGraphicsView::viewportUpdateMode()
qApp->processEvents();
// The view gets one bounding rect update.
- QCOMPARE(view.lastUpdateRegions.last().rects().size(), 1);
- QCOMPARE(view.lastUpdateRegions.last().rects().at(0).size(), QSize(32, 32));
+ QCOMPARE(view.lastUpdateRegions.last().rectCount(), 1);
+ QCOMPARE(view.lastUpdateRegions.last().begin()[0].size(), QSize(32, 32));
// Set no update mode
view.setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
deleted file mode 100644
index 13ec840eff..0000000000
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST
+++ /dev/null
@@ -1,4 +0,0 @@
-[initialShow2]
-ubuntu-14.04
-rhel-7.1
-rhel-7.2
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 1be17b552e..85b42e54fe 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -2059,10 +2059,10 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails()
QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty());
widget->setGeometry(0, 112, 360, 528);
- QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, nullptr), (QGraphicsItem *)widget);
widget2->setGeometry(0, 573, 360, 67);
- QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget);
- QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2);
+ QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, nullptr), (QGraphicsItem *)widget);
+ QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, nullptr), (QGraphicsItem *)widget2);
}
void tst_QGraphicsWidget::defaultSize()
@@ -3461,12 +3461,12 @@ void tst_QGraphicsWidget::QTBUG_45867_send_itemChildAddedChange_to_parent()
{
}
- QRectF boundingRect() const Q_DECL_OVERRIDE { return QRectF(); }
+ QRectF boundingRect() const override { return QRectF(); }
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) Q_DECL_OVERRIDE {}
+ void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override {}
protected:
- QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE
+ QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) override
{
if (change == QGraphicsItem::ItemChildAddedChange)
++m_itemChildAddedChangeNotificationsCount;
diff --git a/tests/auto/widgets/itemviews/itemviews.pro b/tests/auto/widgets/itemviews/itemviews.pro
index af0b6aeef0..f2ee0e9124 100644
--- a/tests/auto/widgets/itemviews/itemviews.pro
+++ b/tests/auto/widgets/itemviews/itemviews.pro
@@ -20,7 +20,3 @@ SUBDIRS=\
!qtConfig(private_tests): SUBDIRS -= \
qcolumnview \
qlistwidget \
-
-# This test takes too long to run on IRIX, so skip it on that platform
-irix-*:SUBDIRS -= qitemview
-
diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
index 1ac66ed5cb..4723221293 100644
--- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp
@@ -77,7 +77,7 @@ public:
GeometriesTestView() : QTableView(), updateGeometriesCalled(false) {}
bool updateGeometriesCalled;
protected slots:
- void updateGeometries() Q_DECL_OVERRIDE { updateGeometriesCalled = true; QTableView::updateGeometries(); }
+ void updateGeometries() override { updateGeometriesCalled = true; QTableView::updateGeometries(); }
};
class tst_QAbstractItemView : public QObject
@@ -147,6 +147,10 @@ private slots:
void testClearModelInClickedSignal();
void inputMethodEnabled_data();
void inputMethodEnabled();
+ void currentFollowsIndexWidget_data();
+ void currentFollowsIndexWidget();
+ void checkFocusAfterActivationChanges_data();
+ void checkFocusAfterActivationChanges();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1555,7 +1559,7 @@ public:
QItemDelegate(parent)
{}
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE {
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override {
Q_UNUSED(index);
static bool w = true;
editor->setEnabled(w);
@@ -1999,7 +2003,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
{
}
- void setSelectionModel(QItemSelectionModel *model) Q_DECL_OVERRIDE
+ void setSelectionModel(QItemSelectionModel *model) override
{
m_deselectedMustBeEmpty = !selectionModel() || !model || selectionModel()->model() != model->model();
QListView::setSelectionModel(model);
@@ -2009,7 +2013,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
bool selectionChangedOk() const { return m_selectionChangedOk; }
protected:
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE
+ bool viewportEvent(QEvent *event) override
{
if (event->type() == QEvent::Paint)
++m_paintEventsCount;
@@ -2017,7 +2021,7 @@ void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model()
}
void selectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected) Q_DECL_OVERRIDE
+ const QItemSelection &deselected) override
{
if (m_deselectedMustBeEmpty && !deselected.isEmpty())
m_selectionChangedOk = false;
@@ -2140,7 +2144,7 @@ signals:
void setSelectionCalled(const QRect &rect);
protected:
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) Q_DECL_OVERRIDE
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) override
{
emit setSelectionCalled(rect);
QListView::setSelection(rect, flags);
@@ -2390,5 +2394,133 @@ void tst_QAbstractItemView::inputMethodEnabled()
QCOMPARE(view->testAttribute(Qt::WA_InputMethodEnabled), result);
}
+void tst_QAbstractItemView::currentFollowsIndexWidget_data()
+{
+ QTest::addColumn<QByteArray>("viewType");
+
+ QList<QByteArray> widgets;
+ widgets << "QListView" << "QTreeView" << "QTableView";
+ for (const QByteArray &widget : qAsConst(widgets))
+ QTest::newRow(widget) << widget;
+}
+
+void tst_QAbstractItemView::currentFollowsIndexWidget()
+{
+ QFETCH(QByteArray, viewType);
+
+ QScopedPointer<QAbstractItemView> view;
+ if (viewType == "QListView")
+ view.reset(new QListView());
+ else if (viewType == "QTableView")
+ view.reset(new QTableView());
+ else if (viewType == "QTreeView")
+ view.reset(new QTreeView());
+ else
+ QVERIFY(0);
+
+ centerOnScreen(view.data());
+ view->show();
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
+
+ QStandardItemModel *model = new QStandardItemModel(view.data());
+ QStandardItem *item1 = new QStandardItem("first item");
+ item1->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ model->appendRow(item1);
+
+ QStandardItem *item2 = new QStandardItem("test item");
+ item2->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+ model->appendRow(item2);
+
+ view->setModel(model);
+ QLineEdit *lineEdit1 = new QLineEdit;
+ QLineEdit *lineEdit2 = new QLineEdit;
+ view->setIndexWidget(item1->index(), lineEdit1);
+ view->setIndexWidget(item2->index(), lineEdit2);
+
+ lineEdit2->setFocus();
+ QTRY_VERIFY(lineEdit2->hasFocus());
+ QCOMPARE(view->currentIndex(), item2->index());
+ lineEdit1->setFocus();
+ QTRY_VERIFY(lineEdit1->hasFocus());
+ QCOMPARE(view->currentIndex(), item1->index());
+}
+
+class EditorItemDelegate : public QItemDelegate
+{
+public:
+ EditorItemDelegate() : QItemDelegate(), openedEditor(nullptr) { }
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &,
+ const QModelIndex &) const override
+ {
+ openedEditor = new QLineEdit(parent);
+ return openedEditor;
+ }
+ mutable QPointer<QWidget> openedEditor;
+};
+
+// Testing the case reported in QTBUG-62253.
+// When an itemview with an editor that has focus loses focus
+// due to a change in the active window then we need to check
+// that the itemview gets focus once the activation is back
+// on the original window.
+void tst_QAbstractItemView::checkFocusAfterActivationChanges_data()
+{
+ QTest::addColumn<QString>("viewType");
+
+ QTest::newRow("QListView") << "QListView";
+ QTest::newRow("QTableView") << "QTableView";
+ QTest::newRow("QTreeView") << "QTreeView";
+}
+
+void tst_QAbstractItemView::checkFocusAfterActivationChanges()
+{
+ QFETCH(QString, viewType);
+
+ const QRect availableGeo = qApp->primaryScreen()->availableGeometry();
+ const int halfWidth = availableGeo.width() / 2;
+ QWidget otherTopLevel;
+ otherTopLevel.setGeometry(availableGeo.x(), availableGeo.y(),
+ halfWidth, availableGeo.height());
+ otherTopLevel.show();
+
+ QWidget w;
+ w.setGeometry(availableGeo.x() + halfWidth, availableGeo.y(),
+ halfWidth, availableGeo.height());
+ QLineEdit *le = new QLineEdit(&w);
+ QAbstractItemView *view = 0;
+ if (viewType == "QListView")
+ view = new QListView(&w);
+ else if (viewType == "QTableView")
+ view = new QTableView(&w);
+ else if (viewType == "QTreeView")
+ view = new QTreeView(&w);
+
+ QStandardItemModel model(5, 5);
+ view->setModel(&model);
+ view->move(0, 50);
+ EditorItemDelegate delegate;
+ view->setItemDelegate(&delegate);
+ w.show();
+
+ QTest::qWaitForWindowActive(&w);
+ QVERIFY(le->hasFocus());
+
+ view->setFocus();
+ QVERIFY(view->hasFocus());
+
+ view->edit(model.index(0,0));
+ QVERIFY(QTest::qWaitForWindowExposed(delegate.openedEditor));
+ QVERIFY(delegate.openedEditor->hasFocus());
+
+ QApplication::setActiveWindow(&otherTopLevel);
+ QTest::qWaitForWindowActive(&otherTopLevel);
+ otherTopLevel.setFocus();
+ QVERIFY(!delegate.openedEditor);
+
+ QApplication::setActiveWindow(&w);
+ QTest::qWaitForWindowActive(&w);
+ QVERIFY(view->hasFocus());
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
index 6dae2cf8e4..3594e7fa01 100644
--- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp
@@ -239,13 +239,15 @@ private slots:
void testStreamWithHide();
void testStylePosition();
void stretchAndRestoreLastSection();
-
+ void testMinMaxSectionSizeStretched();
+ void testMinMaxSectionSizeNotStretched();
void sizeHintCrash();
protected:
void setupTestData(bool use_reset_model = false);
void additionalInit();
void calculateAndCheck(int cppline, const int precalced_comparedata[]);
+ void testMinMaxSectionSize(bool stretchLastSection);
QWidget *topLevel;
QHeaderView *view;
@@ -402,6 +404,7 @@ void tst_QHeaderView::init()
QCOMPARE(view->length(), 0);
QCOMPARE(view->sizeHint(), QSize(0,0));
QCOMPARE(view->sectionSizeHint(0), -1);
+ view->setMinimumSectionSize(0); // system default min size can be to large
/*
model = new QStandardItemModel(1, 1);
@@ -514,6 +517,12 @@ void tst_QHeaderView::movable()
QCOMPARE(view->sectionsMovable(), false);
view->setSectionsMovable(true);
QCOMPARE(view->sectionsMovable(), true);
+
+ QCOMPARE(view->firstSectionMovable(), true);
+ view->setFirstSectionMovable(false);
+ QCOMPARE(view->firstSectionMovable(), false);
+ view->setFirstSectionMovable(true);
+ QCOMPARE(view->firstSectionMovable(), true);
}
void tst_QHeaderView::clickable()
@@ -1598,6 +1607,7 @@ static QByteArray savedState()
QStandardItemModel m(4, 4);
QHeaderView h1(Qt::Horizontal);
h1.setModel(&m);
+ h1.setMinimumSectionSize(0); // system default min size can be to large
h1.swapSections(0, 2);
h1.resizeSection(1, 10);
h1.setSortIndicatorShown(true);
@@ -1800,7 +1810,7 @@ class TestHeaderViewStyle : public QProxyStyle
{
public:
TestHeaderViewStyle() : horizontalSectionSize(100) {}
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (metric == QStyle::PM_HeaderDefaultSectionSizeHorizontal)
return horizontalSectionSize;
@@ -2188,6 +2198,7 @@ void tst_QHeaderView::task248050_hideRow()
//this is the sequence of events that make the task fail
protected_QHeaderView header(Qt::Vertical);
QStandardItemModel model(0, 1);
+ header.setMinimumSectionSize(0); // system default min size can be to large
header.setStretchLastSection(false);
header.setDefaultSectionSize(17);
header.setModel(&model);
@@ -3181,5 +3192,76 @@ void tst_QHeaderView::stretchAndRestoreLastSection()
QCOMPARE(header.sectionSize(9), someOtherSectionSize);
}
+void tst_QHeaderView::testMinMaxSectionSizeStretched()
+{
+ testMinMaxSectionSize(true);
+}
+
+void tst_QHeaderView::testMinMaxSectionSizeNotStretched()
+{
+ testMinMaxSectionSize(false);
+}
+
+static void waitFor(const std::function<bool()> &func)
+{
+ for (int i = 0; i < 100; i++)
+ {
+ if (func())
+ return;
+ QTest::qWait(10);
+ }
+}
+
+void tst_QHeaderView::testMinMaxSectionSize(bool stretchLastSection)
+{
+ QStandardItemModel m(5, 5);
+ QTableView tv;
+ tv.setModel(&m);
+ tv.show();
+
+ const int sectionSizeMin = 20;
+ const int sectionSizeMax = 40;
+ const int defaultSectionSize = 30;
+
+ QVERIFY(QTest::qWaitForWindowExposed(&tv));
+
+ QHeaderView &header = *tv.horizontalHeader();
+ header.setMinimumSectionSize(sectionSizeMin);
+ header.setMaximumSectionSize(sectionSizeMax);
+ header.setDefaultSectionSize(defaultSectionSize);
+ header.setStretchLastSection(stretchLastSection);
+
+ // check defaults
+ QCOMPARE(header.sectionSize(0), defaultSectionSize);
+ QCOMPARE(header.sectionSize(3), defaultSectionSize);
+
+ // do not go above maxSectionSize
+ header.resizeSection(0, sectionSizeMax + 1);
+ QCOMPARE(header.sectionSize(0), sectionSizeMax);
+
+ // do not go below minSectionSize
+ header.resizeSection(0, sectionSizeMin - 1);
+ QCOMPARE(header.sectionSize(0), sectionSizeMin);
+
+ // change section size on max change
+ header.setMinimumSectionSize(sectionSizeMin);
+ header.setMaximumSectionSize(sectionSizeMax);
+ header.resizeSection(0, sectionSizeMax);
+ QCOMPARE(header.sectionSize(0), sectionSizeMax);
+ header.setMaximumSectionSize(defaultSectionSize);
+ waitFor([this, &header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; });
+ QCOMPARE(header.sectionSize(0), defaultSectionSize);
+
+ // change section size on min change
+ header.setMinimumSectionSize(sectionSizeMin);
+ header.setMaximumSectionSize(sectionSizeMax);
+ header.resizeSection(0, sectionSizeMin);
+ QCOMPARE(header.sectionSize(0), sectionSizeMin);
+ header.setMinimumSectionSize(defaultSectionSize);
+ waitFor([this, &header, defaultSectionSize]() { return header.sectionSize(0) == defaultSectionSize; });
+ QCOMPARE(header.sectionSize(0), defaultSectionSize);
+}
+
+
QTEST_MAIN(tst_QHeaderView)
#include "tst_qheaderview.moc"
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 2a5895583d..2fed2e0c69 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -220,6 +220,20 @@ private slots:
void QTBUG4435_keepSelectionOnCheck();
void QTBUG16469_textForRole();
+ void dateTextForRole_data();
+ void dateTextForRole();
+
+#ifdef QT_BUILD_INTERNAL
+private:
+ struct RoleDelegate : public QItemDelegate
+ {
+ QString textForRole(Qt::ItemDataRole role, const QVariant &value, const QLocale &locale)
+ {
+ QAbstractItemDelegatePrivate *d = reinterpret_cast<QAbstractItemDelegatePrivate *>(qGetPtrHelper(d_ptr));
+ return d->textForRole(role, value, locale);
+ }
+ };
+#endif
};
@@ -474,7 +488,7 @@ void tst_QItemDelegate::doLayout_data()
<< QRect(0, 0, 50, 50)
<< QRect(0, 0, 1000, 1000)
<< QRect(0, 0, 400, 400)
- << QRect(m, 0, 50 + 2*m, 1000)
+ << QRect(0, 0, 50 + 2*m, 1000)
<< QRect(50 + 2*m, 0, 1000 + 2*m, 1000 + m)
<< QRect(50 + 2*m, 1000 + m, 1000 + 2*m, 400);
/*
@@ -510,7 +524,7 @@ void tst_QItemDelegate::doLayout_data()
<< QRect(0, 0, 50, 50)
<< QRect(0, 0, 1000, 1000)
<< QRect(0, 0, 400, 400)
- << QRect(m, 0, 50 + 2 * m, 1000)
+ << QRect(0, 0, 50 + 2 * m, 1000)
<< QRect(50 + 2 * m, 400 + m, 1000 + 2 * m, 1000)
<< QRect(50 + 2 * m, 0, 1000 + 2 * m, 400 + m);
@@ -534,7 +548,7 @@ void tst_QItemDelegate::doLayout_data()
<< QRect(0, 0, 50, 50)
<< QRect(0, 0, 1000, 1000)
<< QRect(0, 0, 400, 400)
- << QRect(m, 0, 50 + 2 * m, 1000)
+ << QRect(0, 0, 50 + 2 * m, 1000)
<< QRect(50 + 2 * m, 0, 1000 + 2 * m, 1000)
<< QRect(1050 + 4 * m, 0, 400 + 2 * m, 1000);
@@ -558,7 +572,7 @@ void tst_QItemDelegate::doLayout_data()
<< QRect(0, 0, 50, 50)
<< QRect(0, 0, 1000, 1000)
<< QRect(0, 0, 400, 400)
- << QRect(m, 0, 50 + 2 * m, 1000)
+ << QRect(0, 0, 50 + 2 * m, 1000)
<< QRect(450 + 4 * m, 0, 1000 + 2 * m, 1000)
<< QRect(50 + 2 * m, 0, 400 + 2 * m, 1000);
@@ -1530,14 +1544,7 @@ void tst_QItemDelegate::QTBUG16469_textForRole()
#ifndef QT_BUILD_INTERNAL
QSKIP("This test requires a developer build");
#else
- struct TestDelegate : public QItemDelegate
- {
- QString textForRole(Qt::ItemDataRole role, const QVariant &value, const QLocale &locale)
- {
- QAbstractItemDelegatePrivate *d = reinterpret_cast<QAbstractItemDelegatePrivate *>(qGetPtrHelper(d_ptr));
- return d->textForRole(role, value, locale);
- }
- } delegate;
+ RoleDelegate delegate;
QLocale locale;
const float f = 123.456f;
@@ -1559,20 +1566,6 @@ void tst_QItemDelegate::QTBUG16469_textForRole()
QCOMPARE(delegate.textForRole(Qt::DisplayRole, ull, locale), locale.toString(ull));
QCOMPARE(delegate.textForRole(Qt::ToolTipRole, ull, locale), locale.toString(ull));
- const QDateTime dateTime = QDateTime::currentDateTime();
- const QDate date = dateTime.date();
- const QTime time = dateTime.time();
- const QString shortDate = locale.toString(date, QLocale::ShortFormat);
- const QString longDate = locale.toString(date, QLocale::LongFormat);
- const QString shortTime = locale.toString(time, QLocale::ShortFormat);
- const QString longTime = locale.toString(time, QLocale::LongFormat);
- QCOMPARE(delegate.textForRole(Qt::DisplayRole, date, locale), shortDate);
- QCOMPARE(delegate.textForRole(Qt::ToolTipRole, date, locale), longDate);
- QCOMPARE(delegate.textForRole(Qt::DisplayRole, time, locale), shortTime);
- QCOMPARE(delegate.textForRole(Qt::ToolTipRole, time, locale), longTime);
- QCOMPARE(delegate.textForRole(Qt::DisplayRole, dateTime, locale), shortDate + QLatin1Char(' ') + shortTime);
- QCOMPARE(delegate.textForRole(Qt::ToolTipRole, dateTime, locale), longDate + QLatin1Char(' ') + longTime);
-
const QString text("text");
QCOMPARE(delegate.textForRole(Qt::DisplayRole, text, locale), text);
QCOMPARE(delegate.textForRole(Qt::ToolTipRole, text, locale), text);
@@ -1584,6 +1577,41 @@ void tst_QItemDelegate::QTBUG16469_textForRole()
#endif
}
+void tst_QItemDelegate::dateTextForRole_data()
+{
+#ifdef QT_BUILD_INTERNAL
+ QTest::addColumn<QDateTime>("when");
+
+ QTest::newRow("now") << QDateTime::currentDateTime(); // It's a local time
+ QDate date(2013, 12, 11);
+ QTime time(10, 9, 8, 765);
+ // Ensure we exercise every time-spec variant:
+ QTest::newRow("local") << QDateTime(date, time, Qt::LocalTime);
+ QTest::newRow("UTC") << QDateTime(date, time, Qt::UTC);
+ QTest::newRow("zone") << QDateTime(date, time, QTimeZone("Europe/Dublin"));
+ QTest::newRow("offset") << QDateTime(date, time, Qt::OffsetFromUTC, 36000);
+#endif
+}
+
+void tst_QItemDelegate::dateTextForRole()
+{
+#ifndef QT_BUILD_INTERNAL
+ QSKIP("This test requires a developer build");
+#else
+ QFETCH(QDateTime, when);
+ RoleDelegate delegate;
+ QLocale locale;
+# define CHECK(value) \
+ QCOMPARE(delegate.textForRole(Qt::DisplayRole, value, locale), locale.toString(value, QLocale::ShortFormat)); \
+ QCOMPARE(delegate.textForRole(Qt::ToolTipRole, value, locale), locale.toString(value, QLocale::LongFormat))
+
+ CHECK(when);
+ CHECK(when.date());
+ CHECK(when.time());
+# undef CHECK
+#endif
+}
+
// ### _not_ covered:
// editing with a custom editor factory
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index 5e0d99f25e..1d8286b3cf 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -282,7 +282,7 @@ public:
class ScrollPerItemListView : public QListView
{
public:
- explicit ScrollPerItemListView(QWidget *parent = Q_NULLPTR)
+ explicit ScrollPerItemListView(QWidget *parent = nullptr)
: QListView(parent)
{
// Force per item scroll mode since it comes from the style by default
diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
index d4cb54b9ff..f7332a15f5 100644
--- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
+++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp
@@ -1381,20 +1381,38 @@ void tst_QListWidget::changeDataWithSorting_data()
<< false;
}
+class QListWidgetDataChanged : public QListWidget
+{
+ Q_OBJECT
+public:
+ using QListWidget::QListWidget;
+
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) override
+ {
+ QListWidget::dataChanged(topLeft, bottomRight, roles);
+ currentRoles = roles;
+ }
+ QVector<int> currentRoles;
+};
+
void tst_QListWidget::itemData()
{
- QListWidget widget;
+ QListWidgetDataChanged widget;
QListWidgetItem item(&widget);
item.setFlags(item.flags() | Qt::ItemIsEditable);
item.setData(Qt::DisplayRole, QString("0"));
+ QCOMPARE(widget.currentRoles, QVector<int>({Qt::DisplayRole, Qt::EditRole}));
item.setData(Qt::CheckStateRole, Qt::PartiallyChecked);
- item.setData(Qt::UserRole + 0, QString("1"));
- item.setData(Qt::UserRole + 1, QString("2"));
- item.setData(Qt::UserRole + 2, QString("3"));
- item.setData(Qt::UserRole + 3, QString("4"));
+ QCOMPARE(widget.currentRoles, {Qt::CheckStateRole});
+ for (int i = 0; i < 4; ++i)
+ {
+ item.setData(Qt::UserRole + i, QString::number(i + 1));
+ QCOMPARE(widget.currentRoles, {Qt::UserRole + i});
+ }
QMap<int, QVariant> flags = widget.model()->itemData(widget.model()->index(0, 0));
QCOMPARE(flags.count(), 6);
- QCOMPARE(flags[Qt::UserRole + 0].toString(), QString("1"));
+ for (int i = 0; i < 4; ++i)
+ QCOMPARE(flags[Qt::UserRole + i].toString(), QString::number(i + 1));
}
void tst_QListWidget::changeDataWithSorting()
diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
index 329010a86e..fc231a4e30 100644
--- a/tests/auto/widgets/itemviews/qtableview/BLACKLIST
+++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
@@ -1,4 +1,2 @@
[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 4e401ddd86..06c80bf8d2 100644
--- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
+++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
@@ -426,6 +426,9 @@ public:
this, SLOT(slotCurrentChanged(QModelIndex,QModelIndex)));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(itemSelectionChanged(QItemSelection,QItemSelection)));
+ // Allow small sections in this test, since this test was made before we correctly enforced minimum sizes.
+ horizontalHeader()->setMinimumSectionSize(0);
+ verticalHeader()->setMinimumSectionSize(0);
}
// enum CursorAction and moveCursor() are protected in QTableView.
@@ -738,6 +741,8 @@ void tst_QTableView::headerSections()
QHeaderView *vheader = view.verticalHeader();
view.setModel(&model);
+ hheader->setMinimumSectionSize(columnWidth);
+ vheader->setMinimumSectionSize(rowHeight);
view.show();
hheader->doItemsLayout();
@@ -1147,6 +1152,9 @@ void tst_QTableView::moveCursor()
QtTestTableView view;
view.setModel(&model);
+ // we have to make sure that PgUp/PgDown can scroll to the bottom/top
+ view.resize(view.horizontalHeader()->length() + 50,
+ view.verticalHeader()->length() + 50);
view.hideRow(hideRow);
view.hideColumn(hideColumn);
if (moveColumn.first != moveColumn.second)
@@ -2085,6 +2093,8 @@ void tst_QTableView::visualRect()
QTableView view;
view.setModel(&model);
+ view.horizontalHeader()->setMinimumSectionSize(0);
+ view.verticalHeader()->setMinimumSectionSize(0);
// Make sure that it has 1 pixel between each cell.
view.setGridStyle(Qt::SolidLine);
for (int i = 0; i < view.verticalHeader()->count(); ++i)
@@ -3533,6 +3543,9 @@ void tst_QTableView::editSpanFromDirections()
TableViewWithCursorExposed view;
view.setModel(model.data());
+ // we have to make sure that PgUp/PgDown can scroll to the bottom/top
+ view.resize(view.horizontalHeader()->length() + 50,
+ view.verticalHeader()->length() + 50);
view.setSpan(row, column, rowSpan, columnSpan);
view.show();
QVERIFY(QTest::qWaitForWindowActive(&view));
@@ -3978,7 +3991,7 @@ void tst_QTableView::mouseWheel_data()
<< 10 + qApp->wheelScrollLines() << 10 + qApp->wheelScrollLines();
QTest::newRow("scroll down per pixel")
<< int(QAbstractItemView::ScrollPerPixel) << -120
- << 10 + qApp->wheelScrollLines() * 89 << 10 + qApp->wheelScrollLines() * 28;
+ << 10 + qApp->wheelScrollLines() * 91 << 10 + qApp->wheelScrollLines() * 46;
}
void tst_QTableView::mouseWheel()
@@ -3992,16 +4005,17 @@ void tst_QTableView::mouseWheel()
QWidget topLevel;
QtTestTableView view(&topLevel);
view.resize(500, 500);
- for (int r = 0; r < 100; ++r)
- view.setRowHeight(r, 50);
- for (int c = 0; c < 100; ++c)
- view.setColumnWidth(c, 100);
topLevel.show();
QVERIFY(QTest::qWaitForWindowExposed(&topLevel));
view.setModel(&model);
+ for (int r = 0; r < 100; ++r)
+ view.setRowHeight(r, 50);
+ for (int c = 0; c < 100; ++c)
+ view.setColumnWidth(c, 100);
+
view.setHorizontalScrollMode((QAbstractItemView::ScrollMode)scrollMode);
view.setVerticalScrollMode((QAbstractItemView::ScrollMode)scrollMode);
view.horizontalScrollBar()->setValue(10);
@@ -4270,7 +4284,7 @@ void tst_QTableView::changeHeaderData()
QVERIFY(QTest::qWaitForWindowExposed(&view));
QString text = "long long long text";
- const int textWidth = view.verticalHeader()->fontMetrics().width(text);
+ const int textWidth = view.verticalHeader()->fontMetrics().horizontalAdvance(text);
QVERIFY(view.verticalHeader()->width() < textWidth);
model.setHeaderData(2, Qt::Vertical, text);
@@ -4364,7 +4378,8 @@ void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection()
QItemSelection selection;
selection << range;
QRegion region = view.visualRegionForSelection(selection);
- QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight()));
+ QVERIFY(!region.isEmpty());
+ QCOMPARE(region.begin()[0], view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight()));
}
void tst_QTableView::taskQTBUG_8777_scrollToSpans()
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index b2e1a2d9b5..5293ba487a 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -165,6 +165,7 @@ private slots:
void statusTip_data();
void statusTip();
+ void fetchMoreOnScroll();
// task-specific tests:
void task174627_moveLeftToRoot();
@@ -311,6 +312,12 @@ public:
return QVariant();
}
+ void simulateMoveRows()
+ {
+ beginMoveRows(QModelIndex(), 0, 0, QModelIndex(), 2);
+ endMoveRows();
+ }
+
void removeLastRow()
{
beginRemoveRows(QModelIndex(), rows - 1, rows - 1);
@@ -1326,6 +1333,17 @@ void tst_QTreeView::columnHidden()
for (int c = 0; c < model.columnCount(); ++c)
QCOMPARE(view.isColumnHidden(c), true);
view.update();
+
+ // QTBUG 54610
+ // QAbstractItemViewPrivate::_q_layoutChanged() is called on
+ // rows/columnMoved and because this function is virtual,
+ // QHeaderViewPrivate::_q_layoutChanged() was called and unhided
+ // all sections because QHeaderViewPrivate::_q_layoutAboutToBeChanged()
+ // could not fill persistentHiddenSections (and is not needed)
+ view.hideColumn(model.cols - 1);
+ QCOMPARE(view.isColumnHidden(model.cols - 1), true);
+ model.simulateMoveRows();
+ QCOMPARE(view.isColumnHidden(model.cols - 1), true);
}
void tst_QTreeView::rowHidden()
@@ -2607,7 +2625,7 @@ class TestTreeViewStyle : public QProxyStyle
{
public:
TestTreeViewStyle() : indentation(20) {}
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (metric == QStyle::PM_TreeViewIndentation)
return indentation;
@@ -4565,6 +4583,49 @@ void tst_QTreeView::statusTip()
QTRY_COMPARE(mw.statusBar()->currentMessage(), QLatin1String("Header 0 -- Status"));
}
+class FetchMoreModel : public QStandardItemModel
+{
+public:
+ FetchMoreModel() : QStandardItemModel(), canFetchReady(false)
+ {
+ for (int i = 0; i < 20; ++i) {
+ QStandardItem *item = new QStandardItem("Row");
+ item->appendRow(new QStandardItem("Child"));
+ appendRow(item);
+ }
+ }
+ bool canFetchMore(const QModelIndex &parent) const override
+ {
+ if (!canFetchReady || !parent.isValid())
+ return false;
+ if (!parent.parent().isValid())
+ return rowCount(parent) < 20;
+ return false;
+ }
+ void fetchMore(const QModelIndex &parent) override
+ {
+ QStandardItem *item = itemFromIndex(parent);
+ for (int i = 0; i < 19; ++i)
+ item->appendRow(new QStandardItem(QString("New Child %1").arg(i)));
+ }
+ bool canFetchReady;
+};
+
+void tst_QTreeView::fetchMoreOnScroll()
+{
+ QTreeView tw;
+ FetchMoreModel im;
+ tw.setModel(&im);
+ tw.show();
+ tw.expandAll();
+ QVERIFY(QTest::qWaitForWindowActive(&tw));
+ // Now we can allow the fetch to happen
+ im.canFetchReady = true;
+ tw.verticalScrollBar()->setValue(tw.verticalScrollBar()->maximum());
+ // The item should have now fetched the other children, thus bringing the count to 20
+ QCOMPARE(im.item(19)->rowCount(), 20);
+}
+
static void fillModeltaskQTBUG_8376(QAbstractItemModel &model)
{
model.insertRow(0);
diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
index fa7f9596da..d0e6407283 100644
--- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp
@@ -159,6 +159,7 @@ private slots:
void taskQTBUG_34717_collapseAtBottom();
void task20345_sortChildren();
void getMimeDataWithInvalidItem();
+ void testVisualItemRect();
public slots:
void itemSelectionChanged();
@@ -332,10 +333,19 @@ void tst_QTreeWidget::addTopLevelItem()
for (int i = 0; i < 10; ++i)
tops << new TreeItem();
int count = tree.topLevelItemCount();
- tree.insertTopLevelItems(100000, tops);
- // ### fixme
+ tree.insertTopLevelItems(count, tops);
QCOMPARE(tree.topLevelItemCount(), count + 10);
}
+
+ // invalid insert
+ {
+ tops.clear();
+ for (int i = 0; i < 10; ++i)
+ tops << new TreeItem();
+ int count = tree.topLevelItemCount();
+ tree.insertTopLevelItems(100000, tops); // should be a no-op
+ QCOMPARE(tree.topLevelItemCount(), count);
+ }
}
void tst_QTreeWidget::currentItem_data()
@@ -3269,7 +3279,7 @@ void tst_QTreeWidget::task239150_editorWidth()
QVERIFY(tree.itemWidget(&item, 0) == 0);
tree.editItem(&item);
QVERIFY(tree.itemWidget(&item, 0));
- QVERIFY(tree.itemWidget(&item, 0)->width() >= minWidth + tree.fontMetrics().width(item.text(0)));
+ QVERIFY(tree.itemWidget(&item, 0)->width() >= minWidth + tree.fontMetrics().horizontalAdvance(item.text(0)));
}
}
@@ -3449,9 +3459,38 @@ void tst_QTreeWidget::getMimeDataWithInvalidItem()
{
CustomTreeWidget w;
QTest::ignoreMessage(QtWarningMsg, "QTreeWidget::mimeData: Null-item passed");
- QMimeData *md = w.mimeData(QList<QTreeWidgetItem*>() << Q_NULLPTR);
+ QMimeData *md = w.mimeData(QList<QTreeWidgetItem*>() << nullptr);
QVERIFY(!md);
}
+// visualItemRect returned a wrong rect when the columns were moved
+// (-> logical index != visual index). see QTBUG-28733
+void tst_QTreeWidget::testVisualItemRect()
+{
+ QTreeWidget tw;
+ tw.setColumnCount(2);
+ QTreeWidgetItem *item = new QTreeWidgetItem(&tw);
+ item->setText(0, "text 0");
+ item->setText(1, "text 1");
+
+ static const int sectionSize = 30;
+ tw.header()->setStretchLastSection(false);
+ tw.header()->setMinimumSectionSize(sectionSize);
+ tw.header()->resizeSection(0, sectionSize);
+ tw.header()->resizeSection(1, sectionSize);
+ tw.setRootIsDecorated(false);
+ tw.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&tw));
+
+ QRect r = tw.visualItemRect(item);
+ QCOMPARE(r.width(), sectionSize * 2); // 2 columns
+ tw.header()->moveSection(1, 0);
+ r = tw.visualItemRect(item);
+ QCOMPARE(r.width(), sectionSize * 2); // 2 columns
+ tw.hideColumn(0);
+ r = tw.visualItemRect(item);
+ QCOMPARE(r.width(), sectionSize);
+}
+
QTEST_MAIN(tst_QTreeWidget)
#include "tst_qtreewidget.moc"
diff --git a/tests/auto/widgets/kernel/qaction/BLACKLIST b/tests/auto/widgets/kernel/qaction/BLACKLIST
deleted file mode 100644
index 1ad524fdbf..0000000000
--- a/tests/auto/widgets/kernel/qaction/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[setStandardKeys]
-linux
diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
index ac0174d19a..ddf9ccb416 100644
--- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
+++ b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp
@@ -240,7 +240,7 @@ void tst_QAction::setStandardKeys()
expected << ctrlC << ctrlInsert;
break;
default: // X11
- expected << ctrlC << QKeySequence(QStringLiteral("F16")) << ctrlInsert;
+ expected << ctrlC << ctrlInsert << QKeySequence(QStringLiteral("F16"));
break;
}
@@ -354,7 +354,7 @@ void tst_QAction::enabledVisibleInteraction()
void tst_QAction::task200823_tooltip()
{
- const QScopedPointer<QAction> action(new QAction("foo", Q_NULLPTR));
+ const QScopedPointer<QAction> action(new QAction("foo", nullptr));
QString shortcut("ctrl+o");
action->setShortcut(shortcut);
@@ -368,7 +368,7 @@ void tst_QAction::task200823_tooltip()
void tst_QAction::task229128TriggeredSignalWithoutActiongroup()
{
// test without a group
- const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", Q_NULLPTR));
+ const QScopedPointer<QAction> actionWithoutGroup(new QAction("Test", nullptr));
QSignalSpy spyWithoutGroup(actionWithoutGroup.data(), SIGNAL(triggered(bool)));
QCOMPARE(spyWithoutGroup.count(), 0);
actionWithoutGroup->trigger();
diff --git a/tests/auto/widgets/kernel/qactiongroup/BLACKLIST b/tests/auto/widgets/kernel/qactiongroup/BLACKLIST
deleted file mode 100644
index fdc424b6ac..0000000000
--- a/tests/auto/widgets/kernel/qactiongroup/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[QTBUG_14292_filesystem]
-linux
diff --git a/tests/auto/widgets/kernel/qapplication/BLACKLIST b/tests/auto/widgets/kernel/qapplication/BLACKLIST
deleted file mode 100644
index f4a9cb6166..0000000000
--- a/tests/auto/widgets/kernel/qapplication/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[quitOnLastWindowClosed]
-osx-10.10
diff --git a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST b/tests/auto/widgets/kernel/qapplication/test/BLACKLIST
deleted file mode 100644
index f4a9cb6166..0000000000
--- a/tests/auto/widgets/kernel/qapplication/test/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[quitOnLastWindowClosed]
-osx-10.10
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 6ff38abdb8..c70ac0309f 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -2214,7 +2214,7 @@ void tst_QApplication::staticFunctions()
QApplication::activeModalWidget();
QApplication::focusWidget();
QApplication::activeWindow();
- QApplication::setActiveWindow(Q_NULLPTR);
+ QApplication::setActiveWindow(nullptr);
QApplication::widgetAt(QPoint(0, 0));
QApplication::topLevelAt(QPoint(0, 0));
QApplication::setGlobalStrut(QSize(0, 0));
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
index 7262817d23..2f1a305710 100644
--- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
+++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp
@@ -293,7 +293,7 @@ void tst_QBoxLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){
layout.setObjectName("ef9e2b42298e0e6420105bb");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QVBoxLayout/ef9e2b42298e0e6420105bb");
- layout.addWidget(Q_NULLPTR);
+ layout.addWidget(nullptr);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/347b469225a24a0ef05150a to its child layout QVBoxLayout/ef9e2b42298e0e6420105bb");
@@ -309,7 +309,7 @@ void tst_QBoxLayout::taskQTBUG_40609_addingLayoutToItself(){
layout.setObjectName("cc751dd0f50f62b05a62da");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QVBoxLayout/cc751dd0f50f62b05a62da");
- layout.addLayout(Q_NULLPTR);
+ layout.addLayout(nullptr);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QVBoxLayout/cc751dd0f50f62b05a62da to itself");
diff --git a/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
index c3ebb838bb..bcf48c21df 100644
--- a/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
+++ b/tests/auto/widgets/kernel/qgesturerecognizer/tst_qgesturerecognizer.cpp
@@ -84,7 +84,7 @@ public:
{ return m_receivedGestures.value(gestureType); }
protected:
- bool event(QEvent * event) Q_DECL_OVERRIDE;
+ bool event(QEvent * event) override;
private:
typedef QHash<Qt::GestureType, bool> GestureTypeHash;
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 37e2bdb069..40a2319910 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -336,7 +336,7 @@ void tst_QGridLayout::setMinAndMaxSize()
layout.removeItem(spacer);
delete spacer;
- spacer = Q_NULLPTR;
+ spacer = nullptr;
rightChild.hide();
QApplication::sendPostedEvents(0, 0);
@@ -1624,7 +1624,7 @@ void tst_QGridLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){
layout.setObjectName("d631e91a35f2b66a6dff35");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QGridLayout/d631e91a35f2b66a6dff35");
- layout.addWidget(Q_NULLPTR, 0, 0);
+ layout.addWidget(nullptr, 0, 0);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/9bb37ca762aeb7269b8 to its child layout QGridLayout/d631e91a35f2b66a6dff35");
@@ -1639,7 +1639,7 @@ void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){
layout.setObjectName("5d79e1b0aed83f100e3c2");
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QGridLayout/5d79e1b0aed83f100e3c2");
- layout.addLayout(Q_NULLPTR, 0, 0);
+ layout.addLayout(nullptr, 0, 0);
QCOMPARE(layout.count(), 0);
QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QGridLayout/5d79e1b0aed83f100e3c2 to itself");
diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
index 9d0c939d84..ff35b0cdb1 100644
--- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp
@@ -1105,7 +1105,7 @@ public:
int overrideCount;
- bool event(QEvent *e) Q_DECL_OVERRIDE
+ bool event(QEvent *e) override
{
if (e->type() == QEvent::ShortcutOverride)
overrideCount++;
diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
index d50f46cc16..eb3264be53 100644
--- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
+++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp
@@ -60,7 +60,7 @@ private:
struct PrettyPrint {
const char *m_s;
template <typename T>
- explicit PrettyPrint(const T &t) : m_s(Q_NULLPTR)
+ explicit PrettyPrint(const T &t) : m_s(nullptr)
{
using QT_PREPEND_NAMESPACE(QTest)::toString;
m_s = toString(t);
diff --git a/tests/auto/widgets/kernel/qtooltip/BLACKLIST b/tests/auto/widgets/kernel/qtooltip/BLACKLIST
deleted file mode 100644
index f8d062cc46..0000000000
--- a/tests/auto/widgets/kernel/qtooltip/BLACKLIST
+++ /dev/null
@@ -1,4 +0,0 @@
-[whatsThis]
-ubuntu-14.04
-[task183679]
-opensuse-13.1
diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
index c163117ef3..86736bb082 100644
--- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
+++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp
@@ -129,7 +129,7 @@ static QWidget *findWhatsThat()
if (widget->inherits("QWhatsThat"))
return widget;
}
- return Q_NULLPTR;
+ return nullptr;
}
void tst_QToolTip::whatsThis()
@@ -137,7 +137,7 @@ void tst_QToolTip::whatsThis()
qApp->setStyleSheet( "QWidget { font-size: 72px; }" );
QWhatsThis::showText(QPoint(0, 0), "This is text");
- QWidget *whatsthis = Q_NULLPTR;
+ QWidget *whatsthis = nullptr;
QTRY_VERIFY( (whatsthis = findWhatsThat()) );
QVERIFY(whatsthis->isVisible());
const int whatsThisHeight = whatsthis->height();
diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST
index 4cef2d57a4..2ca30f98c3 100644
--- a/tests/auto/widgets/kernel/qwidget/BLACKLIST
+++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST
@@ -1,30 +1,18 @@
# OSX QTBUG-25300 QTBUG-45502
[normalGeometry]
-ubuntu-14.04
ubuntu-16.04
[saveRestoreGeometry]
-ubuntu-14.04
ubuntu-16.04
b2qt
[restoreVersion1Geometry]
xcb
osx
[updateWhileMinimized]
-ubuntu-14.04
ubuntu-16.04
-rhel-7.1
-rhel-7.2
-rhel-7.3
rhel-7.4
osx
[focusProxyAndInputMethods]
linux
-[touchEventSynthesizedMouseEvent]
-ubuntu-14.04
-[grabMouse]
-ubuntu-14.04
-[largerThanScreen_QTBUG30142]
-ubuntu-14.04
[showMaximized]
osx
[setGeometry]
@@ -48,7 +36,6 @@ osx
[render_systemClip]
osx
[showMinimizedKeepsFocus]
-osx-10.10
osx-10.11 ci
osx-10.12 ci
[moveWindowInShowEvent:1]
@@ -61,10 +48,7 @@ osx
osx
[maskedUpdate]
osx
-opensuse-42.1
opensuse-42.3
-[hideWhenFocusWidgetIsChild]
-osx-10.10
[hideOpaqueChildWhileHidden]
osx
[resizeStaticContentsChildWidget_QTBUG35282]
@@ -76,7 +60,7 @@ osx
[setToolTip]
osx
[moveInResizeEvent]
-ubuntu-14.04
+ubuntu-16.04
[moveChild:right]
osx
[activateWindow]
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index cf2794903e..5a9c5dd175 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -3706,7 +3706,7 @@ public:
gotPaintEvent = true;
// qDebug() << "paint" << e->region();
// Look for a full update, set partial to false if found.
- foreach(QRect r, e->region().rects()) {
+ for (QRect r : e->region()) {
partial = (r != rect());
if (partial == false)
break;
@@ -5145,13 +5145,12 @@ static QPixmap grabWindow(QWindow *window, int x, int y, int width, int height)
bool verifyColor(QWidget &child, const QRegion &region, const QColor &color, unsigned int callerLine)
{
- const QRegion r = QRegion(region);
QWindow *window = child.window()->windowHandle();
Q_ASSERT(window);
const QPoint offset = child.mapTo(child.window(), QPoint(0,0));
bool grabBackingStore = false;
- for (int i = 0; i < r.rects().size(); ++i) {
- QRect rect = r.rects().at(i).translated(offset);
+ for (QRect r : region) {
+ QRect rect = r.translated(offset);
for (int t = 0; t < 6; t++) {
const QPixmap pixmap = grabBackingStore
? child.grab(rect)
@@ -5176,7 +5175,7 @@ bool verifyColor(QWidget &child, const QRegion &region, const QColor &color, uns
} else {
if (t == 4) {
grabBackingStore = true;
- rect = r.rects().at(i);
+ rect = r;
} else {
QTest::qWait(200);
}
@@ -6065,7 +6064,7 @@ public:
startTimer(1000);
}
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE
+ void timerEvent(QTimerEvent *) override
{
switch (state++) {
case 0:
@@ -6088,7 +6087,7 @@ public:
return false;
}
- bool nativeEvent(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
+ bool nativeEvent(const QByteArray &eventType, void *message, long *) override
{
if (isMapNotify(eventType, message))
gotExpectedMapNotify = true;
@@ -6096,7 +6095,7 @@ public:
}
// QAbstractNativeEventFilter interface
- bool nativeEventFilter(const QByteArray &eventType, void *message, long *) Q_DECL_OVERRIDE
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override
{
if (isMapNotify(eventType, message))
gotExpectedGlobalEvent = true;
@@ -8222,7 +8221,7 @@ public:
QPainter p(this);
paintedRegion += event->region();
- foreach(QRect r, event->region().rects())
+ for (const QRect &r : event->region())
p.fillRect(r, Qt::red);
}
@@ -8733,7 +8732,7 @@ public:
QPainter p(this);
paintedRegion += event->region();
- foreach(QRect r, event->region().rects())
+ for (const QRect &r : event->region())
p.fillRect(r, Qt::red);
}
@@ -10521,7 +10520,7 @@ public slots:
QTimer::singleShot(100, this, SLOT(doMouseMoves()));
modal->exec();
delete modal;
- modal = Q_NULLPTR;
+ modal = nullptr;
}
void doMouseMoves()
@@ -10594,7 +10593,7 @@ class KeyboardWidget : public QWidget
{
public:
KeyboardWidget(QWidget* parent = 0) : QWidget(parent), m_eventCounter(0) {}
- virtual void mousePressEvent(QMouseEvent* ev) Q_DECL_OVERRIDE {
+ virtual void mousePressEvent(QMouseEvent* ev) override {
m_modifiers = ev->modifiers();
m_appModifiers = QApplication::keyboardModifiers();
++m_eventCounter;
diff --git a/tests/auto/widgets/kernel/qwidget_window/BLACKLIST b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
new file mode 100644
index 0000000000..d3bfaba433
--- /dev/null
+++ b/tests/auto/widgets/kernel/qwidget_window/BLACKLIST
@@ -0,0 +1,4 @@
+[tst_resize_count]
+# QTBUG-66345
+opensuse-42.3
+ubuntu-16.04
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 b76c4d35a8..9021be1515 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -214,12 +214,12 @@ class PaintTestWidget : public QWidget
public:
int paintEventCount;
- explicit PaintTestWidget(QWidget *parent = Q_NULLPTR)
+ explicit PaintTestWidget(QWidget *parent = nullptr)
: QWidget(parent)
, paintEventCount(0)
{}
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE
+ void paintEvent(QPaintEvent *event) override
{
++paintEventCount;
QWidget::paintEvent(event);
@@ -692,7 +692,7 @@ public:
int resizeCount;
protected:
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE
+ void resizeEvent(QResizeEvent *) override
{
resizeCount++;
}
@@ -759,7 +759,7 @@ public:
, moveCount(0)
{ }
- void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE
+ void moveEvent(QMoveEvent *) override
{
moveCount++;
}
@@ -798,7 +798,7 @@ public:
}
protected:
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE
+ bool eventFilter(QObject *o, QEvent *e) override
{
if (e->type() == filterEventType())
++eventCount;
diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
index cd8ba95b06..e49fd701d6 100644
--- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
+++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp
@@ -730,7 +730,7 @@ public:
, called(false)
{}
- void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override {
called = true;
return QProxyStyle::drawPrimitive(pe, opt, p, w);
}
@@ -773,74 +773,74 @@ class TestStyleOptionInitProxy: public QProxyStyle
Q_OBJECT
public:
mutable bool invalidOptionsDetected;
- explicit TestStyleOptionInitProxy(QStyle *style = Q_NULLPTR)
+ explicit TestStyleOptionInitProxy(QStyle *style = nullptr)
: QProxyStyle(style),
invalidOptionsDetected(false)
{}
- void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const override {
checkStyleEnum<QStyle::PrimitiveElement>(pe, opt);
return QProxyStyle::drawPrimitive(pe, opt, p, w);
}
- void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const Q_DECL_OVERRIDE {
+ void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w) const override {
checkStyleEnum<QStyle::ControlElement>(element, opt);
return QProxyStyle::drawControl(element, opt, p, w);
}
- QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget) const override {
checkStyleEnum<QStyle::SubElement>(subElement, option);
return QProxyStyle::subElementRect(subElement, option, widget);
}
- void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const Q_DECL_OVERRIDE {
+ void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const override {
checkStyleEnum<QStyle::ComplexControl>(cc, opt);
return QProxyStyle::drawComplexControl(cc, opt, p, widget);
}
- QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override {
checkStyleEnum<QStyle::ComplexControl>(cc, opt);
return QProxyStyle::subControlRect(cc, opt, sc, widget);
}
- int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const override {
checkStyleEnum<QStyle::PixelMetric>(metric, option);
return QProxyStyle::pixelMetric(metric, option, widget);
}
- QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const Q_DECL_OVERRIDE {
+ QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w) const override {
checkStyleEnum<QStyle::ContentsType>(ct, opt);
return QProxyStyle::sizeFromContents(ct, opt, contentsSize, w);
}
- int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const Q_DECL_OVERRIDE {
+ int styleHint(StyleHint stylehint, const QStyleOption *opt, const QWidget *widget, QStyleHintReturn *returnData) const override {
checkStyleEnum<QStyle::StyleHint>(stylehint, opt);
return QProxyStyle::styleHint(stylehint, opt, widget, returnData);
}
- QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const override {
checkStyleEnum<QStyle::StandardPixmap>(standardPixmap, opt);
return QProxyStyle::standardPixmap(standardPixmap, opt, widget);
}
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const override {
checkStyleEnum<QStyle::StandardPixmap>(standardIcon, option);
return QProxyStyle::standardIcon(standardIcon, option, widget);
}
- QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const Q_DECL_OVERRIDE {
+ QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override {
checkStyle(QString::asprintf("QIcon::Mode(%i)", iconMode).toLatin1(), opt);
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, opt);
}
- int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE {
+ int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const override {
checkStyle(QString::asprintf("QSizePolicy::ControlType(%i), QSizePolicy::ControlType(%i)", control1, control2).toLatin1(), option);
return QProxyStyle::layoutSpacing(control1, control2, orientation, option, widget);
}
private:
void checkStyle(const QByteArray &info, const QStyleOption *opt) const {
- if (opt && (opt->version == 0 || opt->styleObject == Q_NULLPTR) ) {
+ if (opt && (opt->version == 0 || opt->styleObject == nullptr) ) {
invalidOptionsDetected = true;
qWarning() << baseStyle()->metaObject()->className()
<< "Invalid QStyleOption found for"
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST
index 61966e684f..6b2e4f3fb2 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST
+++ b/tests/auto/widgets/styles/qstylesheetstyle/BLACKLIST
@@ -1,4 +1,2 @@
-[hoverColors]
-ubuntu-14.04
-opensuse-13.1
-opensuse-42.1
+[task232085_spinBoxLineEditBg]
+osx
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 92bcd5c350..6fbb0fe5fa 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -610,7 +610,7 @@ void tst_QCompleter::directoryModel_data()
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
+#if !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
QTest::newRow("(/h)") << "/h" << "" << "home" << "/home";
#endif
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
@@ -656,7 +656,7 @@ void tst_QCompleter::fileSystemModel_data()
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
-#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
+#if !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
QTest::newRow("(/h)") << "/h" << "" << "home" << "/home";
#endif
QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
index 62c3469447..c1524d870d 100644
--- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
+++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp
@@ -30,24 +30,6 @@
#include <QUndoStack>
#include <QAction>
-// Temporarily disabling IRIX due to build issuues with GCC
-#if defined(__sgi) && defined(__GNUC__)
-
-class tst_QUndoGroup : public QObject
-{
- Q_OBJECT
-public:
- tst_QUndoGroup() {}
-
-private slots:
- void setActive() { QSKIP( "Not tested on irix-g++"); }
- void addRemoveStack() { QSKIP( "Not tested on irix-g++"); }
- void deleteStack() { QSKIP( "Not tested on irix-g++"); }
- void checkSignals() { QSKIP( "Not tested on irix-g++"); }
- void addStackAndDie() { QSKIP( "Not tested on irix-g++"); }
-};
-#else
-
/******************************************************************************
** Commands
*/
@@ -652,7 +634,6 @@ void tst_QUndoGroup::commandTextFormat()
qApp->removeTranslator(&translator);
#endif
}
-#endif // !(SGI && GCC)
QTEST_MAIN(tst_QUndoGroup)
diff --git a/tests/auto/widgets/widgets/qcombobox/BLACKLIST b/tests/auto/widgets/widgets/qcombobox/BLACKLIST
index c04351e5ca..2d6228075a 100644
--- a/tests/auto/widgets/widgets/qcombobox/BLACKLIST
+++ b/tests/auto/widgets/widgets/qcombobox/BLACKLIST
@@ -1,7 +1,3 @@
-QTBUG-45531
-[task260974_menuItemRectangleForComboBoxPopup]
-osx-10.10
-
[task_QTBUG_56693_itemFontFromModel]
# Counts draw calls, but we could have multiple expose events QTBUG-62080
osx
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index b6007482ae..0c229c9194 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -2052,13 +2052,13 @@ void tst_QComboBox::mouseWheel_data()
QTest::newRow("upper locked") << disabled << start << wheel << expected;
wheel = -1;
-#ifdef Q_OS_DARWIN
+ const bool allowsWheelScroll = QApplication::style()->styleHint(QStyle::SH_ComboBox_AllowWheelScrolling);
// on OS X & iOS mouse wheel shall have no effect on combo box
- expected = start;
-#else
- // on other OSes we should jump to next enabled item (no. 5)
- expected = 5;
-#endif
+ if (!allowsWheelScroll)
+ expected = start;
+ else // on other OSes we should jump to next enabled item (no. 5)
+ expected = 5;
+
QTest::newRow("jump over") << disabled << start << wheel << expected;
disabled.clear();
@@ -3273,7 +3273,7 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated()
class QTBUG_56693_Model : public QStandardItemModel
{
public:
- QTBUG_56693_Model(QObject *parent = Q_NULLPTR)
+ QTBUG_56693_Model(QObject *parent = nullptr)
: QStandardItemModel(parent)
{ }
@@ -3301,7 +3301,7 @@ public:
}
- void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = Q_NULLPTR) const override
+ void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = nullptr) const override
{
if (element == CE_MenuItem)
if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt))
diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
index a3571cd9c5..fa28ec2575 100644
--- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
+++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp
@@ -336,7 +336,7 @@ void tst_QDateTimeEdit::constructor_qwidget()
QCOMPARE(dte.dateTime(), QDateTime(QDate(2000, 1, 1), QTime(0, 0, 0, 0)));
QCOMPARE(dte.minimumDate(), QDate(1752, 9, 14));
QCOMPARE(dte.minimumTime(), QTime(0, 0, 0, 0));
- QCOMPARE(dte.maximumDate(), QDate(7999, 12, 31));
+ QCOMPARE(dte.maximumDate(), QDate(9999, 12, 31));
QCOMPARE(dte.maximumTime(), QTime(23, 59, 59, 999));
}
@@ -352,12 +352,12 @@ void tst_QDateTimeEdit::constructor_qdatetime_data()
QTest::newRow("normal") << QDateTime(QDate(2004, 6, 16), QTime(13, 46, 32, 764))
<< QDateTime(QDate(2004, 6, 16), QTime(13, 46, 32, 764))
<< QDate(1752, 9, 14) << QTime(0, 0, 0, 0)
- << QDate(7999, 12, 31) << QTime(23, 59, 59, 999);
+ << QDate(9999, 12, 31) << QTime(23, 59, 59, 999);
QTest::newRow("invalid") << QDateTime(QDate(9999, 99, 99), QTime(13, 46, 32, 764))
<< QDateTime(QDate(2000, 1, 1), QTime(0, 0, 0, 0))
<< QDate(1752, 9, 14) << QTime(0, 0, 0, 0)
- << QDate(7999, 12, 31) << QTime(23, 59, 59, 999);
+ << QDate(9999, 12, 31) << QTime(23, 59, 59, 999);
}
void tst_QDateTimeEdit::constructor_qdatetime()
@@ -392,12 +392,12 @@ void tst_QDateTimeEdit::constructor_qdate_data()
QTest::newRow("normal") << QDate(2004, 6, 16)
<< QDateTime(QDate(2004, 6, 16), QTime(0, 0, 0, 0))
<< QDate(1752, 9, 14) << QTime(0, 0, 0, 0)
- << QDate(7999, 12, 31) << QTime(23, 59, 59, 999);
+ << QDate(9999, 12, 31) << QTime(23, 59, 59, 999);
QTest::newRow("invalid") << QDate(9999, 99, 99)
<< QDateTime(QDate(2000, 1, 1), QTime(0, 0, 0, 0))
<< QDate(1752, 9, 14) << QTime(0, 0, 0, 0)
- << QDate(7999, 12, 31) << QTime(23, 59, 59, 999);
+ << QDate(9999, 12, 31) << QTime(23, 59, 59, 999);
}
void tst_QDateTimeEdit::constructor_qdate()
@@ -467,7 +467,7 @@ void tst_QDateTimeEdit::minimumDate_data()
QTest::newRow("normal-0") << QDate(2004, 5, 10) << QDate(2004, 5, 10);
QTest::newRow("normal-1") << QDate(2002, 3, 15) << QDate(2002, 3, 15);
- QTest::newRow("normal-2") << QDate(7999, 12, 31) << QDate(7999, 12, 31);
+ QTest::newRow("normal-2") << QDate(9999, 12, 31) << QDate(9999, 12, 31);
QTest::newRow("normal-3") << QDate(1753, 1, 1) << QDate(1753, 1, 1);
QTest::newRow("invalid-0") << QDate(0, 0, 0) << QDate(1752, 9, 14);
QTest::newRow("old") << QDate(1492, 8, 3) << QDate(1492, 8, 3);
@@ -528,7 +528,7 @@ void tst_QDateTimeEdit::maximumDateTime_data()
<< QDateTime(QDate(2007, 5, 10), QTime(22, 23, 23));
QTest::newRow("normal-4") << QDateTime(QDate(2008, 5, 10), QTime(2, 3, 1))
<< QDateTime(QDate(2008, 5, 10), QTime(2, 3, 1));
- QTest::newRow("invalid-0") << QDateTime() << QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999));
+ QTest::newRow("invalid-0") << QDateTime() << QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59, 999));
}
void tst_QDateTimeEdit::maximumDateTime()
@@ -547,9 +547,9 @@ void tst_QDateTimeEdit::maximumDate_data()
QTest::newRow("normal-0") << QDate(2004, 05, 10) << QDate(2004, 5, 10);
QTest::newRow("normal-1") << QDate(2002, 03, 15) << QDate(2002, 3, 15);
- QTest::newRow("normal-2") << QDate(7999, 12, 31) << QDate(7999, 12, 31);
+ QTest::newRow("normal-2") << QDate(9999, 12, 31) << QDate(9999, 12, 31);
QTest::newRow("normal-3") << QDate(1753, 1, 1) << QDate(1753, 1, 1);
- QTest::newRow("invalid-0") << QDate(0, 0, 0) << QDate(7999, 12, 31);
+ QTest::newRow("invalid-0") << QDate(0, 0, 0) << QDate(9999, 12, 31);
}
void tst_QDateTimeEdit::maximumDate()
@@ -569,7 +569,7 @@ void tst_QDateTimeEdit::clearMinimumDate_data()
QTest::newRow("normal-0") << QDate(2004, 05, 10) << true << QDate(1752, 9, 14);
QTest::newRow("normal-1") << QDate(2002, 3, 15) << true << QDate(1752, 9, 14);
- QTest::newRow("normal-2") << QDate(7999, 12, 31) << true << QDate(1752, 9, 14);
+ QTest::newRow("normal-2") << QDate(9999, 12, 31) << true << QDate(1752, 9, 14);
QTest::newRow("normal-3") << QDate(1753, 1, 1) << true << QDate(1752, 9, 14);
QTest::newRow("invalid-0") << QDate(0, 0, 0) << false << QDate(1752, 9, 14);
}
@@ -597,7 +597,7 @@ void tst_QDateTimeEdit::clearMinimumDateTime_data()
<< true << QDateTime(QDate(1752, 9, 14), QTime(0, 0));
QTest::newRow("normal-1") << QDateTime(QDate(2002, 3, 15), QTime(13, 13, 13))
<< true << QDateTime(QDate(1752, 9, 14), QTime(0, 0));
- QTest::newRow("normal-2") << QDateTime(QDate(7999, 12, 31), QTime(14, 14, 14))
+ QTest::newRow("normal-2") << QDateTime(QDate(9999, 12, 31), QTime(14, 14, 14))
<< true << QDateTime(QDate(1752, 9, 14), QTime(0, 0));
QTest::newRow("normal-3") << QDateTime(QDate(1753, 1, 1), QTime(15, 15, 15))
<< true << QDateTime(QDate(1752, 9, 14), QTime(0, 0));
@@ -626,15 +626,15 @@ void tst_QDateTimeEdit::clearMaximumDateTime_data()
QTest::addColumn<QDateTime>("expectedMinDateTimeAfterClear");
QTest::newRow("normal-0") << QDateTime(QDate(2004, 05, 10), QTime(12, 12, 12))
- << true << QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999));
+ << true << QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59, 999));
QTest::newRow("normal-1") << QDateTime(QDate(2002, 3, 15), QTime(13, 13, 13))
- << true << QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999));
- QTest::newRow("normal-2") << QDateTime(QDate(7999, 12, 31), QTime(14, 14, 14))
- << true << QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999));
+ << true << QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59, 999));
+ QTest::newRow("normal-2") << QDateTime(QDate(9999, 12, 31), QTime(14, 14, 14))
+ << true << QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59, 999));
QTest::newRow("normal-3") << QDateTime(QDate(1753, 1, 1), QTime(15, 15, 15))
- << true << QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999));
+ << true << QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59, 999));
QTest::newRow("invalid-0") << QDateTime()
- << false << QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999));
+ << false << QDateTime(QDate(9999, 12, 31), QTime(23, 59, 59, 999));
}
void tst_QDateTimeEdit::clearMaximumDateTime()
@@ -656,11 +656,11 @@ void tst_QDateTimeEdit::clearMaximumDate_data()
QTest::addColumn<bool>("valid");
QTest::addColumn<QDate>("expectedMaxDateAfterClear");
- QTest::newRow("normal-0") << QDate(2004, 05, 10) << true << QDate(7999, 12, 31);
- QTest::newRow("normal-1") << QDate(2002, 03, 15) << true << QDate(7999, 12, 31);
- QTest::newRow("normal-2") << QDate(7999, 12, 31) << true << QDate(7999, 12, 31);
- QTest::newRow("normal-3") << QDate(2000, 1, 1) << true << QDate(7999, 12, 31);
- QTest::newRow("invalid-0") << QDate(0, 0, 0) << false << QDate(7999, 12, 31);
+ QTest::newRow("normal-0") << QDate(2004, 05, 10) << true << QDate(9999, 12, 31);
+ QTest::newRow("normal-1") << QDate(2002, 03, 15) << true << QDate(9999, 12, 31);
+ QTest::newRow("normal-2") << QDate(9999, 12, 31) << true << QDate(9999, 12, 31);
+ QTest::newRow("normal-3") << QDate(2000, 1, 1) << true << QDate(9999, 12, 31);
+ QTest::newRow("invalid-0") << QDate(0, 0, 0) << false << QDate(9999, 12, 31);
}
void tst_QDateTimeEdit::clearMaximumDate()
diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
index 9e6b16d4ce..1813e5ad5f 100644
--- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
+++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp
@@ -204,7 +204,7 @@ void tst_QFontComboBox::sizeHint()
SubQFontComboBox box;
QSize sizeHint = box.QComboBox::sizeHint();
QFontMetrics fm(box.font());
- sizeHint.setWidth(qMax(sizeHint.width(), fm.width(QLatin1Char('m'))*14));
+ sizeHint.setWidth(qMax(sizeHint.width(), fm.horizontalAdvance(QLatin1Char('m'))*14));
QCOMPARE(box.sizeHint(), sizeHint);
}
diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
index 6363d0c673..500ec2e1fa 100644
--- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
+++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp
@@ -47,7 +47,7 @@ public:
QList<QEvent::Type> events;
protected:
- bool event(QEvent *ev) Q_DECL_OVERRIDE {
+ bool event(QEvent *ev) override {
events.append(ev->type());
return QWidget::event(ev);
}
diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
index 21669e42cd..1513025f16 100644
--- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp
@@ -67,6 +67,8 @@
#include "../../../shared/platforminputcontext.h"
#include <private/qinputmethod_p.h>
+Q_LOGGING_CATEGORY(lcTests, "qt.widgets.tests")
+
QT_BEGIN_NAMESPACE
class QPainter;
QT_END_NAMESPACE
@@ -300,8 +302,8 @@ private slots:
void shortcutOverrideOnReadonlyLineEdit_data();
void shortcutOverrideOnReadonlyLineEdit();
void QTBUG59957_clearButtonLeftmostAction();
-
void QTBUG_60319_setInputMaskCheckImSurroundingText();
+ void testQuickSelectionWithMouse();
protected slots:
void editingFinished();
@@ -3046,7 +3048,7 @@ void tst_QLineEdit::cutWithoutSelection()
QClipboard *clipboard = QGuiApplication::clipboard();
if (!PlatformClipboard::isAvailable()
|| !QGuiApplication::platformName().compare("xcb", Qt::CaseInsensitive)) { // Avoid unstable X11 clipboard
- clipboard = Q_NULLPTR;
+ clipboard = nullptr;
}
if (clipboard)
@@ -3436,8 +3438,8 @@ void tst_QLineEdit::textMargin_data()
// Different styles generate different offsets, so
// calculate the width rather than hardcode it.
- const int pixelWidthOfM = metrics.width(s, 1);
- const int pixelWidthOfMMM_MM = metrics.width(s, 6);
+ const int pixelWidthOfM = metrics.horizontalAdvance(s, 1);
+ const int pixelWidthOfMMM_MM = metrics.horizontalAdvance(s, 6);
QTest::newRow("default-0") << 0 << 0 << 0 << 0 << QPoint(pixelWidthOfMMM_MM, 0) << 6;
QTest::newRow("default-1") << 0 << 0 << 0 << 0 << QPoint(1, 1) << 0;
@@ -4475,7 +4477,7 @@ template <class T> T *findAssociatedWidget(const QAction *a)
if (T *result = qobject_cast<T *>(w))
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
void tst_QLineEdit::sideWidgetsActionEvents()
@@ -4699,5 +4701,90 @@ void tst_QLineEdit::QTBUG_60319_setInputMaskCheckImSurroundingText()
QCOMPARE(surroundingText.length(), cursorPosition);
}
+void tst_QLineEdit::testQuickSelectionWithMouse()
+{
+ const auto text = QStringLiteral("This is quite a long line of text.");
+ const auto prefix = QStringLiteral("Th");
+ const auto suffix = QStringLiteral("t.");
+ QVERIFY(text.startsWith(prefix));
+ QVERIFY(text.endsWith(suffix));
+
+ QLineEdit lineEdit;
+ lineEdit.setText(text);
+ lineEdit.show();
+
+ const QPoint center = lineEdit.contentsRect().center();
+
+ // Normal mouse selection from left to right, y doesn't change.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(20, 0));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(!lineEdit.selectedText().isEmpty());
+ QVERIFY(!lineEdit.selectedText().endsWith(suffix));
+
+ // Normal mouse selection from left to right, y change is below threshold.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(20, 5));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(!lineEdit.selectedText().isEmpty());
+ QVERIFY(!lineEdit.selectedText().endsWith(suffix));
+
+ // Normal mouse selection from right to left, y doesn't change.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(-20, 0));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(!lineEdit.selectedText().isEmpty());
+ QVERIFY(!lineEdit.selectedText().startsWith(prefix));
+
+ // Normal mouse selection from right to left, y change is below threshold.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(-20, -5));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(!lineEdit.selectedText().isEmpty());
+ QVERIFY(!lineEdit.selectedText().startsWith(prefix));
+
+ const int offset = QGuiApplication::styleHints()->mouseQuickSelectionThreshold() + 1;
+
+ // Select the whole right half.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(1, offset));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(lineEdit.selectedText().endsWith(suffix));
+
+ // Select the whole left half.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(1, -offset));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(lineEdit.selectedText().startsWith(prefix));
+
+ // Normal selection -> quick selection -> back to normal selection.
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(20, 0));
+ const auto partialSelection = lineEdit.selectedText();
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(!partialSelection.endsWith(suffix));
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(20, offset));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+ QVERIFY(lineEdit.selectedText().endsWith(suffix));
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(20, 0));
+ qCDebug(lcTests) << "Selected text:" << lineEdit.selectedText();
+#ifdef Q_PROCESSOR_ARM
+ QEXPECT_FAIL("", "Currently fails on gcc-armv7, needs investigation.", Continue);
+#endif
+ QCOMPARE(lineEdit.selectedText(), partialSelection);
+
+ lineEdit.setLayoutDirection(Qt::RightToLeft);
+
+ // Select the whole left half (RTL layout).
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(1, offset));
+ QVERIFY(lineEdit.selectedText().startsWith(prefix));
+
+ // Select the whole right half (RTL layout).
+ QTest::mousePress(lineEdit.windowHandle(), Qt::LeftButton, Qt::NoModifier, center);
+ QTest::mouseMove(lineEdit.windowHandle(), center + QPoint(1, -offset));
+ QVERIFY(lineEdit.selectedText().endsWith(suffix));
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST b/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST
new file mode 100644
index 0000000000..26d1776b0d
--- /dev/null
+++ b/tests/auto/widgets/widgets/qmdisubwindow/BLACKLIST
@@ -0,0 +1,2 @@
+[setOpaqueResizeAndMove]
+osx-10.12
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 91c12e292d..28e8ba81d6 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -111,9 +111,8 @@ private slots:
void QTBUG7411_submenus_activate();
void QTBUG30595_rtl_submenu();
void QTBUG20403_nested_popup_on_shortcut_trigger();
-#ifndef QT_NO_CURSOR
void QTBUG47515_widgetActionEnterLeave();
-#endif
+
void QTBUG_10735_crashWithDialog();
#ifdef Q_OS_MAC
void QTBUG_37933_ampersands_data();
@@ -610,7 +609,7 @@ static QMenu *getTornOffMenu()
if (w->isVisible() && w->inherits("QTornOffMenu"))
return static_cast<QMenu *>(w);
}
- return Q_NULLPTR;
+ return nullptr;
}
void tst_QMenu::tearOff()
@@ -812,7 +811,7 @@ public:
}
protected:
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE
+ void showEvent(QShowEvent *e) override
{
QVERIFY(m_subMenu->isVisible());
QVERIFY2(m_subMenu->x() > x(),
@@ -821,7 +820,7 @@ protected:
QMenu::showEvent(e);
}
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE
+ void timerEvent(QTimerEvent *e) override
{
if (e->timerId() == m_timerId) {
switch (m_timerTick++) {
@@ -1176,25 +1175,27 @@ void tst_QMenu::click_while_dismissing_submenu()
menu.addMenu(&sub);
centerOnScreen(&menu, QSize(120, 100));
menu.show();
- QSignalSpy spy(action, SIGNAL(triggered()));
- QSignalSpy menuShownSpy(&sub, SIGNAL(aboutToShow()));
- QSignalSpy menuHiddenSpy(&sub, SIGNAL(aboutToHide()));
+ QSignalSpy spy(action, &QAction::triggered);
+ QSignalSpy menuShownSpy(&sub, &QMenu::aboutToShow);
+ QSignalSpy menuHiddenSpy(&sub, &QMenu::aboutToHide);
QVERIFY(QTest::qWaitForWindowExposed(&menu));
+ QWindow *menuWindow = menu.windowHandle();
+ QVERIFY(menuWindow);
//go over the submenu, press, move and release over the top level action
//this opens the submenu, move two times to emulate user interaction (d->motions > 0 in QMenu)
- QTest::mouseMove(&menu, menu.rect().center() + QPoint(0,2));
- QTest::mouseMove(&menu, menu.rect().center() + QPoint(1,3), 60);
+ QTest::mouseMove(menuWindow, menu.rect().center() + QPoint(0,2));
+ QTest::mouseMove(menuWindow, menu.rect().center() + QPoint(1,3), 60);
QVERIFY(menuShownSpy.wait());
QVERIFY(sub.isVisible());
QVERIFY(QTest::qWaitForWindowExposed(&sub));
//press over the submenu entry
- QTest::mousePress(&menu, Qt::LeftButton, 0, menu.rect().center() + QPoint(0,2), 300);
+ QTest::mousePress(menuWindow, Qt::LeftButton, 0, menu.rect().center() + QPoint(0,2), 300);
//move over the main action
- QTest::mouseMove(&menu, menu.rect().center() - QPoint(0,2));
+ QTest::mouseMove(menuWindow, menu.rect().center() - QPoint(0,2));
QVERIFY(menuHiddenSpy.wait());
//the submenu must have been hidden for the bug to be triggered
QVERIFY(!sub.isVisible());
- QTest::mouseRelease(&menu, Qt::LeftButton, 0, menu.rect().center() - QPoint(0,2), 300);
+ QTest::mouseRelease(menuWindow, Qt::LeftButton, 0, menu.rect().center() - QPoint(0,2), 300);
QCOMPARE(spy.count(), 1);
}
#endif
@@ -1210,7 +1211,7 @@ public:
setMouseTracking(true);
}
- bool event(QEvent *e) Q_DECL_OVERRIDE
+ bool event(QEvent *e) override
{
switch (e->type()) {
case QEvent::MouseMove:
@@ -1231,79 +1232,99 @@ public:
int move, enter, leave;
};
-#ifndef QT_NO_CURSOR
void tst_QMenu::QTBUG47515_widgetActionEnterLeave()
{
+#if !QT_CONFIG(cursor)
+ QSKIP("This test requires QCursor API");
+#else
if (QGuiApplication::platformName() == QLatin1String("cocoa"))
- QSKIP("This test fails on OS X on CI");
+ QSKIP("See QTBUG-63031");
- const QPoint center = QGuiApplication::primaryScreen()->availableGeometry().center();
- const QPoint cursorPos = center - QPoint(100, 100);
+ QPoint screenCenter = QGuiApplication::primaryScreen()->availableGeometry().center();
+ QPoint pointOutsideMenu = screenCenter - QPoint(100, 100);
- QScopedPointer<QMenu> menu1(new QMenu("Menu1"));
- QScopedPointer<QMenu> menu2(new QMenu("Menu2"));
+ QMenu menu("Menu1");
+ QMenu submenu("Menu2");
- QWidgetAction *wA1 = new QWidgetAction(menu1.data());
- MyWidget *w1 = new MyWidget(menu1.data());
- wA1->setDefaultWidget(w1);
+ QWidgetAction menuAction(&menu);
+ MyWidget w1(&menu);
+ menuAction.setDefaultWidget(&w1);
- QWidgetAction *wA2 = new QWidgetAction(menu2.data());
- MyWidget *w2 = new MyWidget(menu2.data());
- wA2->setDefaultWidget(w2);
+ QWidgetAction submenuAction(&submenu);
+ MyWidget w2(&submenu);
+ submenuAction.setDefaultWidget(&w2);
- QAction *nextMenuAct = menu1->addMenu(menu2.data());
+ QAction *nextMenuAct = menu.addMenu(&submenu);
- menu1->addAction(wA1);
- menu2->addAction(wA2);
+ menu.addAction(&menuAction);
+ submenu.addAction(&submenuAction);
// Root menu
{
- QCursor::setPos(cursorPos);
- QCoreApplication::processEvents();
-
- menu1->popup(center);
- QVERIFY(QTest::qWaitForWindowExposed(menu1.data()));
+ QCursor::setPos(pointOutsideMenu);
+ QTRY_COMPARE(QCursor::pos(), pointOutsideMenu);
+ menu.popup(screenCenter);
+ QVERIFY(QTest::qWaitForWindowExposed(&menu));
- QCursor::setPos(w1->mapToGlobal(w1->rect().center()));
- QVERIFY(w1->isVisible());
- QTRY_COMPARE(w1->leave, 0);
- QTRY_COMPARE(w1->enter, 1);
+ w1.enter = 0;
+ w1.leave = 0;
+ QPoint w1Center = w1.rect().center();
+ const QPoint w1CenterGlobal = w1.mapToGlobal(w1Center);
+ QCursor::setPos(w1CenterGlobal);
+ QTRY_COMPARE(QCursor::pos(), w1CenterGlobal);
+ QVERIFY(w1.isVisible());
+ QTRY_COMPARE(w1.leave, 0);
+ QTRY_COMPARE(w1.enter, 1);
// Check whether leave event is not delivered on mouse move
- w1->move = 0;
- QCursor::setPos(w1->mapToGlobal(w1->rect().center()) + QPoint(1, 1));
- QTRY_COMPARE(w1->move, 1);
- QTRY_COMPARE(w1->leave, 0);
- QTRY_COMPARE(w1->enter, 1);
-
- QCursor::setPos(cursorPos);
- QTRY_COMPARE(w1->leave, 1);
- QTRY_COMPARE(w1->enter, 1);
+ w1.move = 0;
+ QWidget *nativeParent = w1.nativeParentWidget();
+ QVERIFY(nativeParent);
+ QWindow *window = nativeParent->windowHandle();
+ QVERIFY(window);
+ QTest::mouseMove(window, w1.mapTo(nativeParent, w1Center + QPoint(1, 1)));
+ QTRY_COMPARE(w1.move, 1);
+ QTRY_COMPARE(w1.leave, 0);
+ QTRY_COMPARE(w1.enter, 1);
+
+ QCursor::setPos(pointOutsideMenu);
+ QTRY_COMPARE(QCursor::pos(), pointOutsideMenu);
+ QTRY_COMPARE(w1.leave, 1);
+ QTRY_COMPARE(w1.enter, 1);
}
// Submenu
{
- menu1->setActiveAction(nextMenuAct);
- QVERIFY(QTest::qWaitForWindowExposed(menu2.data()));
+ menu.setActiveAction(nextMenuAct);
+ QVERIFY(QTest::qWaitForWindowExposed(&submenu));
- QCursor::setPos(w2->mapToGlobal(w2->rect().center()));
- QVERIFY(w2->isVisible());
- QTRY_COMPARE(w2->leave, 0);
- QTRY_COMPARE(w2->enter, 1);
+ QPoint w2Center = w2.rect().center();
+ const QPoint w2CenterGlobal = w2.mapToGlobal(w2Center);
+ QCursor::setPos(w2CenterGlobal);
+ QTRY_COMPARE(QCursor::pos(), w2CenterGlobal);
+
+ QVERIFY(w2.isVisible());
+ QTRY_COMPARE(w2.leave, 0);
+ QTRY_COMPARE(w2.enter, 1);
// Check whether leave event is not delivered on mouse move
- w2->move = 0;
- QCursor::setPos(w2->mapToGlobal(w2->rect().center()) + QPoint(1, 1));
- QTRY_COMPARE(w2->move, 1);
- QTRY_COMPARE(w2->leave, 0);
- QTRY_COMPARE(w2->enter, 1);
-
- QCursor::setPos(cursorPos);
- QTRY_COMPARE(w2->leave, 1);
- QTRY_COMPARE(w2->enter, 1);
+ w2.move = 0;
+ QWidget *nativeParent = w2.nativeParentWidget();
+ QVERIFY(nativeParent);
+ QWindow *window = nativeParent->windowHandle();
+ QVERIFY(window);
+ QTest::mouseMove(window, w2.mapTo(nativeParent, w2Center + QPoint(1, 1)));
+ QTRY_COMPARE(w2.move, 1);
+ QTRY_COMPARE(w2.leave, 0);
+ QTRY_COMPARE(w2.enter, 1);
+
+ QCursor::setPos(pointOutsideMenu);
+ QTRY_COMPARE(QCursor::pos(), pointOutsideMenu);
+ QTRY_COMPARE(w2.leave, 1);
+ QTRY_COMPARE(w2.enter, 1);
}
+#endif // QT_NO_CURSOR
}
-#endif // !QT_NO_CURSOR
class MyMenu : public QMenu
{
@@ -1518,7 +1539,7 @@ void tst_QMenu::menuSize_Scrolling()
~TestMenu() {}
private:
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE
+ void showEvent(QShowEvent *e) override
{
QVERIFY(actions().length() == m_numItems);
diff --git a/tests/auto/widgets/widgets/qmenubar/BLACKLIST b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
index e2194e69ca..9b8e07312d 100644
--- a/tests/auto/widgets/widgets/qmenubar/BLACKLIST
+++ b/tests/auto/widgets/widgets/qmenubar/BLACKLIST
@@ -1,3 +1,5 @@
[check_menuPosition]
-ubuntu-14.04
ubuntu-16.04
+#QTBUG-66255
+[activatedCount]
+*
diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
index 417fa9befa..ab82268578 100644
--- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
+++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp
@@ -136,7 +136,7 @@ private slots:
void task223138_triggered();
void task256322_highlight();
void menubarSizeHint();
-#ifndef Q_OS_MAC
+#ifndef Q_OS_MACOS
void taskQTBUG4965_escapeEaten();
#endif
void taskQTBUG11823_crashwithInvisibleActions();
@@ -148,11 +148,12 @@ private slots:
void taskQTBUG56275_reinsertMenuInParentlessQMenuBar();
void QTBUG_57404_existingMenuItemException();
#endif
+ void QTBUG_25669_menubarActionDoubleTriggered();
void taskQTBUG55966_subMenuRemoved();
void QTBUG_58344_invalidIcon();
-
void platformMenu();
-
+ void addActionQt5connect();
+ void QTBUG_65488_hiddenActionTriggered();
protected slots:
void onSimpleActivated( QAction*);
void onComplexActionTriggered();
@@ -1376,7 +1377,7 @@ void tst_QMenuBar::menubarSizeHint()
}
// On Mac, do not test the menubar with escape key
-#ifndef Q_OS_MAC
+#ifndef Q_OS_MACOS
void tst_QMenuBar::taskQTBUG4965_escapeEaten()
{
QMenuBar menubar;
@@ -1549,7 +1550,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
//set the new parent, a window
QScopedPointer<QWidget> windowedParent;
- windowedParent.reset(new QWidget(Q_NULLPTR, Qt::WindowFlags()));
+ windowedParent.reset(new QWidget(nullptr, Qt::WindowFlags()));
windowedParent->setGeometry(400, 10, 300, 300);
windowedParent->show();
@@ -1566,7 +1567,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
//to windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
movingParent.setParent(windowedParent.data(),0);
// this resets the parenting and the menu bar's window
- taskQTBUG53205MenuBar->setParent(Q_NULLPTR);
+ taskQTBUG53205MenuBar->setParent(nullptr);
taskQTBUG53205MenuBar->setParent(&containedWidget);
//from windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
//to : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar
@@ -1576,6 +1577,25 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
testMenus.actions[0]->trigger();
}
+void tst_QMenuBar::QTBUG_65488_hiddenActionTriggered()
+{
+ QMainWindow win;
+ win.menuBar()->setNativeMenuBar(false);
+ QAction *act1 = win.menuBar()->addAction("A very long named action that make menuBar item wide enough");
+ QSignalSpy spy(win.menuBar(), &QMenuBar::triggered);
+
+ QRect actRect = win.menuBar()->actionGeometry(act1);
+ // resize to action's size to make Action1 hidden
+ win.resize(actRect.width() - 10, win.size().height());
+ win.show();
+ QApplication::setActiveWindow(&win);
+ QVERIFY(QTest::qWaitForWindowExposed(&win));
+ // click center of the blank area on the menubar where Action1 resided
+ QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, win.menuBar()->geometry().center());
+ QCoreApplication::sendPostedEvents(); // make sure all queued events also dispatched
+ QCOMPARE(spy.count(), 0);
+}
+
// QTBUG-56526
void tst_QMenuBar::platformMenu()
{
@@ -1595,10 +1615,71 @@ void tst_QMenuBar::platformMenu()
QVERIFY(menu->platformMenu());
}
+class TestObject : public QObject
+{
+ Q_OBJECT
+public:
+ bool flag = false;
+ void setFlag()
+ {
+ flag = true;
+ }
+};
+
+void tst_QMenuBar::addActionQt5connect()
+{
+ bool flag = false;
+ auto functor = [&flag](){ flag = true; };
+
+ TestObject obj;
+
+ QMenuBar menuBar;
+
+ auto action1 = menuBar.addAction(QStringLiteral("1"), &obj, &TestObject::setFlag);
+ auto action2 = menuBar.addAction(QStringLiteral("2"), functor);
+
+ action1->activate(QAction::Trigger);
+ action2->activate(QAction::Trigger);
+
+ QVERIFY(obj.flag);
+ QVERIFY(flag);
+
+ flag = false;
+
+ auto action3 = menuBar.addAction(QStringLiteral("3"), this, functor);
+ action3->activate(QAction::Trigger);
+ QVERIFY(flag);
+}
+
+void tst_QMenuBar::QTBUG_25669_menubarActionDoubleTriggered()
+{
+ QMainWindow win;
+ win.menuBar()->setNativeMenuBar(false);
+ QAction *act1 = win.menuBar()->addAction("Action1");
+ QAction *act2 = win.menuBar()->addAction("Action2");
+ QSignalSpy spy(win.menuBar(), &QMenuBar::triggered);
+
+ win.show();
+ QApplication::setActiveWindow(&win);
+ QVERIFY(QTest::qWaitForWindowExposed(&win));
+
+ QPoint posAct1 = menuBarActionWindowPos(win.menuBar(), act1);
+ QPoint posAct2 = menuBarActionWindowPos(win.menuBar(), act2);
+
+ QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, posAct1);
+ QTRY_COMPARE(spy.count(), 1);
+
+ QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, posAct2);
+ QTRY_COMPARE(spy.count(), 2);
+
+ QTest::mouseClick(win.windowHandle(), Qt::LeftButton, Qt::NoModifier, posAct2);
+ QTRY_COMPARE(spy.count(), 3);
+}
+
void tst_QMenuBar::slotForTaskQTBUG53205()
{
QWidget *parent = taskQTBUG53205MenuBar->parentWidget();
- taskQTBUG53205MenuBar->setParent(Q_NULLPTR);
+ taskQTBUG53205MenuBar->setParent(nullptr);
taskQTBUG53205MenuBar->setParent(parent);
}
diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST
index 7825c33a0a..b67c8354e8 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST
+++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST
@@ -1,18 +1,5 @@
[clearAndGrab]
-opensuse-13.1
ubuntu
-#QTBUG-31611
-[painter]
-windows msvc-2010 32bit developer-build
-
-#QTBUG-31611
-[reparentToAlreadyCreated]
-windows msvc-2010 32bit developer-build
-
-#QTBUG-31611
-[reparentToNotYetCreated]
-windows msvc-2010 32bit developer-build
-
[stackWidgetOpaqueChildIsVisible]
windows
diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
index 49291cf5f9..db125f6644 100644
--- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
+++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp
@@ -100,16 +100,16 @@ public:
m_w(expectedWidth), m_h(expectedHeight),
r(1.0f), g(0.0f), b(0.0f) { }
- void initializeGL() Q_DECL_OVERRIDE {
+ void initializeGL() override {
m_initCalled = true;
initializeOpenGLFunctions();
}
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
m_paintCalled = true;
glClearColor(r, g, b, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
}
- void resizeGL(int w, int h) Q_DECL_OVERRIDE {
+ void resizeGL(int w, int h) override {
m_resizeCalled = true;
m_resizeOk = w == m_w && h == m_h;
}
@@ -203,10 +203,10 @@ public:
PainterWidget(QWidget *parent)
: QOpenGLWidget(parent), m_clear(false) { }
- void initializeGL() Q_DECL_OVERRIDE {
+ void initializeGL() override {
initializeOpenGLFunctions();
}
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
QPainter p(this);
QCOMPARE(p.device()->width(), width());
QCOMPARE(p.device()->height(), height());
@@ -322,7 +322,7 @@ public:
void resetPaintCount() { m_count = 0; }
protected:
- void drawForeground(QPainter *, const QRectF &) Q_DECL_OVERRIDE;
+ void drawForeground(QPainter *, const QRectF &) override;
int m_count;
};
@@ -372,7 +372,7 @@ class PaintCountWidget : public QOpenGLWidget
public:
PaintCountWidget() : m_count(0) { }
void reset() { m_count = 0; }
- void paintGL() Q_DECL_OVERRIDE { ++m_count; }
+ void paintGL() override { ++m_count; }
int m_count;
};
@@ -393,7 +393,7 @@ void tst_QOpenGLWidget::requestUpdate()
class FboCheckWidget : public QOpenGLWidget
{
public:
- void paintGL() Q_DECL_OVERRIDE {
+ void paintGL() override {
GLuint reportedDefaultFbo = QOpenGLContext::currentContext()->defaultFramebufferObject();
GLuint expectedDefaultFbo = defaultFramebufferObject();
QCOMPARE(reportedDefaultFbo, expectedDefaultFbo);
diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
index af0ad1a601..a08a8862b8 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
@@ -870,7 +870,7 @@ void tst_QPlainTextEdit::lineWrapModes()
// QPlainTextEdit does lazy line layout on resize, only for the visible blocks.
// We thus need to make it wide enough to show something visible.
int minimumWidth = 2 * ed->document()->documentMargin();
- minimumWidth += ed->fontMetrics().width(QLatin1Char('a'));
+ minimumWidth += ed->fontMetrics().horizontalAdvance(QLatin1Char('a'));
minimumWidth += ed->frameWidth();
ed->resize(minimumWidth, 1000);
QCOMPARE(lineCount(), 26);
diff --git a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
index 9f64335930..35209c2501 100644
--- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp
@@ -293,7 +293,7 @@ void tst_QProgressBar::sizeHint()
QFontMetrics fm = bar.fontMetrics();
QStyleOptionProgressBar opt;
bar.initStyleOption(&opt);
- QSize size = QSize(9 * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8);
+ QSize size = QSize(9 * 7 + fm.horizontalAdvance(QLatin1Char('0')) * 4, fm.height() + 8);
size= bar.style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, &bar);
QSize barSize = bar.sizeHint();
QVERIFY(barSize.width() >= size.width());
diff --git a/tests/auto/widgets/widgets/qscrollbar/BLACKLIST b/tests/auto/widgets/widgets/qscrollbar/BLACKLIST
new file mode 100644
index 0000000000..277ae4d260
--- /dev/null
+++ b/tests/auto/widgets/widgets/qscrollbar/BLACKLIST
@@ -0,0 +1,3 @@
+#QTBUG-66321
+[QTBUG_42871]
+macos
diff --git a/tests/auto/widgets/widgets/qspinbox/BLACKLIST b/tests/auto/widgets/widgets/qspinbox/BLACKLIST
deleted file mode 100644
index 5bf6c3beed..0000000000
--- a/tests/auto/widgets/widgets/qspinbox/BLACKLIST
+++ /dev/null
@@ -1,3 +0,0 @@
-[editingFinished]
-osx-10.8
-osx-10.9
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
index aef4046afe..cad7bd69d7 100644
--- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
+++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp
@@ -299,7 +299,7 @@ class TestSplitterStyle : public QProxyStyle
{
public:
TestSplitterStyle() : handleWidth(5) {}
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override
{
if (metric == QStyle::PM_SplitterWidth)
return handleWidth;
@@ -658,13 +658,34 @@ public:
class EventCounterSpy : public QObject
{
public:
- EventCounterSpy(QWidget *parentWidget) : QObject(parentWidget)
+ EventCounterSpy(QWidget *obj) : objectToWatch(obj)
{ }
+ ~EventCounterSpy()
+ {
+ removeEventFilter();
+ }
+
+ void installEventFilter()
+ {
+ if (needRemoveEventFilter)
+ return;
+ needRemoveEventFilter = true;
+ qApp->installEventFilter(this);
+ }
+
+ void removeEventFilter()
+ {
+ if (!needRemoveEventFilter)
+ return;
+ needRemoveEventFilter = false;
+ qApp->removeEventFilter(this);
+ }
+
bool eventFilter(QObject *watched, QEvent *event) override
{
// Watch for events in the parent widget and all its children
- if (watched == parent() || watched->parent() == parent()) {
+ if (watched == objectToWatch || watched->parent() == objectToWatch) {
if (event->type() == QEvent::Resize)
resizeCount++;
else if (event->type() == QEvent::Paint)
@@ -676,6 +697,8 @@ public:
int resizeCount = 0;
int paintCount = 0;
+ bool needRemoveEventFilter = false;
+ QObject *objectToWatch;
};
void tst_QSplitter::replaceWidget_data()
@@ -733,31 +756,30 @@ void tst_QSplitter::replaceWidget()
// to set a shorter label.
QLabel *newWidget = new QLabel(QLatin1String("<b>NEW</b>"));
- EventCounterSpy *ef = new EventCounterSpy(&sp);
- qApp->installEventFilter(ef);
+ EventCounterSpy ef(&sp);
+ ef.installEventFilter();
const QWidget *res = sp.replaceWidget(index, newWidget);
QTest::qWait(100); // Give visibility and resizing some time
- qApp->removeEventFilter(ef);
// Check
if (index < 0 || index >= count) {
QVERIFY(!res);
QVERIFY(!newWidget->parentWidget());
- QCOMPARE(ef->resizeCount, 0);
- QCOMPARE(ef->paintCount, 0);
+ QCOMPARE(ef.resizeCount, 0);
+ QCOMPARE(ef.paintCount, 0);
} else {
QCOMPARE(res, oldWidget);
QVERIFY(!res->parentWidget());
QVERIFY(!res->isVisible());
+ const int expectedResizeCount = visible ? 1 : 0; // new widget only
+ const int expectedPaintCount = visible && !collapsed ? 2 : 0; // splitter and new widget
+ QTRY_COMPARE(ef.resizeCount, expectedResizeCount);
+ QTRY_COMPARE(ef.paintCount, expectedPaintCount);
QCOMPARE(newWidget->parentWidget(), &sp);
QCOMPARE(newWidget->isVisible(), visible);
if (visible && !collapsed)
QCOMPARE(newWidget->geometry(), oldGeom);
QCOMPARE(newWidget->size().isEmpty(), !visible || collapsed);
- const int expectedResizeCount = visible ? 1 : 0; // new widget only
- const int expectedPaintCount = visible && !collapsed ? 2 : 0; // splitter and new widget
- QCOMPARE(ef->resizeCount, expectedResizeCount);
- QCOMPARE(ef->paintCount, expectedPaintCount);
delete res;
}
QCOMPARE(sp.count(), count);
@@ -797,25 +819,24 @@ void tst_QSplitter::replaceWidgetWithSplitterChild()
const QList<int> sizes = sp.sizes();
QWidget *sibling = srcIndex == -1 ? (new QLabel("<b>NEW</b>", &sp)) : sp.widget(srcIndex);
- EventCounterSpy *ef = new EventCounterSpy(&sp);
- qApp->installEventFilter(ef);
+ EventCounterSpy ef(&sp);
+ ef.installEventFilter();
const QWidget *res = sp.replaceWidget(dstIndex, sibling);
QTest::qWait(100); // Give visibility and resizing some time
- qApp->removeEventFilter(ef);
QVERIFY(!res);
if (srcIndex == -1) {
// Create and replace before recalc. The sibling is scheduled to be
// added after replaceWidget(), when QSplitter receives a child event.
- QVERIFY(ef->resizeCount > 0);
- QVERIFY(ef->paintCount > 0);
+ QTRY_VERIFY(ef.resizeCount > 0);
+ QTRY_VERIFY(ef.paintCount > 0);
QCOMPARE(sp.count(), count + 1);
QCOMPARE(sp.sizes().mid(0, count), sizes);
QCOMPARE(sp.sizes().last(), sibling->width());
} else {
// No-op for the rest
- QCOMPARE(ef->resizeCount, 0);
- QCOMPARE(ef->paintCount, 0);
+ QCOMPARE(ef.resizeCount, 0);
+ QCOMPARE(ef.paintCount, 0);
QCOMPARE(sp.count(), count);
QCOMPARE(sp.sizes(), sizes);
}
diff --git a/tests/auto/widgets/widgets/qtabbar/BLACKLIST b/tests/auto/widgets/widgets/qtabbar/BLACKLIST
index 5a3f33e3e4..735b044d8b 100644
--- a/tests/auto/widgets/widgets/qtabbar/BLACKLIST
+++ b/tests/auto/widgets/widgets/qtabbar/BLACKLIST
@@ -1,3 +1,2 @@
[sizeHints]
-ubuntu-14.04
redhatenterpriselinuxworkstation-6.6