aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp23
-rw-r--r--tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp11
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp22
4 files changed, 62 insertions, 6 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index f4eb17f1ca..ec6245aa1c 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -139,6 +139,7 @@ private slots:
void arrayPop_QTBUG_35979();
void array_unshift_QTBUG_52065();
+ void array_join_QTBUG_53672();
void regexpLastMatch();
void indexedAccesses();
@@ -190,6 +191,7 @@ private slots:
void v4FunctionWithoutQML();
void withNoContext();
+ void holeInPropertyData();
signals:
void testSignal();
@@ -3186,6 +3188,14 @@ void tst_QJSEngine::array_unshift_QTBUG_52065()
QCOMPARE(result.property(i).toInt(), i);
}
+void tst_QJSEngine::array_join_QTBUG_53672()
+{
+ QJSEngine eng;
+ QJSValue result = eng.evaluate("Array.prototype.join.call(0)");
+ QVERIFY(result.isString());
+ QCOMPARE(result.toString(), QString(""));
+}
+
void tst_QJSEngine::regexpLastMatch()
{
QJSEngine eng;
@@ -4019,6 +4029,19 @@ void tst_QJSEngine::withNoContext()
engine.evaluate("with (noContext) true");
}
+void tst_QJSEngine::holeInPropertyData()
+{
+ QJSEngine engine;
+ QJSValue ok = engine.evaluate(
+ "var o = {};\n"
+ "o.bar = 0xcccccccc;\n"
+ "o.foo = 0x55555555;\n"
+ "Object.defineProperty(o, 'bar', { get: function() { return 0xffffffff }});\n"
+ "o.bar === 0xffffffff && o.foo === 0x55555555;");
+ QVERIFY(ok.isBool());
+ QVERIFY(ok.toBool());
+}
+
QTEST_MAIN(tst_QJSEngine)
#include "tst_qjsengine.moc"
diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
index 8ccf4714ba..92b38c6ad8 100644
--- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
+++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp
@@ -554,7 +554,16 @@ void tst_qmldiskcache::cacheResources()
QCOMPARE(obj->property("value").toInt(), 20);
}
- QCOMPARE(QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files).count(), 1);
+ const QStringList entries = QDir(qmlCacheDirectory).entryList(QDir::NoDotAndDotDot | QDir::Files);
+ QCOMPARE(entries.count(), 1);
+
+ {
+ QFile cacheFile(qmlCacheDirectory + QLatin1Char('/') + entries.constFirst());
+ QVERIFY2(cacheFile.open(QIODevice::ReadOnly), qPrintable(cacheFile.errorString()));
+ QV4::CompiledData::Unit unit;
+ QVERIFY(cacheFile.read(reinterpret_cast<char *>(&unit), sizeof(unit)) == sizeof(unit));
+ QCOMPARE(qint64(unit.sourceTimeStamp), QFileInfo(QCoreApplication::applicationFilePath()).lastModified().toMSecsSinceEpoch());
+ }
}
QTEST_MAIN(tst_qmldiskcache)
diff --git a/tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml b/tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml
new file mode 100644
index 0000000000..e739b85ef8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ Image {
+ id: img
+ source: "http://example.org/some_nonexistant_image.png"
+ visible: false
+ }
+
+ property string source: JSON.stringify(img.source)
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index c734a0a011..be04ec2bf3 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -330,6 +330,7 @@ private slots:
void qtbug_52340();
void qtbug_54589();
void qtbug_54687();
+ void stringify_qtbug_50592();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -7258,14 +7259,16 @@ namespace QV4 {
namespace Heap {
struct WeakReferenceSentinel : public Object {
- WeakReferenceSentinel(WeakValue *weakRef, bool *resultPtr)
- : weakRef(weakRef)
- , resultPtr(resultPtr) {
-
+ void init(WeakValue *weakRef, bool *resultPtr)
+ {
+ Object::init();
+ this->weakRef = weakRef;
+ this->resultPtr = resultPtr;
}
- ~WeakReferenceSentinel() {
+ void destroy() {
*resultPtr = weakRef->isNullOrUndefined();
+ Object::destroy();
}
WeakValue *weakRef;
@@ -8101,6 +8104,15 @@ void tst_qqmlecmascript::qtbug_54687()
engine.evaluate("12\n----12");
}
+void tst_qqmlecmascript::stringify_qtbug_50592()
+{
+ QQmlComponent component(&engine, testFileUrl("stringify_qtbug_50592.qml"));
+
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png"));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"