QSequentialAnimationGroup: extend bindable property unit tests

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

Task-number: QTBUG-116346
Pick-to: 6.6 6.5
Change-Id: Ie1a61ab80e6f737eac02246214c2c93129a1cf94
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Ivan Solovev 2023-08-25 17:40:03 +02:00
parent b64e36240b
commit 22c2c15b27
2 changed files with 13 additions and 0 deletions

View File

@ -14,4 +14,6 @@ endif()
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)