summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/animation
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/animation')
-rw-r--r--tests/auto/corelib/animation/CMakeLists.txt3
-rw-r--r--tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp2
-rw-r--r--tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp8
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp142
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt12
-rw-r--r--tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp11
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp80
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST1
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt11
-rw-r--r--tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp109
-rw-r--r--tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt9
-rw-r--r--tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp2
16 files changed, 250 insertions, 178 deletions
diff --git a/tests/auto/corelib/animation/CMakeLists.txt b/tests/auto/corelib/animation/CMakeLists.txt
index 79c2d6c4e9..85c121d243 100644
--- a/tests/auto/corelib/animation/CMakeLists.txt
+++ b/tests/auto/corelib/animation/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from animation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(qabstractanimation)
add_subdirectory(qanimationgroup)
diff --git a/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt b/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt
index 1ab378546d..6e1ac655ba 100644
--- a/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qabstractanimation/CMakeLists.txt
@@ -1,9 +1,16 @@
-# Generated from qabstractanimation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qabstractanimation Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qabstractanimation LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qabstractanimation
SOURCES
tst_qabstractanimation.cpp
diff --git a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp
index 0408ad806b..6c87428d75 100644
--- a/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp
+++ b/tests/auto/corelib/animation/qabstractanimation/tst_qabstractanimation.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qabstractanimation.h>
diff --git a/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt
index 5dcdf49836..a8160051a3 100644
--- a/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qanimationgroup/CMakeLists.txt
@@ -1,9 +1,16 @@
-# Generated from qanimationgroup.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qanimationgroup Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qanimationgroup LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qanimationgroup
SOURCES
tst_qanimationgroup.cpp
diff --git a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
index 162f8ea9fc..5345283252 100644
--- a/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qanimationgroup/tst_qanimationgroup.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QPauseAnimation>
@@ -109,7 +109,7 @@ void tst_QAnimationGroup::emptyGroup()
QCOMPARE(group.state(), QAnimationGroup::Stopped);
group.start();
- QCOMPARE(groupStateChangedSpy.count(), 2);
+ QCOMPARE(groupStateChangedSpy.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(groupStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
@@ -121,7 +121,7 @@ void tst_QAnimationGroup::emptyGroup()
QTest::ignoreMessage(QtWarningMsg, "QAbstractAnimation::pause: Cannot pause a stopped animation");
group.pause();
- QCOMPARE(groupStateChangedSpy.count(), 2);
+ QCOMPARE(groupStateChangedSpy.size(), 2);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
group.start();
@@ -135,7 +135,7 @@ void tst_QAnimationGroup::emptyGroup()
group.stop();
- QCOMPARE(groupStateChangedSpy.count(), 4);
+ QCOMPARE(groupStateChangedSpy.size(), 4);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
}
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt
index 9a6c9f45db..c532ad7327 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/CMakeLists.txt
@@ -1,9 +1,16 @@
-# Generated from qparallelanimationgroup.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qparallelanimationgroup Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qparallelanimationgroup LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qparallelanimationgroup
SOURCES
tst_qparallelanimationgroup.cpp
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index 6d73725cff..c47ce53364 100644
--- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QVariantAnimation>
@@ -7,6 +7,7 @@
#include <QSignalSpy>
#include <QtCore/qparallelanimationgroup.h>
+#include <QtCore/qscopeguard.h>
Q_DECLARE_METATYPE(QAbstractAnimation::State)
@@ -234,38 +235,38 @@ void tst_QParallelAnimationGroup::stateChanged()
//first; let's start forward
group.start();
//all the animations should be started
- QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy1.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Running);
- QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Running);
- QCOMPARE(spy3.count(), 1);
+ QCOMPARE(spy3.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Running);
- QCOMPARE(spy4.count(), 1);
+ QCOMPARE(spy4.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Running);
group.setCurrentTime(1500); //anim1 should be finished
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(spy1.count(), 2);
+ QCOMPARE(spy1.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Stopped);
- QCOMPARE(spy2.count(), 1); //no change
- QCOMPARE(spy3.count(), 1); //no change
- QCOMPARE(spy4.count(), 1); //no change
+ QCOMPARE(spy2.size(), 1); //no change
+ QCOMPARE(spy3.size(), 1); //no change
+ QCOMPARE(spy4.size(), 1); //no change
group.setCurrentTime(2500); //anim2 should be finished
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(spy1.count(), 2); //no change
- QCOMPARE(spy2.count(), 2);
+ QCOMPARE(spy1.size(), 2); //no change
+ QCOMPARE(spy2.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Stopped);
- QCOMPARE(spy3.count(), 1); //no change
- QCOMPARE(spy4.count(), 1); //no change
+ QCOMPARE(spy3.size(), 1); //no change
+ QCOMPARE(spy4.size(), 1); //no change
group.setCurrentTime(3500); //everything should be finished
QCOMPARE(group.state(), QAnimationGroup::Stopped);
- QCOMPARE(spy1.count(), 2); //no change
- QCOMPARE(spy2.count(), 2); //no change
- QCOMPARE(spy3.count(), 2);
+ QCOMPARE(spy1.size(), 2); //no change
+ QCOMPARE(spy2.size(), 2); //no change
+ QCOMPARE(spy3.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Stopped);
- QCOMPARE(spy4.count(), 2);
+ QCOMPARE(spy4.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Stopped);
//cleanup
@@ -280,38 +281,38 @@ void tst_QParallelAnimationGroup::stateChanged()
//only anim3 and anim4 should be started
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(spy1.count(), 0);
- QCOMPARE(spy2.count(), 0);
- QCOMPARE(spy3.count(), 1);
+ QCOMPARE(spy1.size(), 0);
+ QCOMPARE(spy2.size(), 0);
+ QCOMPARE(spy3.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Running);
- QCOMPARE(spy4.count(), 1);
+ QCOMPARE(spy4.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Running);
group.setCurrentTime(1500); //anim2 should be started
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(spy1.count(), 0); //no change
- QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy1.size(), 0); //no change
+ QCOMPARE(spy2.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Running);
- QCOMPARE(spy3.count(), 1); //no change
- QCOMPARE(spy4.count(), 1); //no change
+ QCOMPARE(spy3.size(), 1); //no change
+ QCOMPARE(spy4.size(), 1); //no change
group.setCurrentTime(500); //anim1 is finally also started
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(spy1.count(), 1);
+ QCOMPARE(spy1.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Running);
- QCOMPARE(spy2.count(), 1); //no change
- QCOMPARE(spy3.count(), 1); //no change
- QCOMPARE(spy4.count(), 1); //no change
+ QCOMPARE(spy2.size(), 1); //no change
+ QCOMPARE(spy3.size(), 1); //no change
+ QCOMPARE(spy4.size(), 1); //no change
group.setCurrentTime(0); //everything should be stopped
QCOMPARE(group.state(), QAnimationGroup::Stopped);
- QCOMPARE(spy1.count(), 2);
+ QCOMPARE(spy1.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Stopped);
- QCOMPARE(spy2.count(), 2);
+ QCOMPARE(spy2.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Stopped);
- QCOMPARE(spy3.count(), 2);
+ QCOMPARE(spy3.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Stopped);
- QCOMPARE(spy4.count(), 2);
+ QCOMPARE(spy4.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Stopped);
}
@@ -405,8 +406,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
QVERIFY(groupStateChangedSpy.isValid());
QVERIFY(childStateChangedSpy.isValid());
- QCOMPARE(groupStateChangedSpy.count(), 0);
- QCOMPARE(childStateChangedSpy.count(), 0);
+ QCOMPARE(groupStateChangedSpy.size(), 0);
+ QCOMPARE(childStateChangedSpy.size(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(anim.state(), QAnimationGroup::Stopped);
@@ -417,8 +418,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim.state(), QAnimationGroup::Running);
- QCOMPARE(groupStateChangedSpy.count(), 1);
- QCOMPARE(childStateChangedSpy.count(), 1);
+ QCOMPARE(groupStateChangedSpy.size(), 1);
+ QCOMPARE(childStateChangedSpy.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(groupStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
@@ -428,8 +429,8 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
// starting directly a running child will not have any effect
anim.start();
- QCOMPARE(groupStateChangedSpy.count(), 1);
- QCOMPARE(childStateChangedSpy.count(), 1);
+ QCOMPARE(groupStateChangedSpy.size(), 1);
+ QCOMPARE(childStateChangedSpy.size(), 1);
anim.pause();
@@ -572,8 +573,8 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(stateChangedSpy2.isValid());
- QCOMPARE(stateChangedSpy1.count(), 0);
- QCOMPARE(stateChangedSpy2.count(), 0);
+ QCOMPARE(stateChangedSpy1.size(), 0);
+ QCOMPARE(stateChangedSpy2.size(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(anim1.state(), QAnimationGroup::Stopped);
QCOMPARE(anim2.state(), QAnimationGroup::Stopped);
@@ -598,13 +599,13 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
group.start();
- QCOMPARE(stateChangedSpy1.count(), 3);
+ QCOMPARE(stateChangedSpy1.size(), 3);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy1.at(1).first()),
QAnimationGroup::Stopped);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy1.at(2).first()),
QAnimationGroup::Running);
- QCOMPARE(stateChangedSpy2.count(), 4);
+ QCOMPARE(stateChangedSpy2.size(), 4);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy2.at(2).first()),
QAnimationGroup::Stopped);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy2.at(3).first()),
@@ -655,22 +656,22 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
group.addAnimation(&anim1);
group.addAnimation(&anim2);
group.addAnimation(&anim3);
- QCOMPARE(stateChangedSpy1.count(), 0);
+ QCOMPARE(stateChangedSpy1.size(), 0);
group.start();
- QCOMPARE(stateChangedSpy1.count(), 2);
- QCOMPARE(finishedSpy1.count(), 1);
+ QCOMPARE(stateChangedSpy1.size(), 2);
+ QCOMPARE(finishedSpy1.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy1.at(0).first()),
QAnimationGroup::Running);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy1.at(1).first()),
QAnimationGroup::Stopped);
- QCOMPARE(stateChangedSpy2.count(), 1);
- QCOMPARE(finishedSpy2.count(), 0);
+ QCOMPARE(stateChangedSpy2.size(), 1);
+ QCOMPARE(finishedSpy2.size(), 0);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy1.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(stateChangedSpy3.count(), 1);
- QCOMPARE(finishedSpy3.count(), 0);
+ QCOMPARE(stateChangedSpy3.size(), 1);
+ QCOMPARE(finishedSpy3.size(), 0);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy3.at(0).first()),
QAnimationGroup::Running);
@@ -688,21 +689,21 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
stateChangedSpy3.clear();
group.start();
- QCOMPARE(stateChangedSpy1.count(), 2);
- QCOMPARE(stateChangedSpy2.count(), 1);
- QCOMPARE(stateChangedSpy3.count(), 1);
+ QCOMPARE(stateChangedSpy1.size(), 2);
+ QCOMPARE(stateChangedSpy2.size(), 1);
+ QCOMPARE(stateChangedSpy3.size(), 1);
group.setCurrentTime(50);
- QCOMPARE(stateChangedSpy1.count(), 2);
- QCOMPARE(stateChangedSpy2.count(), 1);
- QCOMPARE(stateChangedSpy3.count(), 2);
+ QCOMPARE(stateChangedSpy1.size(), 2);
+ QCOMPARE(stateChangedSpy2.size(), 1);
+ QCOMPARE(stateChangedSpy3.size(), 2);
group.setCurrentTime(150);
- QCOMPARE(stateChangedSpy1.count(), 4);
- QCOMPARE(stateChangedSpy2.count(), 3);
- QCOMPARE(stateChangedSpy3.count(), 4);
+ QCOMPARE(stateChangedSpy1.size(), 4);
+ QCOMPARE(stateChangedSpy2.size(), 3);
+ QCOMPARE(stateChangedSpy3.size(), 4);
group.setCurrentTime(50);
- QCOMPARE(stateChangedSpy1.count(), 6);
- QCOMPARE(stateChangedSpy2.count(), 5);
- QCOMPARE(stateChangedSpy3.count(), 6);
+ QCOMPARE(stateChangedSpy1.size(), 6);
+ QCOMPARE(stateChangedSpy2.size(), 5);
+ QCOMPARE(stateChangedSpy3.size(), 6);
}
@@ -734,7 +735,7 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations()
group.start();
- QCOMPARE(stateChangedSpy.count(), 2);
+ QCOMPARE(stateChangedSpy.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy.at(0).first()),
QAnimationGroup::Running);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy.at(1).first()),
@@ -928,6 +929,7 @@ void tst_QParallelAnimationGroup::autoAdd()
test = static_cast<TestAnimation2*>(group.animationAt(0));
test->setParent(0); // remove the last one (with duration = 250)
+ const auto deleteParentlessObject = qScopeGuard([test] { delete test; });
QCOMPARE(test->group(), static_cast<QAnimationGroup*>(0));
QCOMPARE(group.duration(), 0);
}
@@ -943,7 +945,7 @@ void tst_QParallelAnimationGroup::pauseResume()
QTest::qWait(100);
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
spy.clear();
const int currentTime = group.currentLoopTime();
QCOMPARE(anim->currentLoopTime(), currentTime);
@@ -953,7 +955,7 @@ void tst_QParallelAnimationGroup::pauseResume()
QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Paused);
QCOMPARE(anim->currentLoopTime(), currentTime);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
spy.clear();
group.resume();
@@ -961,21 +963,21 @@ void tst_QParallelAnimationGroup::pauseResume()
QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Running);
QCOMPARE(anim->currentLoopTime(), currentTime);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
group.stop();
spy.clear();
new TestAnimation2(500, &group);
group.start();
- QCOMPARE(spy.count(), 1); //the animation should have been started
+ QCOMPARE(spy.size(), 1); //the animation should have been started
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Running);
group.setCurrentTime(250); //end of first animation
- QCOMPARE(spy.count(), 2); //the animation should have been stopped
+ QCOMPARE(spy.size(), 2); //the animation should have been stopped
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Stopped);
group.pause();
- QCOMPARE(spy.count(), 2); //this shouldn't have changed
+ QCOMPARE(spy.size(), 2); //this shouldn't have changed
group.resume();
- QCOMPARE(spy.count(), 2); //this shouldn't have changed
+ QCOMPARE(spy.size(), 2); //this shouldn't have changed
}
// This is a regression test for QTBUG-8910, where a crash occurred when the
diff --git a/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt b/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt
index bc846d33e7..aa0cb1edc5 100644
--- a/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qpauseanimation/CMakeLists.txt
@@ -1,12 +1,20 @@
-# Generated from qpauseanimation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qpauseanimation Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qpauseanimation LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qpauseanimation
SOURCES
tst_qpauseanimation.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
+ Qt::TestPrivate
)
diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
index ba57904620..8b11656706 100644
--- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp
@@ -1,7 +1,8 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
+#include <QtTest/private/qpropertytesthelper_p.h>
#include <QtCore/qpauseanimation.h>
#include <QtCore/qpropertyanimation.h>
@@ -11,7 +12,7 @@
#include <private/qabstractanimation_p.h>
-#if defined(Q_OS_WIN) || defined(Q_OS_ANDROID)
+#if defined(Q_OS_WIN) || defined(Q_OS_ANDROID) || defined(Q_OS_QNX)
# define BAD_TIMER_RESOLUTION
#endif
@@ -456,6 +457,12 @@ void tst_QPauseAnimation::bindings()
"QPauseAnimation::setDuration: cannot set a negative duration");
animation.setDuration(-1);
QCOMPARE(durationObserver, 46);
+
+ QTestPrivate::testReadWritePropertyBasics(animation, 10, 20, "duration");
+ if (QTest::currentTestFailed()) {
+ qDebug("Failed property test for QPauseAnimation::duration");
+ return;
+ }
}
QTEST_MAIN(tst_QPauseAnimation)
diff --git a/tests/auto/corelib/animation/qpropertyanimation/CMakeLists.txt b/tests/auto/corelib/animation/qpropertyanimation/CMakeLists.txt
index 89a4d0a8e1..38383aff46 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qpropertyanimation/CMakeLists.txt
@@ -1,13 +1,20 @@
-# Generated from qpropertyanimation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qpropertyanimation Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qpropertyanimation LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qpropertyanimation
SOURCES
tst_qpropertyanimation.cpp
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::CorePrivate
Qt::Gui
Qt::Widgets
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index a5eff80e49..03755fa7ab 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
#include <QtTest/private/qpropertytesthelper_p.h>
@@ -283,9 +283,9 @@ void tst_QPropertyAnimation::statesAndSignals()
anim->setCurrentTime(1);
anim->setCurrentTime(100);
- QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(runningSpy.count(), 0);
- QCOMPARE(currentLoopSpy.count(), 0);
+ QCOMPARE(finishedSpy.size(), 0);
+ QCOMPARE(runningSpy.size(), 0);
+ QCOMPARE(currentLoopSpy.size(), 0);
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
anim->setLoopCount(3);
@@ -294,26 +294,26 @@ void tst_QPropertyAnimation::statesAndSignals()
if (uncontrolled)
QSKIP("Uncontrolled animations don't handle looping");
- QCOMPARE(currentLoopSpy.count(), 1);
+ QCOMPARE(currentLoopSpy.size(), 1);
QCOMPARE(anim->currentLoop(), 1);
anim->setCurrentTime(0);
- QCOMPARE(currentLoopSpy.count(), 2);
+ QCOMPARE(currentLoopSpy.size(), 2);
QCOMPARE(anim->currentLoop(), 0);
anim->start();
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(runningSpy.count(), 1); //anim must have started
+ QCOMPARE(runningSpy.size(), 1); //anim must have started
QCOMPARE(anim->currentLoop(), 0);
runningSpy.clear();
anim->stop();
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
- QCOMPARE(runningSpy.count(), 1); //anim must have stopped
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 1); //anim must have stopped
+ QCOMPARE(finishedSpy.size(), 0);
QCOMPARE(anim->currentLoopTime(), 0);
QCOMPARE(anim->currentLoop(), 0);
- QCOMPARE(currentLoopSpy.count(), 2);
+ QCOMPARE(currentLoopSpy.size(), 2);
runningSpy.clear();
{
@@ -321,30 +321,30 @@ void tst_QPropertyAnimation::statesAndSignals()
anim->start();
timeDriver.wait(1000);
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
- QCOMPARE(runningSpy.count(), 2); //started and stopped again
+ QCOMPARE(runningSpy.size(), 2); //started and stopped again
runningSpy.clear();
- QCOMPARE(finishedSpy.count(), 1);
+ QCOMPARE(finishedSpy.size(), 1);
QCOMPARE(anim->currentLoopTime(), 100);
QCOMPARE(anim->currentLoop(), 2);
- QCOMPARE(currentLoopSpy.count(), 4);
+ QCOMPARE(currentLoopSpy.size(), 4);
anim->start(); // auto-rewinds
QCOMPARE(anim->state(), QAnimationGroup::Running);
QCOMPARE(anim->currentTime(), 0);
QCOMPARE(anim->currentLoop(), 0);
- QCOMPARE(currentLoopSpy.count(), 5);
- QCOMPARE(runningSpy.count(), 1); // anim has started
- QCOMPARE(finishedSpy.count(), 1);
+ QCOMPARE(currentLoopSpy.size(), 5);
+ QCOMPARE(runningSpy.size(), 1); // anim has started
+ QCOMPARE(finishedSpy.size(), 1);
QCOMPARE(anim->currentLoop(), 0);
runningSpy.clear();
timeDriver.wait(1000);
- QCOMPARE(currentLoopSpy.count(), 7);
+ QCOMPARE(currentLoopSpy.size(), 7);
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
QCOMPARE(anim->currentLoop(), 2);
- QCOMPARE(runningSpy.count(), 1); // anim has stopped
- QCOMPARE(finishedSpy.count(), 2);
+ QCOMPARE(runningSpy.size(), 1); // anim has stopped
+ QCOMPARE(finishedSpy.size(), 2);
QCOMPARE(anim->currentLoopTime(), 100);
}
}
@@ -364,8 +364,8 @@ void tst_QPropertyAnimation::deletion1()
anim->setEndValue(20);
anim->setDuration(200);
anim->start();
- QCOMPARE(runningSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 1);
+ QCOMPARE(finishedSpy.size(), 0);
QVERIFY(anim);
QCOMPARE(anim->state(), QAnimationGroup::Running);
@@ -375,8 +375,8 @@ void tst_QPropertyAnimation::deletion1()
timeDriver.wait(150);
QVERIFY(anim); //The animation should not have been deleted
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
- QCOMPARE(runningSpy.count(), 2);
- QCOMPARE(finishedSpy.count(), 1);
+ QCOMPARE(runningSpy.size(), 2);
+ QCOMPARE(finishedSpy.size(), 1);
anim->start(QVariantAnimation::DeleteWhenStopped);
QVERIFY(anim);
@@ -385,8 +385,8 @@ void tst_QPropertyAnimation::deletion1()
QVERIFY(anim);
QCOMPARE(anim->state(), QAnimationGroup::Running);
timeDriver.wait(150);
- QCOMPARE(runningSpy.count(), 4);
- QCOMPARE(finishedSpy.count(), 2);
+ QCOMPARE(runningSpy.size(), 4);
+ QCOMPARE(finishedSpy.size(), 2);
QVERIFY(!anim); //The animation must have been deleted
delete object;
}
@@ -417,8 +417,8 @@ void tst_QPropertyAnimation::deletion2()
QVERIFY(anim);
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(runningSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 1);
+ QCOMPARE(finishedSpy.size(), 0);
//we can't call deletaLater directly because the delete would only happen in the next loop of _this_ event loop
QTimer::singleShot(0, object, SLOT(deleteLater()));
@@ -451,11 +451,11 @@ void tst_QPropertyAnimation::deletion3()
timeDriver.wait(50);
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(runningSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 1);
+ QCOMPARE(finishedSpy.size(), 0);
delete anim;
- QCOMPARE(runningSpy.count(), 2);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 2);
+ QCOMPARE(finishedSpy.size(), 0);
}
void tst_QPropertyAnimation::duration0()
@@ -547,7 +547,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
QVERIFY(runningSpy.isValid());
anim->start(QVariantAnimation::DeleteWhenStopped);
timeDriver.wait(anim->duration());
- QCOMPARE(runningSpy.count(), 2); //started and then stopped
+ QCOMPARE(runningSpy.size(), 2); //started and then stopped
QVERIFY(!anim);
}
{
@@ -559,7 +559,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning()
timeDriver.wait(anim->duration()/2);
QPointer<QVariantAnimation> anim2 = new QPropertyAnimation(&o, "ole");
anim2->setEndValue(100);
- QCOMPARE(runningSpy.count(), 1);
+ QCOMPARE(runningSpy.size(), 1);
QCOMPARE(anim->state(), QVariantAnimation::Running);
//anim2 will interrupt anim1
@@ -908,7 +908,7 @@ void tst_QPropertyAnimation::zeroDurationStart()
anim.start();
//the animation stops immediately
QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
- QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.size(), 2);
//let's check the first state change
const QVariantList firstChange = spy.first();
@@ -1193,8 +1193,8 @@ void tst_QPropertyAnimation::valueChanged()
QCOMPARE(anim.currentTime(), anim.duration());
//let's check that the values go forward
- QCOMPARE(spy.count(), 6); //we should have got everything from 0 to 5
- for (int i = 0; i < spy.count(); ++i) {
+ QCOMPARE(spy.size(), 6); //we should have got everything from 0 to 5
+ for (int i = 0; i < spy.size(); ++i) {
QCOMPARE(qvariant_cast<QVariant>(spy.at(i).first()).toInt(), i);
}
}
@@ -1324,15 +1324,15 @@ void tst_QPropertyAnimation::zeroLoopCount()
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
QCOMPARE(anim->currentValue().toInt(), 0);
- QCOMPARE(runningSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 0);
+ QCOMPARE(finishedSpy.size(), 0);
anim->start();
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
QCOMPARE(anim->currentValue().toInt(), 0);
- QCOMPARE(runningSpy.count(), 0);
- QCOMPARE(finishedSpy.count(), 0);
+ QCOMPARE(runningSpy.size(), 0);
+ QCOMPARE(finishedSpy.size(), 0);
}
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST
index f07c0ec4a1..79053cbf68 100644
--- a/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/BLACKLIST
@@ -1,5 +1,4 @@
[finishWithUncontrolledAnimation]
-windows-10 msvc-2015
macos
[groupWithZeroDurationAnimations]
macos
diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt b/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt
index e56f9f6ff8..e2ebe8baa9 100644
--- a/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/CMakeLists.txt
@@ -1,10 +1,19 @@
-# Generated from qsequentialanimationgroup.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qsequentialanimationgroup Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qsequentialanimationgroup LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
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 61be0d00f5..7555622162 100644
--- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -1,7 +1,9 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QTest>
+#include <QtTest/private/qpropertytesthelper_p.h>
+
#include <QVariantAnimation>
#include <QProperty>
#include <QPropertyAnimation>
@@ -551,8 +553,8 @@ using StateList = QList<QAbstractAnimation::State>;
static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates)
{
bool equals = true;
- for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) {
- if (i >= spy.count() || i >= expectedStates.count()) {
+ for (int i = 0; i < qMax(expectedStates.size(), spy.size()); ++i) {
+ if (i >= spy.size() || i >= expectedStates.size()) {
equals = false;
break;
}
@@ -567,14 +569,14 @@ static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates
if (!equals) {
const char *stateStrings[] = {"Stopped", "Paused", "Running"};
QString e,a;
- for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) {
- if (i < expectedStates.count()) {
+ for (int i = 0; i < qMax(expectedStates.size(), spy.size()); ++i) {
+ if (i < expectedStates.size()) {
int exp = int(expectedStates.at(i));
if (!e.isEmpty())
e += QLatin1String(", ");
e += QLatin1String(stateStrings[exp]);
}
- if (i < spy.count()) {
+ if (i < spy.size()) {
QList<QVariant> args = spy.at(i);
QAbstractAnimation::State actual = qvariant_cast<QAbstractAnimation::State>(args.value(1));
if (!a.isEmpty())
@@ -589,7 +591,7 @@ static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates
}
qDebug("\n"
"expected (count == %zd): %s\n"
- "actual (count == %zd): %s\n", size_t(expectedStates.count()), qPrintable(e), size_t(spy.count()), qPrintable(a));
+ "actual (count == %zd): %s\n", size_t(expectedStates.size()), qPrintable(e), size_t(spy.size()), qPrintable(a));
}
return equals;
}
@@ -636,8 +638,8 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped);
QCOMPARE(a3_s_o1->state(), QAnimationGroup::Paused);
- QCOMPARE(a1StateChangedSpy.count(), 5); // Running,Paused,Stopped,Running,Stopped
- QCOMPARE(seqStateChangedSpy.count(), 2); // Running,Paused
+ QCOMPARE(a1StateChangedSpy.size(), 5); // Running,Paused,Stopped,Running,Stopped
+ QCOMPARE(seqStateChangedSpy.size(), 2); // Running,Paused
QVERIFY(compareStates(a1StateChangedSpy, (StateList() << QAbstractAnimation::Running
<< QAbstractAnimation::Paused
@@ -678,7 +680,7 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
QCOMPARE(a3_s_o1->currentLoop(), 0);
QVERIFY(a3_s_o1->currentLoopTime() >= 1);
- QCOMPARE(seqStateChangedSpy.count(), 3); // Running,Paused,Running
+ QCOMPARE(seqStateChangedSpy.size(), 3); // Running,Paused,Running
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(seqStateChangedSpy.at(2).first()),
QAnimationGroup::Running);
@@ -699,13 +701,13 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
QCOMPARE(a3_s_o1->currentLoop(), 0);
QVERIFY(a3_s_o1->currentLoopTime() >= 1);
- QCOMPARE(seqStateChangedSpy.count(), 4); // Running,Paused,Running,Paused
+ QCOMPARE(seqStateChangedSpy.size(), 4); // Running,Paused,Running,Paused
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(seqStateChangedSpy.at(3).first()),
QAnimationGroup::Paused);
group.stop();
- QCOMPARE(seqStateChangedSpy.count(), 5); // Running,Paused,Running,Paused,Stopped
+ QCOMPARE(seqStateChangedSpy.size(), 5); // Running,Paused,Running,Paused,Stopped
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(seqStateChangedSpy.at(4).first()),
QAnimationGroup::Stopped);
}
@@ -749,7 +751,7 @@ void tst_QSequentialAnimationGroup::restart()
QTRY_COMPARE(group.state(), QAnimationGroup::Stopped);
for (int i = 0; i < 3; i++) {
- QCOMPARE(animsStateChanged[i]->count(), 4);
+ QCOMPARE(animsStateChanged[i]->size(), 4);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(animsStateChanged[i]->at(0).first()),
QAnimationGroup::Running);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(animsStateChanged[i]->at(1).first()),
@@ -760,22 +762,22 @@ void tst_QSequentialAnimationGroup::restart()
QAnimationGroup::Stopped);
}
- QCOMPARE(seqStateChangedSpy.count(), 2);
+ QCOMPARE(seqStateChangedSpy.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(seqStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(seqStateChangedSpy.at(1).first()),
QAnimationGroup::Stopped);
- QCOMPARE(seqCurrentAnimChangedSpy.count(), 6);
- for(int i=0; i<seqCurrentAnimChangedSpy.count(); i++)
+ QCOMPARE(seqCurrentAnimChangedSpy.size(), 6);
+ for(int i=0; i<seqCurrentAnimChangedSpy.size(); i++)
QCOMPARE(static_cast<QAbstractAnimation*>(anims[i%3]), qvariant_cast<QAbstractAnimation*>(seqCurrentAnimChangedSpy.at(i).at(0)));
group.start();
- QCOMPARE(animsStateChanged[0]->count(), 5);
- QCOMPARE(animsStateChanged[1]->count(), 4);
- QCOMPARE(animsStateChanged[2]->count(), 4);
- QCOMPARE(seqStateChangedSpy.count(), 3);
+ QCOMPARE(animsStateChanged[0]->size(), 5);
+ QCOMPARE(animsStateChanged[1]->size(), 4);
+ QCOMPARE(animsStateChanged[2]->size(), 4);
+ QCOMPARE(seqStateChangedSpy.size(), 3);
}
void tst_QSequentialAnimationGroup::looping()
@@ -831,21 +833,21 @@ void tst_QSequentialAnimationGroup::looping()
QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped);
QCOMPARE(a3_s_o1->state(), QAnimationGroup::Paused);
- QCOMPARE(a1Spy.count(), 5); // Running,Paused,Stopped,Running,Stopped
+ QCOMPARE(a1Spy.size(), 5); // Running,Paused,Stopped,Running,Stopped
QVERIFY(compareStates(a1Spy, (StateList() << QAbstractAnimation::Running
<< QAbstractAnimation::Paused
<< QAbstractAnimation::Stopped
<< QAbstractAnimation::Running
<< QAbstractAnimation::Stopped)));
- QCOMPARE(a2Spy.count(), 4); // Running,Stopped,Running,Stopped
+ QCOMPARE(a2Spy.size(), 4); // Running,Stopped,Running,Stopped
QVERIFY(compareStates(a3Spy, (StateList() << QAbstractAnimation::Running
<< QAbstractAnimation::Stopped
<< QAbstractAnimation::Running
<< QAbstractAnimation::Paused)));
- QCOMPARE(seqSpy.count(), 2); // Running,Paused
- QCOMPARE(groupSpy.count(), 2); // Running,Paused
+ QCOMPARE(seqSpy.size(), 2); // Running,Paused
+ QCOMPARE(groupSpy.size(), 2); // Running,Paused
// Looping, current time = duration + 1
group.setCurrentTime(group.duration() + 1);
@@ -866,8 +868,8 @@ void tst_QSequentialAnimationGroup::looping()
QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped);
QCOMPARE(a3_s_o1->state(), QAnimationGroup::Stopped);
- QCOMPARE(a1Spy.count(), 7); // Running,Paused,Stopped,Running,Stopped,Running,Stopped
- QCOMPARE(a2Spy.count(), 4); // Running, Stopped, Running, Stopped
+ QCOMPARE(a1Spy.size(), 7); // Running,Paused,Stopped,Running,Stopped,Running,Stopped
+ QCOMPARE(a2Spy.size(), 4); // Running, Stopped, Running, Stopped
QVERIFY(compareStates(a3Spy, (StateList() << QAbstractAnimation::Running
<< QAbstractAnimation::Stopped
<< QAbstractAnimation::Running
@@ -878,7 +880,7 @@ void tst_QSequentialAnimationGroup::looping()
<< QAbstractAnimation::Stopped
<< QAbstractAnimation::Running
<< QAbstractAnimation::Paused)));
- QCOMPARE(groupSpy.count(), 2);
+ QCOMPARE(groupSpy.size(), 2);
}
void tst_QSequentialAnimationGroup::startDelay()
@@ -1077,8 +1079,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
QVERIFY(groupStateChangedSpy.isValid());
QVERIFY(childStateChangedSpy.isValid());
- QCOMPARE(groupStateChangedSpy.count(), 0);
- QCOMPARE(childStateChangedSpy.count(), 0);
+ QCOMPARE(groupStateChangedSpy.size(), 0);
+ QCOMPARE(childStateChangedSpy.size(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(anim.state(), QAnimationGroup::Stopped);
@@ -1089,8 +1091,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim.state(), QAnimationGroup::Running);
- QCOMPARE(groupStateChangedSpy.count(), 1);
- QCOMPARE(childStateChangedSpy.count(), 1);
+ QCOMPARE(groupStateChangedSpy.size(), 1);
+ QCOMPARE(childStateChangedSpy.size(), 1);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(groupStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
@@ -1100,8 +1102,8 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
// starting directly a running child will not have any effect
anim.start();
- QCOMPARE(groupStateChangedSpy.count(), 1);
- QCOMPARE(childStateChangedSpy.count(), 1);
+ QCOMPARE(groupStateChangedSpy.size(), 1);
+ QCOMPARE(childStateChangedSpy.size(), 1);
anim.pause();
@@ -1244,8 +1246,8 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild()
QVERIFY(stateChangedSpy1.isValid());
QVERIFY(stateChangedSpy2.isValid());
- QCOMPARE(stateChangedSpy1.count(), 0);
- QCOMPARE(stateChangedSpy2.count(), 0);
+ QCOMPARE(stateChangedSpy1.size(), 0);
+ QCOMPARE(stateChangedSpy2.size(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(anim1->state(), QAnimationGroup::Stopped);
QCOMPARE(anim2->state(), QAnimationGroup::Stopped);
@@ -1283,7 +1285,7 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild()
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim2->state(), QAnimationGroup::Running);
- QCOMPARE(stateChangedSpy2.count(), 4);
+ QCOMPARE(stateChangedSpy2.size(), 4);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy2.at(2).first()),
QAnimationGroup::Stopped);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy2.at(3).first()),
@@ -1323,7 +1325,7 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation()
group.setLoopCount(2);
group.start();
- QCOMPARE(stateChangedSpy.count(), 2);
+ QCOMPARE(stateChangedSpy.size(), 2);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy.at(0).first()),
QAnimationGroup::Running);
QCOMPARE(qvariant_cast<QAbstractAnimation::State>(stateChangedSpy.at(1).first()),
@@ -1400,7 +1402,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
const int actualDuration = notTimeDriven.currentLoopTime();
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(group.currentLoopTime(), actualDuration);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
//2nd case:
// lets make sure the seeking will work again
@@ -1416,29 +1418,29 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
//3rd case:
//now let's add a perfectly defined animation at the end
- QCOMPARE(animStateChangedSpy.count(), 0);
+ QCOMPARE(animStateChangedSpy.size(), 0);
group.start();
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(notTimeDriven.state(), QAnimationGroup::Running);
QCOMPARE(group.currentLoopTime(), 0);
QCOMPARE(notTimeDriven.currentLoopTime(), 0);
- QCOMPARE(animStateChangedSpy.count(), 0);
+ QCOMPARE(animStateChangedSpy.size(), 0);
QTest::qWait(300); //wait for the end of notTimeDriven
QTRY_COMPARE(notTimeDriven.state(), QAnimationGroup::Stopped);
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim.state(), QAnimationGroup::Running);
QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
- QCOMPARE(animStateChangedSpy.count(), 1);
+ QCOMPARE(animStateChangedSpy.size(), 1);
QTest::qWait(300); //wait for the end of anim
QTRY_COMPARE(anim.state(), QAnimationGroup::Stopped);
QCOMPARE(anim.currentLoopTime(), anim.duration());
//we should simply be at the end
- QCOMPARE(spy.count(), 1);
- QCOMPARE(animStateChangedSpy.count(), 2);
+ QCOMPARE(spy.size(), 1);
+ QCOMPARE(animStateChangedSpy.size(), 2);
QCOMPARE(group.currentLoopTime(), notTimeDriven.currentLoopTime() + anim.currentLoopTime());
}
@@ -1623,7 +1625,7 @@ void tst_QSequentialAnimationGroup::pauseResume()
QTest::qWait(100);
QTRY_COMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
spy.clear();
const int currentTime = group.currentLoopTime();
QCOMPARE(anim->currentLoopTime(), currentTime);
@@ -1633,7 +1635,7 @@ void tst_QSequentialAnimationGroup::pauseResume()
QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Paused);
QCOMPARE(anim->currentLoopTime(), currentTime);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
spy.clear();
group.resume();
@@ -1641,7 +1643,7 @@ void tst_QSequentialAnimationGroup::pauseResume()
QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Running);
QCOMPARE(anim->currentLoopTime(), currentTime);
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
}
void tst_QSequentialAnimationGroup::bindings()
@@ -1667,24 +1669,33 @@ void tst_QSequentialAnimationGroup::bindings()
group.setCurrentTime(int(totalDuration * 0.5 / 3));
QCOMPARE(currentAnim.value(), anim1.get());
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.size(), 0);
group.setCurrentTime(int(totalDuration * 1.5 / 3));
QCOMPARE(currentAnim.value(), anim2.get());
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
// change to other style of formulating a binding to test both
currentAnim.setBinding(group.bindableCurrentAnimation().makeBinding());
group.setCurrentTime(int(totalDuration * 2.5 / 3));
QCOMPARE(currentAnim.value(), anim3.get());
- QCOMPARE(spy.count(), 2);
+ QCOMPARE(spy.size(), 2);
// currentAnimation is read-only. Binding it to something should have no effect
QProperty<QAbstractAnimation *> leader;
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)
diff --git a/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt b/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt
index 08fd743e33..9abc16040f 100644
--- a/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt
+++ b/tests/auto/corelib/animation/qvariantanimation/CMakeLists.txt
@@ -1,9 +1,16 @@
-# Generated from qvariantanimation.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## tst_qvariantanimation Test:
#####################################################################
+if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT)
+ cmake_minimum_required(VERSION 3.16)
+ project(tst_qvariantanimation LANGUAGES CXX)
+ find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST)
+endif()
+
qt_internal_add_test(tst_qvariantanimation
SOURCES
tst_qvariantanimation.cpp
diff --git a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp
index 2d8d674ba5..661c4b8108 100644
--- a/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp
+++ b/tests/auto/corelib/animation/qvariantanimation/tst_qvariantanimation.cpp
@@ -1,5 +1,5 @@
// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qvariantanimation.h>