diff options
Diffstat (limited to 'tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp')
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 67da768f73..1a5927fa74 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -35,6 +35,9 @@ #include <private/qqmlboundsignal_p.h> #include <QtCore/qfileinfo.h> #include <QtCore/qdir.h> +#if QT_CONFIG(regularexpression) +#include <QtCore/qregularexpression.h> +#endif #include <QtCore/private/qobject_p.h> #include "../../shared/util.h" @@ -150,6 +153,8 @@ private slots: void floatToStringPrecision(); void copy(); + + void bindingToAlias(); private: QQmlEngine engine; }; @@ -1989,11 +1994,9 @@ void tst_qqmlproperty::assignEmptyVariantMap() QCOMPARE(o.variantMap().count(), 1); QCOMPARE(o.variantMap().isEmpty(), false); - QQmlContext context(&engine); - context.setContextProperty("o", &o); QQmlComponent component(&engine, testFileUrl("assignEmptyVariantMap.qml")); - QObject *obj = component.create(&context); + QObject *obj = component.createWithInitialProperties({{"o", QVariant::fromValue(&o)}}); QVERIFY(obj); QCOMPARE(o.variantMap().count(), 0); @@ -2015,9 +2018,13 @@ void tst_qqmlproperty::warnOnInvalidBinding() expectedWarning = testUrl.toString() + QString::fromLatin1(":7:5: Unable to assign QQuickText to QQuickRectangle"); QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData()); +#if QT_CONFIG(regularexpression) // V8 error message for invalid binding to anchor - expectedWarning = testUrl.toString() + QString::fromLatin1(":14:9: Unable to assign QQuickItem_QML_8 to QQuickAnchorLine"); - QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData()); + const QRegularExpression warning( + "^" + testUrl.toString() + + ":14:9: Unable to assign QQuickItem_QML_\\d+ to QQuickAnchorLine$"); + QTest::ignoreMessage(QtWarningMsg, warning); +#endif QQmlComponent component(&engine, testUrl); QObject *obj = component.create(); @@ -2123,6 +2130,15 @@ void tst_qqmlproperty::initTestCase() qmlRegisterType<MyContainer>("Test",1,0,"MyContainer"); } +// QTBUG-60908 +void tst_qqmlproperty::bindingToAlias() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("aliasToBinding.qml")); + QScopedPointer<QObject> o(component.create()); + QVERIFY(!o.isNull()); +} + QTEST_MAIN(tst_qqmlproperty) #include "tst_qqmlproperty.moc" |