aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-13 01:01:04 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-03-13 10:10:09 +0100
commit76be4abbbcfb2fbb14ce532413e0895198e7f0f1 (patch)
tree5d6ca9c4425df15a93b6f74dc8e4dbb38db74d91 /tests/auto
parent587d789fa5929f462b5744ba33a25db6c77b36fc (diff)
parent70d726e91e4ef27002b2271805de19077e25809c (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/animations/qsequentialanimationgroupjob.cpp Change-Id: I8b76e509fd7c8599d4cef25181d790ee28edab54
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp7
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp38
-rw-r--r--tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp5
-rw-r--r--tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml64
-rw-r--r--tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp19
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml2
-rw-r--r--tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp37
-rw-r--r--tests/auto/quick/qquickshortcut/BLACKLIST7
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp5
9 files changed, 179 insertions, 5 deletions
diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
index 974357dc8e..6bd8c2a2e0 100644
--- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
+++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp
@@ -261,15 +261,18 @@ void tst_QAnimationGroupJob::addChildTwice()
{
QAbstractAnimationJob *subGroup;
QAbstractAnimationJob *subGroup2;
- QAnimationGroupJob *parent = new QSequentialAnimationGroupJob();
+ auto *parent = new QSequentialAnimationGroupJob();
subGroup = new QAbstractAnimationJob;
parent->appendAnimation(subGroup);
parent->appendAnimation(subGroup);
- QVERIFY(parent->firstChild() && !parent->firstChild()->nextSibling());
+ QVERIFY(parent->firstChild());
+ QVERIFY(!parent->firstChild()->nextSibling());
+ QVERIFY(!parent->firstChild()->previousSibling());
parent->clear();
+ QCOMPARE(parent->currentAnimation(), nullptr);
QVERIFY(!parent->firstChild());
// adding the same item twice to a group will remove the item from its current position
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index eaf60aec38..fdef1c0956 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -361,6 +361,9 @@ private slots:
void importLexicalVariables();
void hugeObject();
void templateStringTerminator();
+ void arrayAndException();
+ void numberToStringWithRadix();
+ void tailCallWithArguments();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -8876,6 +8879,41 @@ void tst_qqmlecmascript::templateStringTerminator()
QCOMPARE(value.toString(), QLatin1String("x123\ny^"));
}
+void tst_qqmlecmascript::arrayAndException()
+{
+ QJSEngine engine;
+ const QJSValue value = engine.evaluate("[...[],[,,$]]");
+ // Should not crash
+ QVERIFY(value.isError());
+}
+
+void tst_qqmlecmascript::numberToStringWithRadix()
+{
+ QJSEngine engine;
+ {
+ const QJSValue value = engine.evaluate(".5.toString(5)");
+ QVERIFY(!value.isError());
+ QVERIFY(value.toString().startsWith("0.2222222222"));
+ }
+ {
+ const QJSValue value = engine.evaluate(".05.toString(5)");
+ QVERIFY(!value.isError());
+ QVERIFY(value.toString().startsWith("0.01111111111"));
+ }
+}
+
+void tst_qqmlecmascript::tailCallWithArguments()
+{
+ QJSEngine engine;
+ const QJSValue value = engine.evaluate(
+ "'use strict';\n"
+ "[[1, 2]].map(function (a) {\n"
+ " return (function() { return Math.min.apply(this, arguments); })(a[0], a[1]);\n"
+ "})[0];");
+ QVERIFY(!value.isError());
+ QCOMPARE(value.toInt(), 1);
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp
index 2511eebefe..341a49bf09 100644
--- a/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp
+++ b/tests/auto/qml/qqmlextensionplugin/tst_qqmlextensionplugin.cpp
@@ -109,7 +109,10 @@ void tst_qqmlextensionplugin::iidCheck()
if (qobject_cast<QQmlExtensionPlugin *>(loader.instance())) {
QString iid = loader.metaData().value(QStringLiteral("IID")).toString();
- QCOMPARE(iid, QLatin1String(QQmlExtensionInterface_iid));
+ if (iid == QLatin1String(QQmlExtensionInterface_iid_old))
+ qWarning() << "Old extension plugin found. Update the IID" << loader.metaData();
+ else
+ QCOMPARE(iid, QLatin1String(QQmlExtensionInterface_iid));
}
}
diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml
new file mode 100644
index 0000000000..1bd20c6bcb
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/data/unloadHandlerOnPress.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 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
+
+Item {
+ width: 640
+ height: 480
+
+ Loader {
+ id: loader
+
+ width: 480
+ height: 480
+
+ sourceComponent: Rectangle {
+ id: item2
+ anchors.fill: parent
+ color: "blue"
+
+ DragHandler{}
+ }
+ }
+
+ Rectangle {
+ color: "yellow"
+ width: 180
+ height: 180
+
+ MultiPointTouchArea {
+ anchors.fill: parent
+ touchPoints: [
+ TouchPoint { onPressedChanged: loader.sourceComponent = undefined }
+ ]
+ }
+ }
+}
+
+
diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
index b994e0fc07..bf582b820b 100644
--- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
+++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
@@ -55,6 +55,7 @@ private slots:
void touchDrag();
void touchesThenPinch();
+ void unloadHandlerWithPassiveGrab();
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
@@ -282,6 +283,24 @@ void tst_MptaInterop::touchesThenPinch()
QTRY_COMPARE(mptaReleasedSpy.count(), 1);
}
+void tst_MptaInterop::unloadHandlerWithPassiveGrab()
+{
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "unloadHandlerOnPress.qml");
+ QQuickView * window = windowPtr.data();
+
+ QPointer<QQuickPointerHandler> handler = window->rootObject()->findChild<QQuickPointerHandler*>();
+ QVERIFY(handler);
+ QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>();
+ QVERIFY(mpta);
+
+ QPoint point(90, 90);
+ QTest::mousePress(window, Qt::LeftButton, 0, point);
+ QCOMPARE(window->mouseGrabberItem(), mpta);
+ QTRY_VERIFY(handler.isNull()); // it got unloaded
+ QTest::mouseRelease(window, Qt::LeftButton, 0, point); // QTBUG-73819: don't crash
+}
+
QTEST_MAIN(tst_MptaInterop)
#include "tst_multipointtoucharea_interop.moc"
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml
index 9045247e94..011dc4e75f 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/data/lesHoverables.qml
@@ -90,7 +90,7 @@ Rectangle {
id: paddle
objectName: "paddle"
width: 100
- height: 40
+ height: 100
color: paddleHH.hovered ? "indianred" : "#888"
x: (parent.width - width) / 2
y: parent.height - 100
diff --git a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
index 52074aec4f..f141a2546c 100644
--- a/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickhoverhandler/tst_qquickhoverhandler.cpp
@@ -60,6 +60,7 @@ private slots:
void hoverHandlerAndUnderlyingHoverHandler();
void mouseAreaAndUnderlyingHoverHandler();
void hoverHandlerAndUnderlyingMouseArea();
+ void movingItemWithHoverHandler();
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
@@ -229,6 +230,42 @@ void tst_HoverHandler::hoverHandlerAndUnderlyingMouseArea()
QCOMPARE(buttonHoveredSpy.count(), 2);
}
+void tst_HoverHandler::movingItemWithHoverHandler()
+{
+ if (isPlatformWayland())
+ QSKIP("Wayland: QCursor::setPos() doesn't work.");
+
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "lesHoverables.qml");
+ QQuickView * window = windowPtr.data();
+ QQuickItem * paddle = window->rootObject()->findChild<QQuickItem *>("paddle");
+ QVERIFY(paddle);
+ QQuickHoverHandler *paddleHH = paddle->findChild<QQuickHoverHandler *>("paddleHH");
+ QVERIFY(paddleHH);
+
+ // Find the global coordinate of the paddle
+ const QPoint p(paddle->mapToScene(paddle->clipRect().center()).toPoint());
+ const QPoint paddlePos = window->mapToGlobal(p);
+
+ // Now hide the window, put the cursor where the paddle was and show it again
+ window->hide();
+ QTRY_COMPARE(window->isVisible(), false);
+ QCursor::setPos(paddlePos);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+
+ QTRY_COMPARE(paddleHH->isHovered(), true);
+
+ paddle->setX(100);
+ QTRY_COMPARE(paddleHH->isHovered(), false);
+
+ paddle->setX(p.x());
+ QTRY_COMPARE(paddleHH->isHovered(), true);
+
+ paddle->setX(540);
+ QTRY_COMPARE(paddleHH->isHovered(), false);
+}
+
QTEST_MAIN(tst_HoverHandler)
#include "tst_qquickhoverhandler.moc"
diff --git a/tests/auto/quick/qquickshortcut/BLACKLIST b/tests/auto/quick/qquickshortcut/BLACKLIST
new file mode 100644
index 0000000000..ba7871dc2d
--- /dev/null
+++ b/tests/auto/quick/qquickshortcut/BLACKLIST
@@ -0,0 +1,7 @@
+# QTBUG-74050
+[shortcuts]
+opensuse-42.3
+
+# QTBUG-74050
+[multiple]
+opensuse-42.3
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 42dc766a13..aaf37b32cd 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -569,7 +569,10 @@ void tst_qquickwidget::mouseEventWindowPos()
QVERIFY(!rootItem->property("wasClicked").toBool());
QVERIFY(!rootItem->property("wasDoubleClicked").toBool());
- QVERIFY(!rootItem->property("wasMoved").toBool());
+ // Moving an item under the mouse cursor will trigger a mouse move event.
+ // The above quick->move() will trigger a mouse move event on macOS.
+ // Discard that in order to get a clean slate for the actual tests.
+ rootItem->setProperty("wasMoved", QVariant(false));
QWindow *window = widget.windowHandle();
QVERIFY(window);