From 2bc116f832565cbec5a69a2aaf973ef931b006b1 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Fri, 25 Aug 2023 17:40:03 +0200 Subject: [PATCH] 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 (cherry picked from commit 22c2c15b27a65e988be2c7e21f3e97c4ced97375) Reviewed-by: Qt Cherry-pick Bot --- .../qsequentialanimationgroup/CMakeLists.txt | 2 ++ .../tst_qsequentialanimationgroup.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt index 61dca7c74d3..2e299c2174a 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt @@ -8,4 +8,6 @@ qt_internal_add_test(tst_qsequentialanimationgroup SOURCES tst_qsequentialanimationgroup.cpp + LIBRARIES + Qt::TestPrivate ) diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index e6e87313788..63b95f3dcbe 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -2,6 +2,8 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include +#include + #include #include #include @@ -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)