diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-02-26 02:02:15 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2010-02-26 02:44:10 (GMT) |
commit | 760235ef89fb72ce2559b8f0dbd267fe04fab2da (patch) | |
tree | 92ea51a0f24adb4d79f888847e0c5fb583b806a7 /tests/auto/qdatastream | |
parent | b5700759da7bccf0ccd6e20b1727950532894ad2 (diff) | |
download | Qt-760235ef89fb72ce2559b8f0dbd267fe04fab2da.zip Qt-760235ef89fb72ce2559b8f0dbd267fe04fab2da.tar.gz Qt-760235ef89fb72ce2559b8f0dbd267fe04fab2da.tar.bz2 |
Move QEasingCurve datastream autotest to qdatastream for more comprehensive tests
Diffstat (limited to 'tests/auto/qdatastream')
-rw-r--r-- | tests/auto/qdatastream/tst_qdatastream.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index c94ea7b..31e12fe 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -162,6 +162,9 @@ private slots: void stream_QIcon_data(); void stream_QIcon(); + void stream_QEasingCurve_data(); + void stream_QEasingCurve(); + void stream_atEnd_data(); void stream_atEnd(); @@ -243,6 +246,7 @@ private: void writeqint64(QDataStream *s); void writeQWMatrix(QDataStream *s); void writeQIcon(QDataStream *s); + void writeQEasingCurve(QDataStream *s); void readbool(QDataStream *s); void readQBool(QDataStream *s); @@ -272,6 +276,7 @@ private: void readqint64(QDataStream *s); void readQWMatrix(QDataStream *s); void readQIcon(QDataStream *s); + void readQEasingCurve(QDataStream *s); private: QString svgFile; @@ -687,6 +692,70 @@ void tst_QDataStream::readHash(QDataStream *s) // ************************************ +static QEasingCurve QEasingCurveData(int index) +{ + QEasingCurve easing; + + switch (index) { + case 0: + default: + break; + case 1: + easing.setType(QEasingCurve::Linear); + break; + case 2: + easing.setType(QEasingCurve::OutCubic); + break; + case 3: + easing.setType(QEasingCurve::InOutSine); + break; + case 4: + easing.setType(QEasingCurve::InOutElastic); + easing.setPeriod(1.5); + easing.setAmplitude(2.0); + break; + case 5: + easing.setType(QEasingCurve::OutInBack); + break; + case 6: + easing.setType(QEasingCurve::OutCurve); + break; + case 7: + easing.setType(QEasingCurve::InOutBack); + easing.setOvershoot(0.5); + break; + } + return easing; +} +#define MAX_EASING_DATA 8 + +void tst_QDataStream::stream_QEasingCurve_data() +{ + stream_data(MAX_EASING_DATA); +} + +void tst_QDataStream::stream_QEasingCurve() +{ + STREAM_IMPL(QEasingCurve); +} + +void tst_QDataStream::writeQEasingCurve(QDataStream* s) +{ + QEasingCurve test(QEasingCurveData(dataIndex(QTest::currentDataTag()))); + *s << test; +} + +void tst_QDataStream::readQEasingCurve(QDataStream *s) +{ + QEasingCurve S; + QEasingCurve expected(QEasingCurveData(dataIndex(QTest::currentDataTag()))); + + *s >> S; + QCOMPARE(S, expected); +} + +// ************************************ + // contains some quint64 testing as well #define MAX_qint64_DATA 4 |