diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-26 12:53:14 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-11-28 12:24:13 +0100 |
commit | 9044800083ccffe4d0b732f8b3b60512f32d8f8a (patch) | |
tree | cdd6d2038d53e99a5a9326be6b47a68553830480 /tests | |
parent | 8bf579d8d4feb13ca8651e98dd762b28483abe9e (diff) | |
parent | cc1c3d0e2be6dfea6befebdc5f25e519e3fe79b2 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
The renderers added in 5.8 had to be adapted to the changed profiling
macros from 5.6.
Conflicts:
src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp
src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp
src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp
src/quick/util/qquickprofiler_p.h
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
Change-Id: Icb370b7c95aab12589ad73881ac6d178759a5c6b
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml | 27 | ||||
-rw-r--r-- | tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp | 13 | ||||
-rw-r--r-- | tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp | 34 | ||||
-rw-r--r-- | tests/benchmarks/qml/creation/tst_creation.cpp | 8 |
5 files changed, 88 insertions, 2 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index c20f0888d8..52df4c0642 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -196,6 +196,8 @@ private slots: void basicBlockMergeAfterLoopPeeling(); + void malformedExpression(); + signals: void testSignal(); }; @@ -4062,6 +4064,12 @@ void tst_QJSEngine::basicBlockMergeAfterLoopPeeling() } +void tst_QJSEngine::malformedExpression() +{ + QJSEngine engine; + engine.evaluate("5%55555&&5555555\n7-0"); +} + QTEST_MAIN(tst_QJSEngine) #include "tst_qjsengine.moc" diff --git a/tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml b/tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml new file mode 100644 index 0000000000..6bf750dcda --- /dev/null +++ b/tests/auto/qml/qqmllistmodel/data/bindingsOnGetResult.qml @@ -0,0 +1,27 @@ +import QtQuick 2.0 + +QtObject { + property ListModel model: ListModel { + ListElement { modified: false } + ListElement { modified: false } + ListElement { modified: false } + ListElement { modified: false } + ListElement { modified: false } + } + + property bool isModified: { + for (var i = 0; i < model.count; ++i) { + if (model.get(i).modified) + return true; + } + return false; + } + + property bool success: false + Component.onCompleted: { + // trigger read and setup of property captures + success = isModified + model.setProperty(0, "modified", true) + success = isModified + } +} diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index cd497cbd79..555ca5713e 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -122,6 +122,7 @@ private slots: void datetime_data(); void about_to_be_signals(); void modify_through_delegate(); + void bindingsOnGetResult(); }; bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVariant object) @@ -1469,6 +1470,18 @@ void tst_qqmllistmodel::modify_through_delegate() QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("age")).toInt(), 18); } +void tst_qqmllistmodel::bindingsOnGetResult() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("bindingsOnGetResult.qml")); + QVERIFY2(!component.isError(), qPrintable(component.errorString())); + + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); + + QVERIFY(obj->property("success").toBool()); +} + QTEST_MAIN(tst_qqmllistmodel) #include "tst_qqmllistmodel.moc" diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index 803bad197a..9e915ac451 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -91,6 +91,7 @@ private slots: void gadgetInheritance(); void toStringConversion(); void enumerableProperties(); + void enumProperties(); private: QQmlEngine engine; @@ -1703,6 +1704,39 @@ void tst_qqmlvaluetypes::enumerableProperties() QVERIFY(names.contains(QStringLiteral("derivedProperty"))); } +struct GadgetWithEnum +{ + Q_GADGET +public: + + enum MyEnum { FirstValue, SecondValue }; + + Q_ENUM(MyEnum) + Q_PROPERTY(MyEnum enumProperty READ enumProperty) + + MyEnum enumProperty() const { return SecondValue; } +}; + +void tst_qqmlvaluetypes::enumProperties() +{ + QJSEngine engine; + + // When creating the property cache for the gadget when MyEnum is _not_ a registered + // meta-type, then QMetaProperty::type() will return QMetaType::Int and consequently + // property-read meta-calls will return an int (as expected in this test). However if we + // explicitly register the gadget, then QMetaProperty::type() will return the user-type + // and QQmlValueTypeWrapper should still handle that and return an integer/number for the + // enum property when it is read. + qRegisterMetaType<GadgetWithEnum::MyEnum>(); + + GadgetWithEnum g; + QJSValue value = engine.toScriptValue(g); + + QJSValue enumValue = value.property("enumProperty"); + QVERIFY(enumValue.isNumber()); + QCOMPARE(enumValue.toInt(), int(g.enumProperty())); +} + QTEST_MAIN(tst_qqmlvaluetypes) diff --git a/tests/benchmarks/qml/creation/tst_creation.cpp b/tests/benchmarks/qml/creation/tst_creation.cpp index a1c09db158..9fc67ada71 100644 --- a/tests/benchmarks/qml/creation/tst_creation.cpp +++ b/tests/benchmarks/qml/creation/tst_creation.cpp @@ -221,12 +221,15 @@ inline void QQmlGraphics_setParent_noEvent(QObject *object, QObject *parent) void tst_creation::itemtree_notree_cpp() { + std::vector<QQuickItem *> kids; + kids.resize(30); QBENCHMARK { QQuickItem *item = new QQuickItem; for (int i = 0; i < 30; ++i) { QQuickItem *child = new QQuickItem; - Q_UNUSED(child); + kids[i] = child; } + qDeleteAll(kids); delete item; } } @@ -258,12 +261,13 @@ void tst_creation::itemtree_cpp() void tst_creation::itemtree_data_cpp() { + QQmlEngine engine; QBENCHMARK { QQuickItem *item = new QQuickItem; for (int i = 0; i < 30; ++i) { QQuickItem *child = new QQuickItem; QQmlGraphics_setParent_noEvent(child,item); - QQmlListReference ref(item, "data"); + QQmlListReference ref(item, "data", &engine); ref.append(child); } delete item; |