aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qmlVarNullBinding.qml7
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h2
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp15
3 files changed, 19 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/qmlVarNullBinding.qml b/tests/auto/qml/qqmlecmascript/data/qmlVarNullBinding.qml
new file mode 100644
index 0000000000..6666b85ffd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qmlVarNullBinding.qml
@@ -0,0 +1,7 @@
+import QtQml 2.2
+
+QtObject {
+ property var foo: null
+ property bool signalSeen: false
+ onFooChanged: signalSeen = true
+}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 8d89df31db..4547a74470 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1502,7 +1502,7 @@ public:
}
break;
case Qt::OffsetFromUTC:
- m_offset = m_datetime.utcOffset() / 60;
+ m_offset = m_datetime.offsetFromUtc() / 60;
m_timespec = QString("%1%2:%3").arg(m_offset < 0 ? '-' : '+')
.arg(abs(m_offset) / 60)
.arg(abs(m_offset) % 60);
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 007ad99655..09b271c5f1 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -525,22 +525,22 @@ void tst_qqmlecmascript::exportDate_data()
QTest::newRow("UTC late") << testFileUrl("exportDate.4.qml") << QDateTime(date, late, Qt::UTC);
{
QDateTime dt(date, early, Qt::OffsetFromUTC);
- dt.setUtcOffset(offset);
+ dt.setOffsetFromUtc(offset);
QTest::newRow("+11:30 early") << testFileUrl("exportDate.5.qml") << dt;
}
{
QDateTime dt(date, late, Qt::OffsetFromUTC);
- dt.setUtcOffset(offset);
+ dt.setOffsetFromUtc(offset);
QTest::newRow("+11:30 late") << testFileUrl("exportDate.6.qml") << dt;
}
{
QDateTime dt(date, early, Qt::OffsetFromUTC);
- dt.setUtcOffset(-offset);
+ dt.setOffsetFromUtc(-offset);
QTest::newRow("-11:30 early") << testFileUrl("exportDate.7.qml") << dt;
}
{
QDateTime dt(date, late, Qt::OffsetFromUTC);
- dt.setUtcOffset(-offset);
+ dt.setOffsetFromUtc(-offset);
QTest::newRow("-11:30 late") << testFileUrl("exportDate.8.qml") << dt;
}
}
@@ -5999,6 +5999,13 @@ void tst_qqmlecmascript::nullObjectInitializer()
QVERIFY(value.userType() == qMetaTypeId<QObject*>());
QVERIFY(!value.value<QObject*>());
}
+
+ {
+ QQmlComponent component(&engine, testFileUrl("qmlVarNullBinding.qml"));
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(!obj.isNull());
+ QVERIFY(!obj->property("signalSeen").toBool());
+ }
}
// Test that bindings don't evaluate once the engine has been destroyed