summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2014-07-30 08:24:49 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-09-02 23:19:44 +0200
commitec5f402cfd0bc439cd373ca8c99c59cb11556966 (patch)
treedd6d7490c7a70dd8dbc11a7162478e8fa0183948 /tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
parente12f6a47a530219261165f81880d01484320e98d (diff)
QEasingCurve: The setting order of properties should not matter.
Previously, this failed because QEasingCurveFunction only had a linear behavior. The fix is to change that and let QEasingCurveFunction handle any of the simple "non-parametric easing" functions. Task-number: QTBUG-38686 Change-Id: I666d59e10ceb589dcc52956b16a6f0c259aebdad Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp')
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
index 3f46b92ec9..7311244ae7 100644
--- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
@@ -59,6 +59,7 @@ private slots:
void operators();
void properties();
void metaTypes();
+ void propertyOrderIsNotImportant();
void bezierSpline_data();
void bezierSpline();
void tcbSpline_data();
@@ -560,6 +561,25 @@ void tst_QEasingCurve::metaTypes()
QVERIFY(qMetaTypeId<QEasingCurve>() == QMetaType::QEasingCurve);
}
+/*
+ Test to ensure that regardless of what order properties are set, they should produce the same
+ behavior.
+ */
+void tst_QEasingCurve::propertyOrderIsNotImportant()
+{
+
+ QEasingCurve c1;
+ c1.setPeriod(1);
+ c1.setType(QEasingCurve::OutSine);
+ QVERIFY(c1.valueForProgress(0.75) > 0.9);
+
+ QEasingCurve c2;
+ c2.setType(QEasingCurve::OutSine);
+ c2.setPeriod(1);
+
+ QCOMPARE(c1.valueForProgress(0.75), c2.valueForProgress(0.75));
+}
+
void tst_QEasingCurve::bezierSpline_data()
{
QTest::addColumn<QString>("definition");