summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChip Collier <gregory.collier@kdab.com>2017-07-24 17:06:44 +0200
committerSean Harmer <sean.harmer@kdab.com>2017-08-02 14:34:52 +0000
commit4392fa4df4a8f4623dd3ff881f2dd03c94b50c30 (patch)
tree7435dcc724b6c93c5cb0524cfce541e83c480c51 /tests
parent2dcc0f8fdd118acdb00b3958b6c230415fd28ca5 (diff)
Fix Qt3DAnimation::Animation::Clock::playbackRate
Fixes a small bug, removes unused properties from the clock node (`startTime`) and changes the type of the `playbackRate` property from `float` to `double` to match the rest of the animation aspect. QClockPrivate is no longer responsible for emitting the playbackRateChanged signal. Tests updated to account for this. [ChangeLog][Qt3DAnimation][Bugfix] The backend node (`Qt3DAnimation::Animation::Clock`) had an incorrect return type specified (`int` instead of `float`) which was narrowing the actual value during the evaluation of associated animation clips. Change-Id: I53ec78ba289cafcd2055582bee23ff1fc3481317 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/animation/clock/tst_clock.cpp8
-rw-r--r--tests/auto/animation/qclock/tst_qclock.cpp12
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/auto/animation/clock/tst_clock.cpp b/tests/auto/animation/clock/tst_clock.cpp
index fa9b5892f..547ec6a12 100644
--- a/tests/auto/animation/clock/tst_clock.cpp
+++ b/tests/auto/animation/clock/tst_clock.cpp
@@ -47,7 +47,7 @@ private Q_SLOTS:
Qt3DAnimation::Animation::Clock backendClock;
Qt3DAnimation::QClock clock;
- clock.setPlaybackRate(10.f);
+ clock.setPlaybackRate(10.5);
// WHEN
simulateInitialization(&clock, &backendClock);
@@ -62,18 +62,18 @@ private Q_SLOTS:
Qt3DAnimation::Animation::Clock backendClock;
// THEN
- QCOMPARE(backendClock.playbackRate(), 1.f);
+ QCOMPARE(backendClock.playbackRate(), 1.0);
// GIVEN
Qt3DAnimation::QClock clock;
- clock.setPlaybackRate(10.f);
+ clock.setPlaybackRate(10.5);
// WHEN
simulateInitialization(&clock, &backendClock);
backendClock.cleanup();
// THEN
- QCOMPARE(backendClock.playbackRate(), 1.f);
+ QCOMPARE(backendClock.playbackRate(), 1.0);
}
};
diff --git a/tests/auto/animation/qclock/tst_qclock.cpp b/tests/auto/animation/qclock/tst_qclock.cpp
index 048073066..34c70da7b 100644
--- a/tests/auto/animation/qclock/tst_qclock.cpp
+++ b/tests/auto/animation/qclock/tst_qclock.cpp
@@ -53,7 +53,7 @@ private Q_SLOTS:
Qt3DAnimation::QClock clock;
// THEN
- QCOMPARE(clock.playbackRate(), 1.f);
+ QCOMPARE(clock.playbackRate(), 1.0);
}
void checkPropertyChanges()
@@ -62,8 +62,8 @@ private Q_SLOTS:
Qt3DAnimation::QClock clock;
// WHEN
- QSignalSpy spy(&clock, SIGNAL(playbackRateChanged(float)));
- const float newValue = 5.f;
+ QSignalSpy spy(&clock, SIGNAL(playbackRateChanged(double)));
+ const double newValue = 5.5;
clock.setPlaybackRate(newValue);
// THEN
@@ -136,7 +136,7 @@ private Q_SLOTS:
{
// WHEN
- clock.setPlaybackRate(10.f);
+ clock.setPlaybackRate(10.5);
QCoreApplication::processEvents();
// THEN
@@ -144,14 +144,14 @@ private Q_SLOTS:
auto change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>();
QCOMPARE(change->propertyName(), "playbackRate");
QCOMPARE(change->type(), Qt3DCore::PropertyUpdated);
- QCOMPARE(change->value().value<float>(), clock.playbackRate());
+ QCOMPARE(change->value().value<double>(), clock.playbackRate());
arbiter.events.clear();
}
{
// WHEN
- clock.setPlaybackRate(10.f);
+ clock.setPlaybackRate(10.5f);
QCoreApplication::processEvents();
// THEN