diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-14 13:05:10 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2017-06-14 14:36:16 +0000 |
commit | 86148b286b2a562f44ca517c96a1c78d8d0eae31 (patch) | |
tree | 5190c63d3f9088a367f0c11fe80c0bff8d307c1d /tests | |
parent | d7cf1685706a19e2455e178c52646c8a54b751e5 (diff) |
Add support for linear interpolation in clip json
...and add an autotest
Change-Id: I5c473f5f5918db9cc108f9966fe549e2cba374de
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/animation/animationutils/animationutils.qrc | 1 | ||||
-rw-r--r-- | tests/auto/animation/animationutils/clip4.json | 65 | ||||
-rw-r--r-- | tests/auto/animation/animationutils/tst_animationutils.cpp | 22 |
3 files changed, 88 insertions, 0 deletions
diff --git a/tests/auto/animation/animationutils/animationutils.qrc b/tests/auto/animation/animationutils/animationutils.qrc index bbcd96524..ddaeab7f1 100644 --- a/tests/auto/animation/animationutils/animationutils.qrc +++ b/tests/auto/animation/animationutils/animationutils.qrc @@ -3,5 +3,6 @@ <file>clip1.json</file> <file>clip2.json</file> <file>clip3.json</file> + <file>clip4.json</file> </qresource> </RCC> diff --git a/tests/auto/animation/animationutils/clip4.json b/tests/auto/animation/animationutils/clip4.json new file mode 100644 index 000000000..0915294cd --- /dev/null +++ b/tests/auto/animation/animationutils/clip4.json @@ -0,0 +1,65 @@ +{ + "animations": [ + { + "animationName": "LinearTranslation", + "channels": [ + { + "channelComponents": [ + { + "channelComponentName": "Location X", + "keyFrames": [ + { + "coords": [ + 0.0, + 0.0 + ] + }, + { + "coords": [ + 10.0, + 5.0 + ] + } + ] + }, + { + "channelComponentName": "Location Y", + "keyFrames": [ + { + "coords": [ + 0.0, + 0.0 + ] + }, + { + "coords": [ + 10.0, + -2.0 + ] + } + ] + }, + { + "channelComponentName": "Location Z", + "keyFrames": [ + { + "coords": [ + 0.0, + 0.0 + ] + }, + { + "coords": [ + 10.0, + 6.0 + ] + } + ] + } + ], + "channelName": "Location" + } + ] + } + ] +} diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp index fea110856..4c97cf7e5 100644 --- a/tests/auto/animation/animationutils/tst_animationutils.cpp +++ b/tests/auto/animation/animationutils/tst_animationutils.cpp @@ -1186,6 +1186,28 @@ private Q_SLOTS: << handler << clip << localTime << expectedResults; expectedResults.clear(); } + { + // a clip with linear interpolation + handler = new Handler(); + clip = createAnimationClipLoader(handler, QUrl("qrc:/clip4.json")); + localTime = clip->duration(); + expectedResults = QVector<float>() << 5.0 << -2.0f << 6.0f; + + QTest::newRow("clip4.json, linear, t = duration") + << handler << clip << localTime << expectedResults; + expectedResults.clear(); + } + { + // a clip with linear interpolation + handler = new Handler(); + clip = createAnimationClipLoader(handler, QUrl("qrc:/clip4.json")); + localTime = clip->duration() / 2.0f; + expectedResults = QVector<float>() << 2.5f << -1.0f << 3.0f; + + QTest::newRow("clip4.json, linear, t = duration/2") + << handler << clip << localTime << expectedResults; + expectedResults.clear(); + } } void checkEvaluateClipAtLocalTime() |