QSequentialAnimationGroup: extend bindable property unit tests

The bindable property tests should use the helper functions from
QTestPrivate.

Task-number: QTBUG-116346
Change-Id: Ie1a61ab80e6f737eac02246214c2c93129a1cf94
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
(cherry picked from commit 22c2c15b27a65e988be2c7e21f3e97c4ced97375)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ivan Solovev 2023-08-25 17:40:03 +02:00 committed by Qt Cherry-pick Bot
parent bda8582f39
commit 2bc116f832
2 changed files with 13 additions and 0 deletions

View File

@ -8,4 +8,6 @@
qt_internal_add_test(tst_qsequentialanimationgroup
SOURCES
tst_qsequentialanimationgroup.cpp
LIBRARIES
Qt::TestPrivate
)

View File

@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QTest>
#include <QtTest/private/qpropertytesthelper_p.h>
#include <QVariantAnimation>
#include <QProperty>
#include <QPropertyAnimation>
@ -1685,6 +1687,15 @@ void tst_QSequentialAnimationGroup::bindings()
group.bindableCurrentAnimation().setBinding([&]() { return leader.value(); });
QCOMPARE(group.currentAnimation(), anim3.get());
QTestPrivate::testReadOnlyPropertyBasics(group, anim3.get(), anim2.get(), "currentAnimation",
[&group, totalDuration]() {
group.setCurrentTime(int(totalDuration * 1.5 / 3));
});
if (QTest::currentTestFailed()) {
qDebug("Failed property test for QSequentialAnimationGroup::currentAnimation");
return;
}
}
QTEST_MAIN(tst_QSequentialAnimationGroup)