summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJuan Jose Casafranca <juan.casafranca@kdab.com>2019-02-09 18:12:00 +0100
committerJuan José Casafranca <juan.casafranca@kdab.com>2019-02-22 09:45:14 +0000
commit22c66fa9f7a460f077fede22f285c84276ce3883 (patch)
tree4279a2705fe60d344500d50ef29f9e8baf41f8cd /tests
parenta075f064f0d8a0bb9d467a813ef2eacf39453ec2 (diff)
Use slerp for animating rotation channels
Change-Id: Ic6aa6fd1c1a1e7757dba9466b59d20834b56e246 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/animation/animationutils/animationutils.qrc1
-rw-r--r--tests/auto/animation/animationutils/clip2.json4
-rw-r--r--tests/auto/animation/animationutils/clip6.json82
-rw-r--r--tests/auto/animation/animationutils/tst_animationutils.cpp11
4 files changed, 96 insertions, 2 deletions
diff --git a/tests/auto/animation/animationutils/animationutils.qrc b/tests/auto/animation/animationutils/animationutils.qrc
index 0b499ed76..af041e8a3 100644
--- a/tests/auto/animation/animationutils/animationutils.qrc
+++ b/tests/auto/animation/animationutils/animationutils.qrc
@@ -5,5 +5,6 @@
<file>clip3.json</file>
<file>clip4.json</file>
<file>clip5.json</file>
+ <file>clip6.json</file>
</qresource>
</RCC>
diff --git a/tests/auto/animation/animationutils/clip2.json b/tests/auto/animation/animationutils/clip2.json
index 3faff409c..4c70f8493 100644
--- a/tests/auto/animation/animationutils/clip2.json
+++ b/tests/auto/animation/animationutils/clip2.json
@@ -242,9 +242,9 @@
]
}
],
- "channelName": "Rotation"
+ "channelName": "rotation"
}
]
}
]
-} \ No newline at end of file
+}
diff --git a/tests/auto/animation/animationutils/clip6.json b/tests/auto/animation/animationutils/clip6.json
new file mode 100644
index 000000000..ba521df55
--- /dev/null
+++ b/tests/auto/animation/animationutils/clip6.json
@@ -0,0 +1,82 @@
+{
+ "animations": [
+ {
+ "animationName": "Rotation",
+ "channels": [
+ {
+ "channelComponents": [
+ {
+ "channelComponentName": "W",
+ "keyFrames": [
+ {
+ "coords": [
+ 0.0,
+ 1.0
+ ]
+ },
+ {
+ "coords": [
+ 10.0,
+ 0.707
+ ]
+ }
+ ]
+ },
+ {
+ "channelComponentName": "X",
+ "keyFrames": [
+ {
+ "coords": [
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "coords": [
+ 10.0,
+ 0.707
+ ]
+ }
+ ]
+ },
+ {
+ "channelComponentName": "Y",
+ "keyFrames": [
+ {
+ "coords": [
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "coords": [
+ 10.0,
+ 0.0
+ ]
+ }
+ ]
+ },
+ {
+ "channelComponentName": "Z",
+ "keyFrames": [
+ {
+ "coords": [
+ 0.0,
+ 0.0
+ ]
+ },
+ {
+ "coords": [
+ 10.0,
+ 0.0
+ ]
+ }
+ ]
+ }
+ ],
+ "channelName": "Rotation"
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp
index 75ae65ea7..ee393b366 100644
--- a/tests/auto/animation/animationutils/tst_animationutils.cpp
+++ b/tests/auto/animation/animationutils/tst_animationutils.cpp
@@ -1248,6 +1248,17 @@ private Q_SLOTS:
<< handler << clip << localTime << expectedResults;
expectedResults.clear();
}
+ {
+ // a clip with slerp interpolation
+ handler = new Handler();
+ clip = createAnimationClipLoader(handler, QUrl("qrc:/clip6.json"));
+ localTime = clip->duration() / 2.0f;
+ expectedResults = QVector<float>() << 0.923822f << 0.382626f << 0.0f << 0.0f;
+
+ QTest::newRow("clip6.json, slerp, t = duration/2")
+ << handler << clip << localTime << expectedResults;
+ expectedResults.clear();
+ }
}
void checkEvaluateClipAtLocalTime()