diff options
Diffstat (limited to 'tests/auto/qml/animation')
11 files changed, 110 insertions, 189 deletions
diff --git a/tests/auto/qml/animation/CMakeLists.txt b/tests/auto/qml/animation/CMakeLists.txt index 7337777b9c..090c93716c 100644 --- a/tests/auto/qml/animation/CMakeLists.txt +++ b/tests/auto/qml/animation/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from animation.pro. add_subdirectory(qabstractanimationjob) diff --git a/tests/auto/qml/animation/qabstractanimationjob/CMakeLists.txt b/tests/auto/qml/animation/qabstractanimationjob/CMakeLists.txt index eb70a77bfd..9e6ba7fcb6 100644 --- a/tests/auto/qml/animation/qabstractanimationjob/CMakeLists.txt +++ b/tests/auto/qml/animation/qabstractanimationjob/CMakeLists.txt @@ -1,13 +1,22 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qabstractanimationjob.pro. ##################################################################### ## tst_qabstractanimationjob Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qabstractanimationjob LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qabstractanimationjob SOURCES tst_qabstractanimationjob.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::QmlPrivate ) diff --git a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp index 7e19e925b6..40eb8a6910 100644 --- a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp +++ b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtQml/private/qabstractanimationjob_p.h> @@ -54,10 +29,10 @@ class TestableQAbstractAnimation : public QAbstractAnimationJob { public: TestableQAbstractAnimation() {} - virtual ~TestableQAbstractAnimation() {}; + ~TestableQAbstractAnimation() override {}; - int duration() const { return m_duration; } - virtual void updateCurrentTime(int) {} + int duration() const override { return m_duration; } + void updateCurrentTime(int) override {} void setDuration(int duration) { m_duration = duration; } private: @@ -67,8 +42,8 @@ private: class DummyQAnimationGroup : public QAnimationGroupJob { public: - int duration() const { return 10; } - virtual void updateCurrentTime(int) {} + int duration() const override { return 10; } + void updateCurrentTime(int) override {} }; void tst_QAbstractAnimationJob::construction() @@ -78,8 +53,7 @@ void tst_QAbstractAnimationJob::construction() void tst_QAbstractAnimationJob::destruction() { - TestableQAbstractAnimation *anim = new TestableQAbstractAnimation; - delete anim; + std::unique_ptr<TestableQAbstractAnimation> anim = std::make_unique<TestableQAbstractAnimation>(); } void tst_QAbstractAnimationJob::currentLoop() diff --git a/tests/auto/qml/animation/qanimationgroupjob/CMakeLists.txt b/tests/auto/qml/animation/qanimationgroupjob/CMakeLists.txt index e7b979decb..db46ef71dc 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/CMakeLists.txt +++ b/tests/auto/qml/animation/qanimationgroupjob/CMakeLists.txt @@ -1,13 +1,22 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qanimationgroupjob.pro. ##################################################################### ## tst_qanimationgroupjob Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qanimationgroupjob LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qanimationgroupjob SOURCES tst_qanimationgroupjob.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::QmlPrivate ) diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp index ceb8cc707f..a3fe188b65 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -61,7 +36,7 @@ class TestableGenericAnimation : public QAbstractAnimationJob { public: TestableGenericAnimation(int duration = 250) : m_duration(duration) {} - int duration() const { return m_duration; } + int duration() const override { return m_duration; } private: int m_duration; @@ -73,10 +48,10 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob public: UncontrolledAnimation() { } - int duration() const { return -1; /* not time driven */ } + int duration() const override { return -1; /* not time driven */ } protected: - void timerEvent(QTimerEvent *event) + void timerEvent(QTimerEvent *event) override { if (event->timerId() == id) stop(); @@ -99,14 +74,14 @@ private: class StateChangeListener: public QAnimationJobChangeListener { public: - virtual void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State) + void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State) override { states << newState; } int count() { - return states.count(); + return states.size(); } QList<QAbstractAnimationJob::State> states; @@ -261,7 +236,7 @@ void tst_QAnimationGroupJob::addChildTwice() { QAbstractAnimationJob *subGroup; QAbstractAnimationJob *subGroup2; - auto *parent = new QSequentialAnimationGroupJob(); + auto parent = std::make_unique<QSequentialAnimationGroupJob>(); subGroup = new QAbstractAnimationJob; parent->appendAnimation(subGroup); @@ -291,7 +266,6 @@ void tst_QAnimationGroupJob::addChildTwice() QCOMPARE(parent->children()->first(), subGroup2); QCOMPARE(parent->children()->last(), subGroup); - delete parent; } QTEST_MAIN(tst_QAnimationGroupJob) diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/CMakeLists.txt b/tests/auto/qml/animation/qparallelanimationgroupjob/CMakeLists.txt index 07ef4c2224..0a275aaaa1 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/CMakeLists.txt +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/CMakeLists.txt @@ -1,13 +1,22 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qparallelanimationgroupjob.pro. ##################################################################### ## tst_qparallelanimationgroupjob Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qparallelanimationgroupjob LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qparallelanimationgroupjob SOURCES tst_qparallelanimationgroupjob.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::Gui Qt::GuiPrivate diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index c6e2545ebf..91c47586c1 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -124,7 +99,7 @@ public: } void clear() { states.clear(); } - int count() { return states.count(); } + int count() { return states.size(); } QList<QAbstractAnimationJob::State> states; }; @@ -420,8 +395,8 @@ void tst_QParallelAnimationGroupJob::deleteChildrenWithRunningGroup() // test if children can be activated when their group is stopped QParallelAnimationGroupJob group; - TestAnimation *anim1 = new TestAnimation(200); - group.appendAnimation(anim1); + std::unique_ptr<TestAnimation> anim1 = std::make_unique<TestAnimation>(200); + group.appendAnimation(anim1.get()); QCOMPARE(group.duration(), anim1->duration()); @@ -431,7 +406,7 @@ void tst_QParallelAnimationGroupJob::deleteChildrenWithRunningGroup() QTRY_VERIFY(group.currentLoopTime() > 0); - delete anim1; + anim1.reset(); QVERIFY(group.children()->isEmpty()); QCOMPARE(group.duration(), 0); QCOMPARE(group.state(), QAnimationGroupJob::Stopped); @@ -818,34 +793,34 @@ void tst_QParallelAnimationGroupJob::addAndRemoveDuration() { QParallelAnimationGroupJob group; QCOMPARE(group.duration(), 0); - TestAnimation *test = new TestAnimation(250); // 0, duration = 250; - group.appendAnimation(test); + std::unique_ptr<TestAnimation> test = std::make_unique<TestAnimation>(250); // 0, duration = 250; + group.appendAnimation(test.get()); QCOMPARE(test->group(), static_cast<QAnimationGroupJob*>(&group)); QCOMPARE(test->duration(), 250); QCOMPARE(group.duration(), 250); - TestAnimation *test2 = new TestAnimation(750); // 1 - group.appendAnimation(test2); + std::unique_ptr<TestAnimation> test2 = std::make_unique<TestAnimation>(750); // 1 + group.appendAnimation(test2.get()); QCOMPARE(test2->group(), static_cast<QAnimationGroupJob*>(&group)); QCOMPARE(group.duration(), 750); - TestAnimation *test3 = new TestAnimation(500); // 2 - group.appendAnimation(test3); + std::unique_ptr<TestAnimation> test3 = std::make_unique<TestAnimation>(500); // 2 + group.appendAnimation(test3.get()); QCOMPARE(test3->group(), static_cast<QAnimationGroupJob*>(&group)); QCOMPARE(group.duration(), 750); - group.removeAnimation(test2); // remove the one with duration = 750 - delete test2; + group.removeAnimation(test2.get()); // remove the one with duration = 750 + test2.reset(); QCOMPARE(group.duration(), 500); - group.removeAnimation(test3); // remove the one with duration = 500 - delete test3; + group.removeAnimation(test3.get()); // remove the one with duration = 500 + test3.reset(); QCOMPARE(group.duration(), 250); - group.removeAnimation(test); // remove the last one (with duration = 250) + group.removeAnimation(test.get()); // remove the last one (with duration = 250) QCOMPARE(test->group(), static_cast<QAnimationGroupJob*>(nullptr)); QCOMPARE(group.duration(), 0); - delete test; + test.reset(); } void tst_QParallelAnimationGroupJob::pauseResume() @@ -903,16 +878,16 @@ void tst_QParallelAnimationGroupJob::pauseResume() void tst_QParallelAnimationGroupJob::crashWhenRemovingUncontrolledAnimation() { QParallelAnimationGroupJob group; - TestAnimation *anim = new TestAnimation; + std::unique_ptr<TestAnimation> anim = std::make_unique<TestAnimation>(); anim->setLoopCount(-1); - TestAnimation *anim2 = new TestAnimation; + std::unique_ptr<TestAnimation> anim2 = std::make_unique<TestAnimation>(); anim2->setLoopCount(-1); - group.appendAnimation(anim); - group.appendAnimation(anim2); + group.appendAnimation(anim.get()); + group.appendAnimation(anim2.get()); group.start(); - delete anim; + anim.reset(); // it would crash here because the internals of the group would still have a reference to anim - delete anim2; + anim2.reset(); } void tst_QParallelAnimationGroupJob::uncontrolledWithLoops() diff --git a/tests/auto/qml/animation/qpauseanimationjob/CMakeLists.txt b/tests/auto/qml/animation/qpauseanimationjob/CMakeLists.txt index c63d3e936a..2dc9e42f90 100644 --- a/tests/auto/qml/animation/qpauseanimationjob/CMakeLists.txt +++ b/tests/auto/qml/animation/qpauseanimationjob/CMakeLists.txt @@ -1,13 +1,22 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qpauseanimationjob.pro. ##################################################################### ## tst_qpauseanimationjob Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qpauseanimationjob LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qpauseanimationjob SOURCES tst_qpauseanimationjob.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::GuiPrivate Qt::QmlPrivate diff --git a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp index dba6e531be..c658f590c9 100644 --- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp +++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -114,7 +89,7 @@ void tst_QPauseAnimationJob::changeDirectionWhileRunning() QTest::qWait(100); QCOMPARE(animation.state(), QAbstractAnimationJob::Running); animation.setDirection(QAbstractAnimationJob::Backward); - QTest::qWait(animation.totalDuration() + 50); + QTest::qWait(animation.totalDuration() + 100); QCOMPARE(animation.state(), QAbstractAnimationJob::Stopped); } @@ -142,7 +117,7 @@ void tst_QPauseAnimationJob::noTimerUpdates() animation.start(); QTest::qWait(animation.totalDuration() + 100); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) if (animation.state() != QAbstractAnimationJob::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif @@ -171,7 +146,7 @@ void tst_QPauseAnimationJob::multiplePauseAnimations() animation2.start(); QTest::qWait(animation.totalDuration() + 100); -#ifdef Q_OS_WIN +#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) if (animation.state() != QAbstractAnimationJob::Stopped) QEXPECT_FAIL("", timerError, Abort); #endif diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/CMakeLists.txt b/tests/auto/qml/animation/qsequentialanimationgroupjob/CMakeLists.txt index 54da6e6569..fa7ad06a03 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/CMakeLists.txt +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/CMakeLists.txt @@ -1,13 +1,22 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + # Generated from qsequentialanimationgroupjob.pro. ##################################################################### ## tst_qsequentialanimationgroupjob Test: ##################################################################### +if(NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qsequentialanimationgroupjob LANGUAGES CXX) + find_package(Qt6BuildInternals REQUIRED COMPONENTS STANDALONE_TEST) +endif() + qt_internal_add_test(tst_qsequentialanimationgroupjob SOURCES tst_qsequentialanimationgroupjob.cpp - PUBLIC_LIBRARIES + LIBRARIES Qt::CorePrivate Qt::QmlPrivate ) diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp index d870c9d4da..71aa2240ff 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> #include <QtQml/private/qsequentialanimationgroupjob_p.h> @@ -135,13 +110,13 @@ public: { states << newState; if (beEvil) { - delete job->group(); + delete job->group(); //manual delete intentional groupDeleted = true; } } void clear() { states.clear(); } - int count() const { return states.count(); } + int count() const { return states.size(); } QList<QAbstractAnimationJob::State> states; bool beEvil = false; @@ -587,8 +562,8 @@ typedef QList<QAbstractAnimationJob::State> StateList; static bool compareStates(const StateChangeListener& 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.count()); ++i) { + if (i >= spy.count() || i >= expectedStates.size()) { equals = false; break; } @@ -602,8 +577,8 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec 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.count()); ++i) { + if (i < expectedStates.size()) { int exp = int(expectedStates.at(i)); if (!e.isEmpty()) e += QLatin1String(", "); @@ -621,7 +596,7 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec } } - qDebug().noquote() << "\nexpected (count == " << expectedStates.count() << "): " << e + qDebug().noquote() << "\nexpected (count == " << expectedStates.size() << "): " << e << "\nactual (count == " << spy.count() << "): " << a << "\n"; } return equals; @@ -1115,8 +1090,8 @@ void tst_QSequentialAnimationGroupJob::deleteChildrenWithRunningGroup() // test if children can be activated when their group is stopped QSequentialAnimationGroupJob group; - TestAnimation *anim1 = new TestAnimation(200); - group.appendAnimation(anim1); + std::unique_ptr<TestAnimation> anim1 = std::make_unique<TestAnimation>(200); + group.appendAnimation(anim1.get()); QCOMPARE(group.duration(), anim1->duration()); @@ -1127,7 +1102,7 @@ void tst_QSequentialAnimationGroupJob::deleteChildrenWithRunningGroup() QTest::qWait(100); QTRY_VERIFY(group.currentLoopTime() > 0); - delete anim1; + anim1.reset(); QVERIFY(group.children()->isEmpty()); QCOMPARE(group.duration(), 0); QCOMPARE(group.state(), QAnimationGroupJob::Stopped); |