aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-06 09:17:24 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-06 09:17:24 +0200
commit9b6d55ddf361f14c05c2965b29184a95e3c6a989 (patch)
treea1b4327662b257f4d18541ed136062d3bc38b229 /tests
parent9a7cf067a178c7a08a7ed9f2c6253e1feade5569 (diff)
parent9530a6a8744e9eb2b4ed947b528ab7c51d8c360f (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml13
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp12
-rw-r--r--tests/auto/qml/qqmllanguage/BLACKLIST2
-rw-r--r--tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp23
-rw-r--r--tests/auto/quick/qquickdrag/tst_qquickdrag.cpp46
5 files changed, 94 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml
new file mode 100644
index 0000000000..03f90c15c8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_52340.qml
@@ -0,0 +1,13 @@
+import QtQml 2.0
+
+QtObject {
+ property bool someProperty: true
+ function testCall() {
+ try {
+ someProperty(); // should throw
+ return false
+ } catch (e) {
+ return true
+ }
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 87f9f963f9..29f81cd063 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -322,6 +322,7 @@ private slots:
void writeUnregisteredQObjectProperty();
void switchExpression();
void qtbug_46022();
+ void qtbug_52340();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -7903,6 +7904,17 @@ void tst_qqmlecmascript::qtbug_46022()
QCOMPARE(obj->property("test2").toBool(), true);
}
+void tst_qqmlecmascript::qtbug_52340()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_52340.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+ QVariant returnValue;
+ QVERIFY(QMetaObject::invokeMethod(object.data(), "testCall", Q_RETURN_ARG(QVariant, returnValue)));
+ QVERIFY(returnValue.isValid());
+ QVERIFY(returnValue.toBool());
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"
diff --git a/tests/auto/qml/qqmllanguage/BLACKLIST b/tests/auto/qml/qqmllanguage/BLACKLIST
deleted file mode 100644
index c1c7e56df9..0000000000
--- a/tests/auto/qml/qqmllanguage/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[importsPath]
-windows
diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
index 61413a73c1..b34f58f7c4 100644
--- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
+++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp
@@ -60,6 +60,7 @@ private slots:
void remote_data();
void sourceSize();
void sourceSizeChanges();
+ void sourceSizeChanges_intermediate();
void sourceSizeReadOnly();
void invalidSource();
void qtbug_16520();
@@ -370,6 +371,28 @@ void tst_qquickanimatedimage::sourceSizeChanges()
delete anim;
}
+void tst_qquickanimatedimage::sourceSizeChanges_intermediate()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.0\nAnimatedImage { readonly property int testWidth: status === AnimatedImage.Ready ? sourceSize.width : -1; source: srcImage }", QUrl::fromLocalFile(""));
+ QTRY_VERIFY(component.isReady());
+ QQmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", "");
+
+ QScopedPointer<QQuickAnimatedImage> anim(qobject_cast<QQuickAnimatedImage*>(component.create()));
+ QVERIFY(anim != 0);
+
+ ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_COMPARE(anim->property("testWidth").toInt(), anim->sourceSize().width());
+
+ ctxt->setContextProperty("srcImage", testFileUrl("hearts_copy.gif"));
+ QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready);
+ QTRY_COMPARE(anim->property("testWidth").toInt(), anim->sourceSize().width());
+}
+
+
void tst_qquickanimatedimage::qtbug_16520()
{
TestHTTPServer server;
diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
index a7b5f4943e..6a919d048e 100644
--- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
+++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp
@@ -139,6 +139,8 @@ private slots:
void cleanupTestCase();
void active();
+ void setActive_data();
+ void setActive();
void drop();
void move();
void parentChange();
@@ -374,6 +376,50 @@ void tst_QQuickDrag::active()
QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); QCOMPARE(dropTarget.moveEvents, 0);
}
+void tst_QQuickDrag::setActive_data()
+{
+ QTest::addColumn<QString>("dragType");
+
+ QTest::newRow("default") << "";
+ QTest::newRow("internal") << "Drag.dragType: Drag.Internal";
+ QTest::newRow("none") << "Drag.dragType: Drag.None";
+ /* We don't test Drag.Automatic, because that causes QDrag::exec() to be
+ * invoked, and on some platforms tha's implemented by running a main loop
+ * until the drag has finished -- and at that point, the Drag.active will
+ * be false again. */
+}
+
+// QTBUG-52540
+void tst_QQuickDrag::setActive()
+{
+ QFETCH(QString, dragType);
+
+ QQuickWindow window;
+ TestDropTarget dropTarget(window.contentItem());
+ dropTarget.setSize(QSizeF(100, 100));
+ QQmlComponent component(&engine);
+ component.setData(
+ "import QtQuick 2.0\n"
+ "Item {\n"
+ "property bool dragActive: Drag.active\n"
+ "property Item dragTarget: Drag.target\n" +
+ dragType.toUtf8() + "\n"
+ "x: 50; y: 50\n"
+ "width: 10; height: 10\n"
+ "}", QUrl());
+ QScopedPointer<QObject> object(component.create());
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
+ QVERIFY(item);
+ item->setParentItem(&dropTarget);
+
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), false);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), false);
+
+ evaluate<void>(item, "Drag.active = true");
+ QCOMPARE(evaluate<bool>(item, "Drag.active"), true);
+ QCOMPARE(evaluate<bool>(item, "dragActive"), true);
+}
+
void tst_QQuickDrag::drop()
{
QQuickWindow window;