aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2019-01-08 08:18:11 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2019-01-08 08:18:11 +0200
commitc2c012f79438d207cc95237c90b692121acc4876 (patch)
tree39064e5a58161a7edb4e0c63f2d43e386d1f4059 /tests
parent5208b2a671010b11b78312f9c4fe3c3098d253b4 (diff)
parent5ed082ea4ce3580134a9a0c83e6fdb81a6231c8e (diff)
Merge 5.12 into 5.12.1
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST2
-rw-r--r--tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp91
-rw-r--r--tests/auto/qml/qqmlcontext/data/Drawer.qml6
-rw-r--r--tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml6
-rw-r--r--tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp19
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp12
-rw-r--r--tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml41
-rw-r--r--tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp39
-rw-r--r--tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp4
-rw-r--r--tests/auto/quick/qquickshape/tst_qquickshape.cpp20
-rw-r--r--tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp8
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp42
-rw-r--r--tests/auto/quick/scenegraph/tst_scenegraph.cpp10
-rw-r--r--tests/auto/quick/shared/visualtestutil.cpp30
-rw-r--r--tests/auto/quick/shared/visualtestutil.h2
-rw-r--r--tests/auto/quick/touchmouse/BLACKLIST3
-rw-r--r--tests/auto/quickwidgets/qquickwidget/BLACKLIST2
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp28
18 files changed, 240 insertions, 125 deletions
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST b/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST
deleted file mode 100644
index 2afe6074d7..0000000000
--- a/tests/auto/qml/animation/qsequentialanimationgroupjob/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[finishWithUncontrolledAnimation]
-*
diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
index efd5bb571b..7c7c7d3bd0 100644
--- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
+++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp
@@ -173,8 +173,8 @@ void tst_qqmlcomponent::qmlCreateWindow()
QQmlEngine engine;
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("createWindow.qml"));
- QQuickWindow* window = qobject_cast<QQuickWindow *>(component.create());
- QVERIFY(window);
+ QScopedPointer<QQuickWindow> window(qobject_cast<QQuickWindow *>(component.create()));
+ QVERIFY(!window.isNull());
}
void tst_qqmlcomponent::qmlCreateObjectAutoParent_data()
@@ -192,8 +192,8 @@ void tst_qqmlcomponent::qmlCreateObjectAutoParent()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl(testFile));
- QQuickItem *root = qobject_cast<QQuickItem *>(component.create());
- QVERIFY(root);
+ QScopedPointer<QObject> root(qobject_cast<QQuickItem *>(component.create()));
+ QVERIFY(!root.isNull());
QObject *qtobjectParent = root->property("qtobjectParent").value<QObject*>();
QQuickItem *itemParent = qobject_cast<QQuickItem *>(root->property("itemParent").value<QObject*>());
QQuickWindow *windowParent = qobject_cast<QQuickWindow *>(root->property("windowParent").value<QObject*>());
@@ -251,45 +251,52 @@ void tst_qqmlcomponent::qmlCreateObjectWithProperties()
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("createObjectWithScript.qml"));
QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8());
- QObject *object = component.create();
- QVERIFY(object != nullptr);
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
- QObject *testObject1 = object->property("declarativerectangle").value<QObject*>();
- QVERIFY(testObject1);
- QCOMPARE(testObject1->parent(), object);
- QCOMPARE(testObject1->property("x").value<int>(), 17);
- QCOMPARE(testObject1->property("y").value<int>(), 17);
- QCOMPARE(testObject1->property("color").value<QColor>(), QColor(255,255,255));
- QCOMPARE(QQmlProperty::read(testObject1,"border.width").toInt(), 3);
- QCOMPARE(QQmlProperty::read(testObject1,"innerRect.border.width").toInt(), 20);
- delete testObject1;
-
- QObject *testObject2 = object->property("declarativeitem").value<QObject*>();
- QVERIFY(testObject2);
- QCOMPARE(testObject2->parent(), object);
- //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
- QCOMPARE(testObject2->property("x").value<int>(), 17);
- QCOMPARE(testObject2->property("y").value<int>(), 17);
- QCOMPARE(testObject2->property("testBool").value<bool>(), true);
- QCOMPARE(testObject2->property("testInt").value<int>(), 17);
- QCOMPARE(testObject2->property("testObject").value<QObject*>(), object);
- delete testObject2;
-
- QObject *testBindingObj = object->property("bindingTestObject").value<QObject*>();
- QVERIFY(testBindingObj);
- QCOMPARE(testBindingObj->parent(), object);
- QCOMPARE(testBindingObj->property("testValue").value<int>(), 300);
- object->setProperty("width", 150);
- QCOMPARE(testBindingObj->property("testValue").value<int>(), 150 * 3);
- delete testBindingObj;
-
- QObject *testBindingThisObj = object->property("bindingThisTestObject").value<QObject*>();
- QVERIFY(testBindingThisObj);
- QCOMPARE(testBindingThisObj->parent(), object);
- QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 900);
- testBindingThisObj->setProperty("width", 200);
- QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 200 * 3);
- delete testBindingThisObj;
+ {
+ QScopedPointer<QObject> testObject1(object->property("declarativerectangle")
+ .value<QObject*>());
+ QVERIFY(testObject1);
+ QCOMPARE(testObject1->parent(), object.data());
+ QCOMPARE(testObject1->property("x").value<int>(), 17);
+ QCOMPARE(testObject1->property("y").value<int>(), 17);
+ QCOMPARE(testObject1->property("color").value<QColor>(), QColor(255,255,255));
+ QCOMPARE(QQmlProperty::read(testObject1.data(),"border.width").toInt(), 3);
+ QCOMPARE(QQmlProperty::read(testObject1.data(),"innerRect.border.width").toInt(), 20);
+ }
+
+ {
+ QScopedPointer<QObject> testObject2(object->property("declarativeitem").value<QObject*>());
+ QVERIFY(testObject2);
+ QCOMPARE(testObject2->parent(), object.data());
+ //QCOMPARE(testObject2->metaObject()->className(), "QDeclarativeItem_QML_2");
+ QCOMPARE(testObject2->property("x").value<int>(), 17);
+ QCOMPARE(testObject2->property("y").value<int>(), 17);
+ QCOMPARE(testObject2->property("testBool").value<bool>(), true);
+ QCOMPARE(testObject2->property("testInt").value<int>(), 17);
+ QCOMPARE(testObject2->property("testObject").value<QObject*>(), object.data());
+ }
+
+ {
+ QScopedPointer<QObject> testBindingObj(object->property("bindingTestObject")
+ .value<QObject*>());
+ QVERIFY(testBindingObj);
+ QCOMPARE(testBindingObj->parent(), object.data());
+ QCOMPARE(testBindingObj->property("testValue").value<int>(), 300);
+ object->setProperty("width", 150);
+ QCOMPARE(testBindingObj->property("testValue").value<int>(), 150 * 3);
+ }
+
+ {
+ QScopedPointer<QObject> testBindingThisObj(object->property("bindingThisTestObject")
+ .value<QObject*>());
+ QVERIFY(testBindingThisObj);
+ QCOMPARE(testBindingThisObj->parent(), object.data());
+ QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 900);
+ testBindingThisObj->setProperty("width", 200);
+ QCOMPARE(testBindingThisObj->property("testValue").value<int>(), 200 * 3);
+ }
}
void tst_qqmlcomponent::qmlCreateParentReference()
diff --git a/tests/auto/qml/qqmlcontext/data/Drawer.qml b/tests/auto/qml/qqmlcontext/data/Drawer.qml
new file mode 100644
index 0000000000..b35d5c8d34
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/Drawer.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.12
+import QtQuick.Window 2.11
+
+Rectangle {
+ parent: Window.contentItem
+}
diff --git a/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml b/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml
new file mode 100644
index 0000000000..91978d98a0
--- /dev/null
+++ b/tests/auto/qml/qqmlcontext/data/contextObjectHierarchy.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.6
+import QtQuick.Window 2.2
+
+Window {
+ Drawer {}
+}
diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
index 5838193a6b..cb4bee0d3a 100644
--- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
+++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp
@@ -70,6 +70,7 @@ private slots:
void contextLeak();
void outerContextObject();
+ void contextObjectHierarchy();
private:
QQmlEngine engine;
@@ -873,6 +874,24 @@ void tst_qqmlcontext::outerContextObject()
QTRY_VERIFY(iterations >= 100);
}
+void tst_qqmlcontext::contextObjectHierarchy()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("contextObjectHierarchy.qml"));
+ QVERIFY(component.isReady());
+ QScopedPointer<QObject> root(component.create());
+ QVERIFY(!root.isNull());
+
+ for (const QObject *child : root->children())
+ QVERIFY(QQmlData::get(child)->outerContext != nullptr);
+
+ connect(root.data(), &QObject::destroyed, [&root]() {
+ for (const QObject *child : root->children())
+ QCOMPARE(QQmlData::get(child)->outerContext, nullptr);
+ });
+}
+
QTEST_MAIN(tst_qqmlcontext)
#include "tst_qqmlcontext.moc"
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 71c4e03812..085cd5ffd0 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -360,6 +360,7 @@ private slots:
void importLexicalVariables_data();
void importLexicalVariables();
void hugeObject();
+ void templateStringTerminator();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -8463,7 +8464,8 @@ void tst_qqmlecmascript::stringify_qtbug_50592()
QScopedPointer<QObject> obj(component.create());
QVERIFY(obj != nullptr);
- QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png"));
+ QCOMPARE(obj->property("source").toString(),
+ QString::fromLatin1("\"http://example.org/some_nonexistant_image.png\""));
}
// Tests for the JS-only instanceof. Tests for the QML extensions for
@@ -8858,6 +8860,14 @@ void tst_qqmlecmascript::hugeObject()
QVERIFY(!v.isError());
}
+void tst_qqmlecmascript::templateStringTerminator()
+{
+ QJSEngine engine;
+ const QJSValue value = engine.evaluate("let a = 123; let b = `x${a}\ny^`; b;");
+ QVERIFY(!value.isError());
+ QCOMPARE(value.toString(), QLatin1String("x123\ny^"));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml b/tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml
new file mode 100644
index 0000000000..aea01c154c
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/data/rightTapHandler.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Rectangle {
+ width: 320
+ height: 240
+ color: rightTap.pressed ? "tomato" : "beige"
+ TapHandler {
+ id: rightTap
+ objectName: "right button TapHandler"
+ longPressThreshold: 0.5
+ acceptedButtons: Qt.RightButton
+ }
+}
diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
index 187ade58d5..33cea69147 100644
--- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
@@ -70,6 +70,7 @@ private slots:
void mouseLongPress();
void buttonsMultiTouch();
void componentUserBehavioralOverride();
+ void rightLongPressIgnoreWheel();
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
@@ -676,6 +677,44 @@ void tst_TapHandler::componentUserBehavioralOverride()
QCOMPARE(userGrabChangedSpy.count(), 2);
}
+void tst_TapHandler::rightLongPressIgnoreWheel()
+{
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "rightTapHandler.qml");
+ QQuickView * window = windowPtr.data();
+
+ QQuickTapHandler *tap = window->rootObject()->findChild<QQuickTapHandler*>();
+ QVERIFY(tap);
+ QSignalSpy tappedSpy(tap, SIGNAL(tapped(QQuickEventPoint *)));
+ QSignalSpy longPressedSpy(tap, SIGNAL(longPressed()));
+ QPoint p1(100, 100);
+
+ // Mouse wheel with ScrollBegin phase (because as soon as two fingers are touching
+ // the trackpad, it will send such an event: QTBUG-71955)
+ {
+ QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0),
+ Qt::NoButton, Qt::NoModifier, Qt::ScrollBegin, false, Qt::MouseEventNotSynthesized);
+ QGuiApplication::sendEvent(window, &wheelEvent);
+ }
+
+ // Press
+ QTest::mousePress(window, Qt::RightButton, Qt::NoModifier, p1);
+ QTRY_COMPARE(tap->isPressed(), true);
+
+ // Mouse wheel ScrollEnd phase
+ QWheelEvent wheelEvent(p1, p1, QPoint(0, 0), QPoint(0, 0),
+ Qt::NoButton, Qt::NoModifier, Qt::ScrollEnd, false, Qt::MouseEventNotSynthesized);
+ QGuiApplication::sendEvent(window, &wheelEvent);
+ QTRY_COMPARE(longPressedSpy.count(), 1);
+ QCOMPARE(tap->isPressed(), true);
+ QCOMPARE(tappedSpy.count(), 0);
+
+ // Release
+ QTest::mouseRelease(window, Qt::RightButton, Qt::NoModifier, p1, 500);
+ QTRY_COMPARE(tap->isPressed(), false);
+ QCOMPARE(tappedSpy.count(), 0);
+}
+
QTEST_MAIN(tst_TapHandler)
#include "tst_qquicktaphandler.moc"
diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
index 02e89ba0a7..9292e1886a 100644
--- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
+++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp
@@ -596,7 +596,9 @@ void tst_qquickborderimage::borderImageMesh()
window->setSource(testFileUrl("mesh.qml"));
QImage mesh = window->grabWindow();
- QVERIFY(QQuickVisualTestUtil::compareImages(mesh, nonmesh));
+ QString errorMessage;
+ QVERIFY2(QQuickVisualTestUtil::compareImages(mesh, nonmesh, &errorMessage),
+ qPrintable(errorMessage));
}
#endif
QTEST_MAIN(tst_qquickborderimage)
diff --git a/tests/auto/quick/qquickshape/tst_qquickshape.cpp b/tests/auto/quick/qquickshape/tst_qquickshape.cpp
index 3206129e72..61fb260612 100644
--- a/tests/auto/quick/qquickshape/tst_qquickshape.cpp
+++ b/tests/auto/quick/qquickshape/tst_qquickshape.cpp
@@ -233,7 +233,10 @@ void tst_QQuickShape::render()
QImage refImg(testFileUrl("pathitem3.png").toLocalFile());
QVERIFY(!refImg.isNull());
- QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg));
+ QString errorMessage;
+ const QImage actualImg = img.convertToFormat(refImg.format());
+ QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ qPrintable(errorMessage));
}
void tst_QQuickShape::renderWithMultipleSp()
@@ -254,7 +257,10 @@ void tst_QQuickShape::renderWithMultipleSp()
QImage refImg(testFileUrl("pathitem4.png").toLocalFile());
QVERIFY(!refImg.isNull());
- QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg));
+ QString errorMessage;
+ const QImage actualImg = img.convertToFormat(refImg.format());
+ QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ qPrintable(errorMessage));
}
void tst_QQuickShape::radialGrad()
@@ -275,7 +281,10 @@ void tst_QQuickShape::radialGrad()
QImage refImg(testFileUrl("pathitem5.png").toLocalFile());
QVERIFY(!refImg.isNull());
- QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg));
+ QString errorMessage;
+ const QImage actualImg = img.convertToFormat(refImg.format());
+ QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ qPrintable(errorMessage));
}
void tst_QQuickShape::conicalGrad()
@@ -296,7 +305,10 @@ void tst_QQuickShape::conicalGrad()
QImage refImg(testFileUrl("pathitem6.png").toLocalFile());
QVERIFY(!refImg.isNull());
- QVERIFY(QQuickVisualTestUtil::compareImages(img.convertToFormat(refImg.format()), refImg));
+ QString errorMessage;
+ const QImage actualImg = img.convertToFormat(refImg.format());
+ QVERIFY2(QQuickVisualTestUtil::compareImages(actualImg, refImg, &errorMessage),
+ qPrintable(errorMessage));
}
QTEST_MAIN(tst_QQuickShape)
diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp
index 6ca5ad2653..88b0e95e0a 100644
--- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp
+++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp
@@ -44,7 +44,8 @@ public:
Bold = 0x01,
Underline = 0x02,
Italic = 0x04,
- Anchor = 0x08
+ Anchor = 0x08,
+ StrikeOut = 0x10
};
Format(int t, int s, int l)
: type(t), start(s), length(l) {}
@@ -92,6 +93,10 @@ void tst_qquickstyledtext::textOutput_data()
QTest::newRow("underline") << "<u>underline</u>" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false;
QTest::newRow("strong") << "<strong>strong</strong>" << "strong" << (FormatList() << Format(Format::Bold, 0, 6)) << false;
QTest::newRow("underline") << "<u>underline</u>" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false;
+ QTest::newRow("strike out s") << "<s>strike out</s>" << "strike out" << (FormatList() << Format(Format::StrikeOut, 0, 10)) << false;
+ QTest::newRow("strike out del") << "<del>strike out</del>" << "strike out" << (FormatList() << Format(Format::StrikeOut, 0, 10)) << false;
+ QTest::newRow("strike out not s") << "this is <s>not</s> a test" << "this is not a test" << (FormatList() << Format(Format::StrikeOut, 8, 3)) << false;
+ QTest::newRow("strike out not del") << "this is <del>not</del> a test" << "this is not a test" << (FormatList() << Format(Format::StrikeOut, 8, 3)) << false;
QTest::newRow("missing >") << "<b>text</b" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
QTest::newRow("missing b>") << "<b>text</" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
QTest::newRow("missing /b>") << "<b>text<" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false;
@@ -178,6 +183,7 @@ void tst_qquickstyledtext::textOutput()
QCOMPARE(layoutFormats.at(i).format.fontWeight(), int(QFont::Normal));
QVERIFY(layoutFormats.at(i).format.fontItalic() == bool(formats.at(i).type & Format::Italic));
QVERIFY(layoutFormats.at(i).format.fontUnderline() == bool(formats.at(i).type & Format::Underline));
+ QVERIFY(layoutFormats.at(i).format.fontStrikeOut() == bool(formats.at(i).type & Format::StrikeOut));
}
QCOMPARE(fontSizeModified, modifiesFontSize);
}
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 578ae56cca..ab101dc1be 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -1506,44 +1506,6 @@ void tst_qquickwindow::animationsWhileHidden()
QTRY_VERIFY(window->isVisible());
}
-// When running on native Nvidia graphics cards on linux, the
-// distance field glyph pixels have a measurable, but not visible
-// pixel error. Use a custom compare function to avoid
-//
-// This was GT-216 with the ubuntu "nvidia-319" driver package.
-// llvmpipe does not show the same issue.
-//
-bool compareImages(const QImage &ia, const QImage &ib)
-{
- if (ia.size() != ib.size())
- qDebug() << "images are of different size" << ia.size() << ib.size();
- Q_ASSERT(ia.size() == ib.size());
- Q_ASSERT(ia.format() == ib.format());
-
- int w = ia.width();
- int h = ia.height();
- const int tolerance = 5;
- for (int y=0; y<h; ++y) {
- const uint *as= (const uint *) ia.constScanLine(y);
- const uint *bs= (const uint *) ib.constScanLine(y);
- for (int x=0; x<w; ++x) {
- uint a = as[x];
- uint b = bs[x];
-
- // No tolerance for error in the alpha.
- if ((a & 0xff000000) != (b & 0xff000000))
- return false;
- if (qAbs(qRed(a) - qRed(b)) > tolerance)
- return false;
- if (qAbs(qRed(a) - qRed(b)) > tolerance)
- return false;
- if (qAbs(qRed(a) - qRed(b)) > tolerance)
- return false;
- }
- }
- return true;
-}
-
void tst_qquickwindow::headless()
{
QQmlEngine engine;
@@ -1597,7 +1559,9 @@ void tst_qquickwindow::headless()
// Verify that the visual output is the same
QImage newContent = window->grabWindow();
- QVERIFY(compareImages(newContent, originalContent));
+ QString errorMessage;
+ QVERIFY2(QQuickVisualTestUtil::compareImages(newContent, originalContent, &errorMessage),
+ qPrintable(errorMessage));
}
void tst_qquickwindow::noUpdateWhenNothingChanges()
diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
index 2479450287..063358c795 100644
--- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp
+++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp
@@ -264,6 +264,7 @@ void tst_SceneGraph::manyWindows()
const int COUNT = 4;
QImage baseLine;
+ QString errorMessage;
for (int i=0; i<COUNT; ++i) {
views << createView(file, parent.data(), (i % 2) * 100, (i / 2) * 100, 100, 100);
}
@@ -275,7 +276,8 @@ void tst_SceneGraph::manyWindows()
baseLine = content;
QVERIFY(containsSomethingOtherThanWhite(baseLine));
} else {
- QVERIFY(compareImages(content, baseLine));
+ QVERIFY2(compareImages(content, baseLine, &errorMessage),
+ qPrintable(errorMessage));
}
}
@@ -284,7 +286,8 @@ void tst_SceneGraph::manyWindows()
QQuickView *last = createView(file, parent.data(), 100, 100, 100, 100);
QVERIFY(QTest::qWaitForWindowExposed(last));
views << last;
- QVERIFY(compareImages(baseLine, last->grabWindow()));
+ QVERIFY2(compareImages(baseLine, last->grabWindow(), &errorMessage),
+ qPrintable(errorMessage));
// Wipe and recreate all
qDeleteAll(views);
@@ -297,7 +300,8 @@ void tst_SceneGraph::manyWindows()
QQuickView *view = views.at(i);
QVERIFY(QTest::qWaitForWindowExposed(view));
QImage content = view->grabWindow();
- QVERIFY(compareImages(content, baseLine));
+ QVERIFY2(compareImages(content, baseLine, &errorMessage),
+ qPrintable(errorMessage));
}
}
diff --git a/tests/auto/quick/shared/visualtestutil.cpp b/tests/auto/quick/shared/visualtestutil.cpp
index eabfe5368b..de2cf2bd5b 100644
--- a/tests/auto/quick/shared/visualtestutil.cpp
+++ b/tests/auto/quick/shared/visualtestutil.cpp
@@ -66,12 +66,18 @@ void QQuickVisualTestUtil::dumpTree(QQuickItem *parent, int depth)
// distance field glyph pixels have a measurable, but not visible
// pixel error. This was GT-216 with the ubuntu "nvidia-319" driver package.
// llvmpipe does not show the same issue.
-bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib)
+
+bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib, QString *errorMessage)
{
- if (ia.size() != ib.size())
- qDebug() << "images are of different size" << ia.size() << ib.size();
- Q_ASSERT(ia.size() == ib.size());
- Q_ASSERT(ia.format() == ib.format());
+ if (ia.size() != ib.size()) {
+ QDebug(errorMessage) << "Images are of different size:" << ia.size() << ib.size()
+ << "DPR:" << ia.devicePixelRatio() << ib.devicePixelRatio();
+ return false;
+ }
+ if (ia.format() != ib.format()) {
+ QDebug(errorMessage) << "Images are of different formats:" << ia.format() << ib.format();
+ return false;
+ }
int w = ia.width();
int h = ia.height();
@@ -84,14 +90,14 @@ bool QQuickVisualTestUtil::compareImages(const QImage &ia, const QImage &ib)
uint b = bs[x];
// No tolerance for error in the alpha.
- if ((a & 0xff000000) != (b & 0xff000000))
- return false;
- if (qAbs(qRed(a) - qRed(b)) > tolerance)
- return false;
- if (qAbs(qRed(a) - qRed(b)) > tolerance)
- return false;
- if (qAbs(qRed(a) - qRed(b)) > tolerance)
+ if ((a & 0xff000000) != (b & 0xff000000)
+ || qAbs(qRed(a) - qRed(b)) > tolerance
+ || qAbs(qRed(a) - qRed(b)) > tolerance
+ || qAbs(qRed(a) - qRed(b)) > tolerance) {
+ QDebug(errorMessage) << "Mismatch at:" << x << y << ':'
+ << hex << showbase << a << b;
return false;
+ }
}
}
return true;
diff --git a/tests/auto/quick/shared/visualtestutil.h b/tests/auto/quick/shared/visualtestutil.h
index 2daf86cd83..1cdbaf838b 100644
--- a/tests/auto/quick/shared/visualtestutil.h
+++ b/tests/auto/quick/shared/visualtestutil.h
@@ -97,7 +97,7 @@ namespace QQuickVisualTestUtil
return items;
}
- bool compareImages(const QImage &ia, const QImage &ib);
+ bool compareImages(const QImage &ia, const QImage &ib, QString *errorMessage);
}
#define QQUICK_VERIFY_POLISH(item) \
diff --git a/tests/auto/quick/touchmouse/BLACKLIST b/tests/auto/quick/touchmouse/BLACKLIST
index e0d4bff131..b2ba52eca9 100644
--- a/tests/auto/quick/touchmouse/BLACKLIST
+++ b/tests/auto/quick/touchmouse/BLACKLIST
@@ -1,5 +1,2 @@
-# QTBUG-40856 hover regression on pointerhandler branch: TODO fix before merging to dev
-[hoverEnabled]
-*
[buttonOnDelayedPressFlickable]
windows gcc developer-build
diff --git a/tests/auto/quickwidgets/qquickwidget/BLACKLIST b/tests/auto/quickwidgets/qquickwidget/BLACKLIST
deleted file mode 100644
index 6594a22472..0000000000
--- a/tests/auto/quickwidgets/qquickwidget/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[enterLeave]
-osx
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 24e55e3b3a..42dc766a13 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -160,7 +160,7 @@ void tst_qquickwidget::showHide()
childView->setSource(testFileUrl("rectangle.qml"));
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
QVERIFY(childView->quickWindow()->isVisible());
QVERIFY(childView->quickWindow()->visibility() != QWindow::Hidden);
@@ -176,13 +176,13 @@ void tst_qquickwidget::reparentAfterShow()
QQuickWidget *childView = new QQuickWidget(&window);
childView->setSource(testFileUrl("rectangle.qml"));
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
QScopedPointer<QQuickWidget> toplevelView(new QQuickWidget);
toplevelView->setParent(&window);
toplevelView->setSource(testFileUrl("rectangle.qml"));
toplevelView->show();
- QVERIFY(QTest::qWaitForWindowExposed(&window, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
}
void tst_qquickwidget::changeGeometry()
@@ -193,7 +193,7 @@ void tst_qquickwidget::changeGeometry()
childView->setSource(testFileUrl("rectangle.qml"));
window.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
childView->setGeometry(100,100,100,100);
}
@@ -373,7 +373,7 @@ void tst_qquickwidget::readback()
view->setSource(testFileUrl("rectangle.qml"));
view->show();
- QVERIFY(QTest::qWaitForWindowExposed(view.data(), 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(view.data()));
QImage img = view->grabFramebuffer();
QVERIFY(!img.isNull());
@@ -409,7 +409,7 @@ void tst_qquickwidget::renderingSignals()
QCOMPARE(afterRenderingSpy.size(), 0);
widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(&widget, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
QTRY_VERIFY(beforeRenderingSpy.size() > 0);
QTRY_VERIFY(beforeSyncSpy.size() > 0);
@@ -441,9 +441,9 @@ void tst_qquickwidget::reparentToNewWindow()
QQuickWidget *qqw = new QQuickWidget(&window1);
qqw->setSource(testFileUrl("rectangle.qml"));
window1.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window1, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&window1));
window2.show();
- QVERIFY(QTest::qWaitForWindowExposed(&window2, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&window2));
QSignalSpy afterRenderingSpy(qqw->quickWindow(), &QQuickWindow::afterRendering);
qqw->setParent(&window2);
@@ -488,7 +488,7 @@ void tst_qquickwidget::keyEvents()
KeyHandlingWidget widget;
widget.setSource(testFileUrl("rectangle.qml"));
widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(widget.window(), 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(widget.window()));
// Note: send the event to the QWindow, not the QWidget, in order
// to simulate the full event processing chain.
@@ -516,7 +516,7 @@ void tst_qquickwidget::shortcuts()
KeyHandlingWidget widget;
widget.setSource(testFileUrl("rectangle.qml"));
widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(widget.window(), 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(widget.window()));
// Send to the widget, verify that the QQuickWindow sees it.
@@ -534,14 +534,14 @@ void tst_qquickwidget::enterLeave()
QQuickWidget view;
view.setSource(testFileUrl("enterleave.qml"));
- // Ensure it is not inside the window first
+ // Ensure the cursor is away from the window first
const auto outside = m_availableGeometry.topLeft() + QPoint(50, 50);
QCursor::setPos(outside);
QTRY_VERIFY(QCursor::pos() == outside);
view.move(m_availableGeometry.topLeft() + QPoint(100, 100));
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&view));
QQuickItem *rootItem = view.rootObject();
QVERIFY(rootItem);
const QPoint frameOffset = view.geometry().topLeft() - view.frameGeometry().topLeft();
@@ -551,7 +551,7 @@ void tst_qquickwidget::enterLeave()
QCursor::setPos(view.pos() + QPoint(50, 50) + frameOffset);
QTRY_VERIFY(rootItem->property("hasMouse").toBool());
// Now check the leave
- QCursor::setPos(view.pos() - QPoint(50, 50));
+ QCursor::setPos(outside);
QTRY_VERIFY(!rootItem->property("hasMouse").toBool());
}
@@ -563,7 +563,7 @@ void tst_qquickwidget::mouseEventWindowPos()
quick->setSource(testFileUrl("mouse.qml"));
quick->move(50, 50);
widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(&widget, 5000));
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
QQuickItem *rootItem = quick->rootObject();
QVERIFY(rootItem);