summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJuan Jose Casafranca <juan.casafranca@kdab.com>2018-07-28 14:44:50 +0200
committerJuan José Casafranca <juan.casafranca@kdab.com>2018-07-31 16:44:52 +0000
commit6caecac1c8ad88cec373f7f7ea14cab9931ed2a1 (patch)
treec88d1870c97ff3dd1491ba25085a9d639d510f7c /tests
parented1ca081f0b0ae765c469bae5fe8849477c7b144 (diff)
Enable ConstantInterpolation for fcurves
Change-Id: If51c8377f5b29433feaa520a7586f0608b7510f1 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/animation/fcurve/tst_fcurve.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/animation/fcurve/tst_fcurve.cpp b/tests/auto/animation/fcurve/tst_fcurve.cpp
index e3e8db50d..c2dbe33aa 100644
--- a/tests/auto/animation/fcurve/tst_fcurve.cpp
+++ b/tests/auto/animation/fcurve/tst_fcurve.cpp
@@ -90,9 +90,31 @@ private Q_SLOTS:
QCOMPARE(fcurve.endTime(), 0.0f);
}
+ void checkEvaluateAtTime_data()
+ {
+
+ QTest::addColumn<float>("time");
+ QTest::addColumn<float>("expectedValue");
+
+ QTest::addRow("Constant_before_time") << 0.0f << 1.0f;
+ QTest::addRow("Constant_1.5") << 1.5f << 1.0f;
+ QTest::addRow("Constant_2.5") << 2.5f << 2.0f;
+ QTest::addRow("Constant_after_time") << 3.5f << 4.0f;
+ }
+
void checkEvaluateAtTime()
{
+ QFETCH(float, time);
+ QFETCH(float, expectedValue);
+
+ FCurve curve;
+ curve.appendKeyframe(1.0, Keyframe{1.0, {0.0, 0.0}, {0.0,0.0}, QKeyFrame::ConstantInterpolation});
+ curve.appendKeyframe(2.0, Keyframe{2.0, {0.0, 0.0}, {0.0,0.0}, QKeyFrame::ConstantInterpolation});
+ curve.appendKeyframe(3.0, Keyframe{4.0, {0.0, 0.0}, {0.0,0.0}, QKeyFrame::ConstantInterpolation});
+
+ float actualValue = curve.evaluateAtTime(time);
+ QCOMPARE(expectedValue, actualValue);
}
};