From e84d8d2a81eb81f9b1ea9f40d4da36d09a97b246 Mon Sep 17 00:00:00 2001 From: Juan Jose Casafranca Date: Mon, 9 Jul 2018 16:02:11 +0200 Subject: Dont play animations that are disabled Change-Id: I5293ff8d16c511de79c4583783b238154af32f61 Task-number: QTBUG-69373 Reviewed-by: Paul Lemire --- .../tst_findrunningclipanimatorsjob.cpp | 56 ++++++++++++++++++---- 1 file changed, 47 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp index ce37ffc76..50c0eb524 100644 --- a/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp +++ b/tests/auto/animation/findrunningclipanimatorsjob/tst_findrunningclipanimatorsjob.cpp @@ -120,14 +120,14 @@ private Q_SLOTS: QTest::addColumn>("dirtyClipAnimators"); QTest::addColumn("expectedResults"); - Handler *handler; - AnimationClip *clip; - ClipAnimator *animator; - QVector dirtyClipAnimators; - ChannelMapper *channelMapper; - MappingDataResults expectedResults; { + Handler *handler; + AnimationClip *clip; + ClipAnimator *animator; + QVector dirtyClipAnimators; + ChannelMapper *channelMapper; + MappingDataResults expectedResults; handler = new Handler(); clip = createAnimationClipLoader(handler, QUrl("qrc:/clip1.json")); @@ -150,6 +150,7 @@ private Q_SLOTS: channelMapper = createChannelMapper(handler, QVector() << channelMapping->peerId()); animator->setMapperId(channelMapper->peerId()); animator->setRunning(true); // Has to be marked as running for the job to process it + animator->setEnabled(true); // Has to be marked as enabled for the job to process it const ComponentIndices locationIndices = { 0, 1, 2 }; MappingData expectedMapping; @@ -160,9 +161,46 @@ private Q_SLOTS: expectedResults.insert(animator, QVector() << expectedMapping); QTest::newRow("single mapping") - << handler - << dirtyClipAnimators - << expectedResults; + << handler + << dirtyClipAnimators + << expectedResults; + } + + { + Handler *handler; + AnimationClip *clip; + ClipAnimator *animator; + QVector dirtyClipAnimators; + ChannelMapper *channelMapper; + MappingDataResults expectedResults; + handler = new Handler(); + clip = createAnimationClipLoader(handler, QUrl("qrc:/clip1.json")); + + const qint64 globalStartTimeNS = 0; + const int loops = 1; + animator = createClipAnimator(handler, globalStartTimeNS, loops); + animator->setClipId(clip->peerId()); + dirtyClipAnimators = (QVector() + << handler->clipAnimatorManager()->getOrAcquireHandle(animator->peerId())); + + auto channelMapping = createChannelMapping(handler, + QLatin1String("Location"), + Qt3DCore::QNodeId::createId(), + QLatin1String("translation"), + "translation", + static_cast(QVariant::Vector3D)); + QVector channelMappings; + channelMappings.push_back(channelMapping); + + channelMapper = createChannelMapper(handler, QVector() << channelMapping->peerId()); + animator->setMapperId(channelMapper->peerId()); + animator->setRunning(true); // Has to be marked as running for the job to process it + animator->setEnabled(false); // Has to be marked as enabled for the job to process it + + QTest::newRow("disabled animator") + << handler + << dirtyClipAnimators + << expectedResults; } } -- cgit v1.2.3