diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-21 09:24:03 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-21 09:24:03 +0200 |
commit | cb5cbe9eb7c9a68acbe19ff2fd0c299e30f42eca (patch) | |
tree | 2ba783322c213c9c533163dc69c950367f767a44 /tests | |
parent | 8de7ec4bf82c35ff1413fb5f5a5ca1788dc93af3 (diff) | |
parent | 16914894f035963ace51c92de13aad11a53c3cf8 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
src/qml/compiler/qv4isel_moth_p.h
Change-Id: I8e86a649d1ef8ad27dc66cc8c290093b2faabc69
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qjsvalue/tst_qjsvalue.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/dependenciesWithFunctions.qml | 12 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 13 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/data/cppnamespace.qml | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/testtypes.cpp | 1 | ||||
-rw-r--r-- | tests/auto/qml/qqmllanguage/testtypes.h | 10 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/data/layoutmirroring_window.qml | 7 | ||||
-rw-r--r-- | tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 20 |
8 files changed, 69 insertions, 1 deletions
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp index 28b9adea38..d28bbc1ffa 100644 --- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp +++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp @@ -431,6 +431,12 @@ void tst_QJSValue::toString() QVERIFY(!o.engine()); QCOMPARE(o.toString(), QStringLiteral("1,2,3")); } + + { + QByteArray hello = QByteArrayLiteral("Hello World"); + QJSValue jsValue = eng.toScriptValue(hello); + QCOMPARE(jsValue.toString(), QString::fromUtf8(hello)); + } } void tst_QJSValue::toNumber() diff --git a/tests/auto/qml/qqmlecmascript/data/dependenciesWithFunctions.qml b/tests/auto/qml/qqmlecmascript/data/dependenciesWithFunctions.qml new file mode 100644 index 0000000000..57d3ae2f14 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/dependenciesWithFunctions.qml @@ -0,0 +1,12 @@ +import QtQml 2.0 +QtObject { + property int value: 100 + property bool success: { + unrelatedFunction(); + return value == 42; + } + property int unrelatedValue: 100 + function unrelatedFunction() { + return unrelatedValue; + } +} diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index a5373ccbcd..c734a0a011 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -84,6 +84,7 @@ private slots: void arrayExpressions(); void contextPropertiesTriggerReeval(); void objectPropertiesTriggerReeval(); + void dependenciesWithFunctions(); void deferredProperties(); void deferredPropertiesErrors(); void deferredPropertiesInComponents(); @@ -881,6 +882,18 @@ void tst_qqmlecmascript::objectPropertiesTriggerReeval() } } +void tst_qqmlecmascript::dependenciesWithFunctions() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("dependenciesWithFunctions.qml")); + + QScopedPointer<QObject> object(component.create()); + QVERIFY2(object, qPrintable(component.errorString())); + QVERIFY(!object->property("success").toBool()); + object->setProperty("value", 42); + QVERIFY(object->property("success").toBool()); +} + void tst_qqmlecmascript::deferredProperties() { QQmlComponent component(&engine, testFileUrl("deferredProperties.qml")); diff --git a/tests/auto/qml/qqmllanguage/data/cppnamespace.qml b/tests/auto/qml/qqmllanguage/data/cppnamespace.qml index e1daf3b78f..efedf2b14a 100644 --- a/tests/auto/qml/qqmllanguage/data/cppnamespace.qml +++ b/tests/auto/qml/qqmllanguage/data/cppnamespace.qml @@ -1,4 +1,5 @@ import Test 1.0 MyNamespacedType { + myEnum: MyNamespace.Key5 } diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 3921f89d23..3af7645ff7 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -45,6 +45,7 @@ void registerTypes() qmlRegisterType<MyDotPropertyObject>("Test",1,0,"MyDotPropertyObject"); qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType"); qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType"); + qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject, "Test", 1, 0, "MyNamespace", "Access to enums & flags only"); qmlRegisterType<MyParserStatus>("Test",1,0,"MyParserStatus"); qmlRegisterType<MyGroupedObject>(); qmlRegisterType<MyRevisionedClass>("Test",1,0,"MyRevisionedClass"); diff --git a/tests/auto/qml/qqmllanguage/testtypes.h b/tests/auto/qml/qqmllanguage/testtypes.h index af7dc155d0..6c62bcf7b9 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.h +++ b/tests/auto/qml/qqmllanguage/testtypes.h @@ -730,9 +730,19 @@ private: namespace MyNamespace { + Q_NAMESPACE + enum MyNSEnum { + Key1 = 1, + Key2, + Key5 = 5 + }; + Q_ENUM_NS(MyNSEnum); + class MyNamespacedType : public QObject { Q_OBJECT + Q_PROPERTY(MyNamespace::MyNSEnum myEnum MEMBER m_myEnum) + MyNamespace::MyNSEnum m_myEnum = MyNSEnum::Key1; }; class MySecondNamespacedType : public QObject diff --git a/tests/auto/quick/qquickitem2/data/layoutmirroring_window.qml b/tests/auto/quick/qquickitem2/data/layoutmirroring_window.qml new file mode 100644 index 0000000000..3bac0716e8 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/layoutmirroring_window.qml @@ -0,0 +1,7 @@ +import QtQuick 2.0 +import QtQuick.Window 2.0 + +Window { + LayoutMirroring.enabled: true + LayoutMirroring.childrenInherit: true +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 169ef1cbab..7130dc4cf2 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -88,6 +88,7 @@ private slots: void keyNavigation_focusReason(); void keyNavigation_loop(); void layoutMirroring(); + void layoutMirroringWindow(); void layoutMirroringIllegalParent(); void smooth(); void antialiasing(); @@ -1776,11 +1777,28 @@ void tst_QQuickItem::layoutMirroring() delete parentItem2; } +void tst_QQuickItem::layoutMirroringWindow() +{ + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("layoutmirroring_window.qml")); + QScopedPointer<QObject> object(component.create()); + QQuickWindow *window = qobject_cast<QQuickWindow *>(object.data()); + QVERIFY(window); + window->show(); + + QQuickItemPrivate *content = QQuickItemPrivate::get(window->contentItem()); + QCOMPARE(content->effectiveLayoutMirror, true); + QCOMPARE(content->inheritedLayoutMirror, true); + QCOMPARE(content->isMirrorImplicit, false); + QCOMPARE(content->inheritMirrorFromParent, true); + QCOMPARE(content->inheritMirrorFromItem, true); +} + void tst_QQuickItem::layoutMirroringIllegalParent() { QQmlComponent component(&engine); component.setData("import QtQuick 2.0; QtObject { LayoutMirroring.enabled: true; LayoutMirroring.childrenInherit: true }", QUrl::fromLocalFile("")); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1:21: QML QtObject: LayoutDirection attached property only works with Items"); + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1:21: QML QtObject: LayoutDirection attached property only works with Items and Windows"); QObject *object = component.create(); QVERIFY(object != 0); } |