aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/nans.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp15
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/nans.qml b/tests/auto/qml/qqmlecmascript/data/nans.qml
new file mode 100644
index 0000000000..ece69f2d79
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/nans.qml
@@ -0,0 +1,5 @@
+import QtQuick 2.0
+
+QtObject {
+ property var prop: undefined
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index c662fdfb8b..2cb5db2cef 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -342,6 +342,7 @@ private slots:
void freeze_empty_object();
void singleBlockLoops();
void qtbug_60547();
+ void anotherNaN();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -8374,6 +8375,20 @@ void tst_qqmlecmascript::qtbug_60547()
QCOMPARE(object->property("counter"), QVariant(int(1)));
}
+void tst_qqmlecmascript::anotherNaN()
+{
+ QQmlComponent component(&engine, testFileUrl("nans.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
+ object->setProperty("prop", std::numeric_limits<double>::quiet_NaN()); // don't crash
+
+ std::uint64_t anotherNaN = 0xFFFFFF01000000F7ul;
+ double d;
+ std::memcpy(&d, &anotherNaN, sizeof(d));
+ QVERIFY(std::isnan(d));
+ object->setProperty("prop", d); // don't crash
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"