From e333c1ac2d0e68a1820073e8f68f467fc73863b3 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 8 Dec 2015 12:50:08 +0100 Subject: Don't warn about non-existent default properties when one was found When at least one default property of a target object is considered valid by an animation, we don't need to warn about other default properties that weren't found. Change-Id: I648f17a55fdfcbed2b4c7e94d88206c3dc3d1a32 Task-number: QTBUG-22141 Reviewed-by: Michael Brasser --- .../data/defaultRotationAnimation.qml | 14 ++++++++++++++ .../quick/qquickanimations/tst_qquickanimations.cpp | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/auto/quick/qquickanimations/data/defaultRotationAnimation.qml (limited to 'tests/auto') diff --git a/tests/auto/quick/qquickanimations/data/defaultRotationAnimation.qml b/tests/auto/quick/qquickanimations/data/defaultRotationAnimation.qml new file mode 100644 index 0000000000..94692add60 --- /dev/null +++ b/tests/auto/quick/qquickanimations/data/defaultRotationAnimation.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +Rectangle { + id: rect + + RotationAnimation { + target: rect + from: 0 + to: 360 + running: true + duration: 1000 + loops: Animation.Infinite + } +} diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index d234cd2d94..5cad68b275 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -105,6 +105,7 @@ private slots: void groupAnimationNullChildBug(); void scriptActionCrash(); void animatorInvalidTargetCrash(); + void defaultPropertyWarning(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1508,6 +1509,25 @@ void tst_qquickanimations::animatorInvalidTargetCrash() delete obj; } +Q_DECLARE_METATYPE(QList) + +// QTBUG-22141 +void tst_qquickanimations::defaultPropertyWarning() +{ + QQmlEngine engine; + + qRegisterMetaType >(); + + QSignalSpy warnings(&engine, SIGNAL(warnings(QList))); + QVERIFY(warnings.isValid()); + + QQmlComponent component(&engine, testFileUrl("defaultRotationAnimation.qml")); + QScopedPointer root(qobject_cast(component.create())); + QVERIFY(root); + + QVERIFY(warnings.isEmpty()); +} + QTEST_MAIN(tst_qquickanimations) #include "tst_qquickanimations.moc" -- cgit v1.2.3