diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-10 13:47:28 +0200 |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-10 13:47:28 +0200 |
commit | 0df5d5e4367a8052082897d02b4f00429d5cc4c1 (patch) | |
tree | cc8a59f0e37dbd618270bbca5b644fc3b775d60a /tests/auto | |
parent | f61ec84fc296c6f70011e30788ee511d6b6a18c6 (diff) | |
parent | 17bffacda99055831bb4c8c6e7da39ec15415519 (diff) | |
download | qt4-tools-0df5d5e4367a8052082897d02b4f00429d5cc4c1.tar.gz |
Merge commit 'qt/master'
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qaccessibility_mac/qaccessibility_mac.pro | 2 | ||||
-rw-r--r-- | tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 22 | ||||
-rw-r--r-- | tests/auto/qmake/testdata/functions/functions.pro | 2 | ||||
-rw-r--r-- | tests/auto/qtimeline/tst_qtimeline.cpp | 41 | ||||
-rwxr-xr-x | tests/auto/runQtXmlPatternsTests.sh | 61 | ||||
-rw-r--r-- | tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp | 11 | ||||
-rw-r--r-- | tests/auto/selftests/expected_benchlibwalltime.txt | 5 |
7 files changed, 78 insertions, 66 deletions
diff --git a/tests/auto/qaccessibility_mac/qaccessibility_mac.pro b/tests/auto/qaccessibility_mac/qaccessibility_mac.pro index b32a7e53e2..47f72d1cdb 100644 --- a/tests/auto/qaccessibility_mac/qaccessibility_mac.pro +++ b/tests/auto/qaccessibility_mac/qaccessibility_mac.pro @@ -11,7 +11,7 @@ requires(mac) # builds (where QTDIR points to the build directory). # autotest + shadow build is not supported :) exists($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri) { - include($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri) + include($$(QTDIR)/tools/designer/src/lib/uilib/uilib.pri, "", true) INCLUDEPATH += $$(QTDIR)/tools/designer/src/uitools SOURCES += $$(QTDIR)/tools/designer/src/uitools/quiloader.cpp HEADERS += $$(QTDIR)/tools/designer/src/uitools/quiloader.h diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index 672b1f15a9..c9481da3b5 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -137,7 +137,10 @@ void tst_QGraphicsTransform::rotation() void tst_QGraphicsTransform::rotation3d() { QGraphicsRotation3D rotation; - rotation.setOrigin(QPointF(10, 10)); + QCOMPARE(rotation.axis().x(), (qreal)0); + QCOMPARE(rotation.axis().y(), (qreal)0); + QCOMPARE(rotation.axis().z(), (qreal)1); + QCOMPARE(rotation.angle(), (qreal)0); QTransform t; rotation.applyTo(&t); @@ -147,6 +150,23 @@ void tst_QGraphicsTransform::rotation3d() rotation.setAngle(180); + QTransform t180; + t180.rotate(180.0f); + + QCOMPARE(t, QTransform()); + QVERIFY(qFuzzyCompare(rotation.transform(), t180)); + + rotation.setAxis(QVector3D(0, 0, 0)); + rotation.setOrigin(QPointF(10, 10)); + + t = QTransform(); + rotation.applyTo(&t); + + QCOMPARE(t, QTransform()); + QCOMPARE(rotation.transform(), QTransform()); + + rotation.setAngle(180); + QCOMPARE(t, QTransform()); QCOMPARE(rotation.transform(), QTransform()); diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro index 9ed92f960f..5e089e403f 100644 --- a/tests/auto/qmake/testdata/functions/functions.pro +++ b/tests/auto/qmake/testdata/functions/functions.pro @@ -46,7 +46,7 @@ isEmpty( CONFIG ) { } #include -include( infiletest.pro ) +include( infiletest.pro, "", true ) !contains( DEFINES, QT_DLL ) { message( "FAILED: include function: $$DEFINES" ) } diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp index e6e75ff018..4ce1f4b81a 100644 --- a/tests/auto/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/qtimeline/tst_qtimeline.cpp @@ -81,6 +81,7 @@ private slots: void outOfRange(); void stateInFinishedSignal(); void resume(); + void restart(); protected slots: void finishedSlot(); @@ -177,7 +178,7 @@ void tst_QTimeLine::currentTime() QCOMPARE(spy.count(), 1); spy.clear(); QCOMPARE(timeLine.currentTime(), timeLine.duration()/2); - timeLine.start(); + timeLine.resume(); // Let it update on its own QTest::qWait(timeLine.duration()/4); QCOMPARE(timeLine.state(), QTimeLine::Running); @@ -699,5 +700,43 @@ void tst_QTimeLine::resume() } } +void tst_QTimeLine::restart() +{ + QTimeLine timeLine(100); + timeLine.setFrameRange(0,9); + + timeLine.start(); + QTest::qWait(timeLine.duration()*2); + QCOMPARE(timeLine.currentFrame(), timeLine.endFrame()); + QCOMPARE(timeLine.state(), QTimeLine::NotRunning); + + // A restart with the same duration + timeLine.start(); + QCOMPARE(timeLine.state(), QTimeLine::Running); + QCOMPARE(timeLine.currentFrame(), timeLine.startFrame()); + QCOMPARE(timeLine.currentTime(), 0); + QTest::qWait(250); + QCOMPARE(timeLine.currentFrame(), timeLine.endFrame()); + QCOMPARE(timeLine.state(), QTimeLine::NotRunning); + + // Set a smaller duration and restart + timeLine.setDuration(50); + timeLine.start(); + QCOMPARE(timeLine.state(), QTimeLine::Running); + QCOMPARE(timeLine.currentFrame(), timeLine.startFrame()); + QCOMPARE(timeLine.currentTime(), 0); + QTest::qWait(250); + QCOMPARE(timeLine.currentFrame(), timeLine.endFrame()); + QCOMPARE(timeLine.state(), QTimeLine::NotRunning); + + // Set a longer duration and restart + timeLine.setDuration(150); + timeLine.start(); + QCOMPARE(timeLine.state(), QTimeLine::Running); + QCOMPARE(timeLine.currentFrame(), timeLine.startFrame()); + QCOMPARE(timeLine.currentTime(), 0); +} + QTEST_MAIN(tst_QTimeLine) + #include "tst_qtimeline.moc" diff --git a/tests/auto/runQtXmlPatternsTests.sh b/tests/auto/runQtXmlPatternsTests.sh deleted file mode 100755 index 41d6c83efa..0000000000 --- a/tests/auto/runQtXmlPatternsTests.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# Runs all the tests specific to QtXmlPatterns in one go. - -# If you add a test, remember to update ./auto.pro too. -# checkxmlfiles is not part of Patternist, but since it shares test code -# and use Patternist, we include it as well. -# -# Sorted alphabetically, with the difference that xmlpatternsxqts appears -# before xmlpattersview, xmlpatternsdiagnosticsts, and xmlpatternsxslts, since -# they have the former as dependency. -tests=" \ -checkxmlfiles \ -patternistexamplefiletree \ -patternistexamples \ -patternistheaders \ -qabstractmessagehandler \ -qabstracturiresolver \ -qabstractxmlforwarditerator \ -qabstractxmlnodemodel \ -qabstractxmlreceiver \ -qapplicationargumentparser \ -qautoptr \ -qsimplexmlnodemodel \ -qsourcelocation \ -qtokenautomaton \ -qxmlformatter \ -qxmlitem \ -qxmlname \ -qxmlnamepool \ -qxmlnodemodelindex \ -qxmlquery \ -qxmlresultitems \ -qxmlserializer \ -xmlpatterns \ -xmlpatternsxqts \ -xmlpatternsdiagnosticsts \ -xmlpatternsschema \ -xmlpatternsschemats \ -xmlpatternsview \ -xmlpatternsxslts" - -os=`uname` - -for test in $tests; do - cd $test - make distclean - qmake - make - - if [ $os = "Darwin" ]; then - ./tst_"$test".app/Contents/MacOS/tst_"$test" - else - ./tst_$test - fi - - if [ $? -ne 0 ]; then - exit $? - else - cd .. - fi -done diff --git a/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp b/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp index de655995e4..8474144f33 100644 --- a/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp +++ b/tests/auto/selftests/benchlibwalltime/tst_benchlibwalltime.cpp @@ -50,6 +50,7 @@ class tst_BenchlibWalltime: public QObject private slots: void waitForOneThousand(); void waitForFourThousand(); + void qbenchmark_once(); }; void tst_BenchlibWalltime::waitForOneThousand() @@ -66,6 +67,16 @@ void tst_BenchlibWalltime::waitForFourThousand() } } +void tst_BenchlibWalltime::qbenchmark_once() +{ + int iterations = 0; + QBENCHMARK_ONCE { + ++iterations; + } + QCOMPARE(iterations, 1); +} + + QTEST_MAIN(tst_BenchlibWalltime) #include "tst_benchlibwalltime.moc" diff --git a/tests/auto/selftests/expected_benchlibwalltime.txt b/tests/auto/selftests/expected_benchlibwalltime.txt index 03f2465127..ec2d020406 100644 --- a/tests/auto/selftests/expected_benchlibwalltime.txt +++ b/tests/auto/selftests/expected_benchlibwalltime.txt @@ -7,6 +7,9 @@ PASS : tst_BenchlibWalltime::waitForOneThousand() RESULT : tst_BenchlibWalltime::waitForFourThousand(): 4,000 msec per iteration (total: 4000, iterations: 1) PASS : tst_BenchlibWalltime::waitForFourThousand() +RESULT : tst_BenchlibWalltime::qbenchmark_once(): + 0 msec per iteration (total: 0, iterations: 1) +PASS : tst_BenchlibWalltime::qbenchmark_once() PASS : tst_BenchlibWalltime::cleanupTestCase() -Totals: 4 passed, 0 failed, 0 skipped +Totals: 5 passed, 0 failed, 0 skipped ********* Finished testing of tst_BenchlibWalltime ********* |