aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-15 10:55:46 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-15 10:57:49 +0100
commit365a3ac6ae50eb53253eca92bfdf4c527b3a5c05 (patch)
treec6fa0bf4ccf698fa75e2ebc245f95e424438b13a /tests/auto
parentdaa866a196962beb6171f847bd6f691f3ae38300 (diff)
parent8ff69297eeddc3f5650c4cc5517c7e2eafaf6c59 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/qmldevtools/qmldevtools.pro tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp Change-Id: I12255c16716bd8a74e7047cdb1f9302a4d1ea827
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp27
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.h2
-rw-r--r--tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml9
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp27
-rw-r--r--tests/auto/qml/qqmlecmascript/qqmlecmascript.pro5
5 files changed, 70 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
index 859caf72c7..58f0344c58 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -1366,6 +1366,33 @@ void tst_QJSValue::hasProperty_changePrototype()
QVERIFY(obj.hasOwnProperty("foo"));
}
+void tst_QJSValue::hasProperty_QTBUG56830_data()
+{
+ QTest::addColumn<QString>("key");
+ QTest::addColumn<QString>("lookup");
+
+ QTest::newRow("bugreport-1") << QStringLiteral("240000000000") << QStringLiteral("3776798720");
+ QTest::newRow("bugreport-2") << QStringLiteral("240000000001") << QStringLiteral("3776798721");
+ QTest::newRow("biggest-ok-before-bug") << QStringLiteral("238609294221") << QStringLiteral("2386092941");
+ QTest::newRow("smallest-bugged") << QStringLiteral("238609294222") << QStringLiteral("2386092942");
+ QTest::newRow("biggest-bugged") << QStringLiteral("249108103166") << QStringLiteral("12884901886");
+ QTest::newRow("smallest-ok-after-bug") << QStringLiteral("249108103167") << QStringLiteral("12884901887");
+}
+
+void tst_QJSValue::hasProperty_QTBUG56830()
+{
+ QFETCH(QString, key);
+ QFETCH(QString, lookup);
+
+ QJSEngine eng;
+ const QJSValue value(42);
+
+ QJSValue obj = eng.newObject();
+ obj.setProperty(key, value);
+ QVERIFY(obj.hasProperty(key));
+ QVERIFY(!obj.hasProperty(lookup));
+}
+
void tst_QJSValue::deleteProperty_basic()
{
QJSEngine eng;
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.h b/tests/auto/qml/qjsvalue/tst_qjsvalue.h
index 6ed880c865..b8b9f4403c 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.h
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.h
@@ -92,6 +92,8 @@ private slots:
void hasProperty_basic();
void hasProperty_globalObject();
void hasProperty_changePrototype();
+ void hasProperty_QTBUG56830_data();
+ void hasProperty_QTBUG56830();
void deleteProperty_basic();
void deleteProperty_globalObject();
diff --git a/tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml b/tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml
new file mode 100644
index 0000000000..d5aa0f102a
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/test-connection-implicit.qml
@@ -0,0 +1,9 @@
+import QtQuick 2.0
+
+Item {
+ width: 50
+
+ property bool tested: false
+
+ Connections { onWidthChanged: tested = true }
+}
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index 615de0885a..b3ac1ce958 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -52,6 +52,7 @@ private slots:
void rewriteErrors();
void singletonTypeTarget();
void enableDisable_QTBUG_36350();
+ void clearImplicitTarget();
private:
QQmlEngine engine;
@@ -352,6 +353,32 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350()
delete item;
}
+//QTBUG-56499
+void tst_qqmlconnections::clearImplicitTarget()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("test-connection-implicit.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+
+ QVERIFY(item != 0);
+
+ // normal case: fire Connections
+ item->setWidth(100.);
+ QCOMPARE(item->property("tested").toBool(), true);
+
+ item->setProperty("tested", false);
+ // clear the implicit target
+ QQmlConnections *connections = item->findChild<QQmlConnections*>();
+ QVERIFY(connections);
+ connections->setTarget(0);
+
+ // target cleared: no longer fire Connections
+ item->setWidth(150.);
+ QCOMPARE(item->property("tested").toBool(), false);
+
+ delete item;
+}
+
QTEST_MAIN(tst_qqmlconnections)
#include "tst_qqmlconnections.moc"
diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
index 101181bba0..684e7adb98 100644
--- a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
+++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro
@@ -13,6 +13,11 @@ RESOURCES += qqmlecmascript.qrc
include (../../shared/util.pri)
+greaterThan(QT_GCC_MAJOR_VERSION, 5) {
+ # Our code is bad. Temporary workaround. Fixed in 5.8
+ QMAKE_CXXFLAGS += -fno-delete-null-pointer-checks -fno-lifetime-dse
+}
+
# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
# LIBS += -lgcov