aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine/tst_qjsengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qjsengine/tst_qjsengine.cpp')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index d24a1a4f20..9f86c8e4e1 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -70,6 +70,7 @@ private slots:
void newArray_HooliganTask233836();
void newVariant();
void newVariant_valueOfToString();
+ void newVariant_valueOfEnum();
void newRegExp();
void jsRegExp();
void newDate();
@@ -173,6 +174,7 @@ private slots:
void privateMethods();
+ void engineForObject();
void intConversion_QTBUG43309();
signals:
@@ -441,6 +443,17 @@ void tst_QJSEngine::newVariant_valueOfToString()
}
}
+void tst_QJSEngine::newVariant_valueOfEnum()
+{
+ QJSEngine eng;
+ {
+ QJSValue object = eng.toScriptValue(QVariant::fromValue(Qt::ControlModifier));
+ QJSValue value = object.property("valueOf").callWithInstance(object);
+ QVERIFY(value.isNumber());
+ QCOMPARE(value.toInt(), static_cast<qint32>(Qt::ControlModifier));
+ }
+}
+
void tst_QJSEngine::newRegExp()
{
QJSEngine eng;
@@ -804,8 +817,18 @@ void tst_QJSEngine::globalObjectProperties_enumerate()
<< "unescape"
<< "SyntaxError"
<< "undefined"
- // JavaScriptCore
<< "JSON"
+ << "ArrayBuffer"
+ << "DataView"
+ << "Int8Array"
+ << "Uint8Array"
+ << "Uint8ClampedArray"
+ << "Int16Array"
+ << "Uint16Array"
+ << "Int32Array"
+ << "Uint32Array"
+ << "Float32Array"
+ << "Float64Array"
;
QSet<QString> actualNames;
{
@@ -1818,6 +1841,7 @@ void tst_QJSEngine::errorConstructors()
QJSValue ret = eng.evaluate(code);
QVERIFY(ret.isError());
QVERIFY(ret.toString().startsWith(name));
+ qDebug() << ret.property("stack").toString();
QCOMPARE(ret.property("lineNumber").toInt(), i+2);
}
}
@@ -3603,6 +3627,19 @@ void tst_QJSEngine::privateMethods()
}
}
+void tst_QJSEngine::engineForObject()
+{
+ QObject object;
+ {
+ QJSEngine engine;
+ QVERIFY(!qjsEngine(&object));
+ QJSValue wrapper = engine.newQObject(&object);
+ QQmlEngine::setObjectOwnership(&object, QQmlEngine::CppOwnership);
+ QCOMPARE(qjsEngine(&object), wrapper.engine());
+ }
+ QVERIFY(!qjsEngine(&object));
+}
+
void tst_QJSEngine::intConversion_QTBUG43309()
{
// This failed in the interpreter: