summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristiaan Janssen <christiaan.janssen@digia.com>2012-09-28 16:58:11 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-01 12:37:01 +0200
commit9b345360dc1c008150efe57fbd28d6a194132dee (patch)
tree15d3fd877629d19b831ed778556d52595c15b5a6 /tests
parentfdbad25c5d5a1792bec5ab72a573fc4ad60378fc (diff)
QtQuick1: fixed qperformancetimer test
It wasn't included in the autotests, and did not compile due to missing defines in the makefile. Change-Id: Ie1e3790422e6c1af2948b1edc38a72e2f8d543ed Reviewed-by: Fanda Vacek <fvacek@rim.com> Reviewed-by: Aurindam Jana <aurindam.jana@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/declarative.pro3
-rw-r--r--tests/auto/declarative/qperformancetimer/qperformancetimer.pro2
-rw-r--r--tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp22
3 files changed, 11 insertions, 16 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index eeccd281..26304efd 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -71,7 +71,8 @@ contains(QT_CONFIG, private_tests) {
qdeclarativevisualdatamodel \
qdeclarativeworkerscript \
qdeclarativexmllistmodel \
- qpacketprotocol
+ qpacketprotocol \
+ qperformancetimer
# This test requires the xmlpatterns module
!contains(QT_CONFIG,xmlpatterns): SUBDIRS -= qdeclarativexmllistmodel
diff --git a/tests/auto/declarative/qperformancetimer/qperformancetimer.pro b/tests/auto/declarative/qperformancetimer/qperformancetimer.pro
index cb5a4063..afd59c67 100644
--- a/tests/auto/declarative/qperformancetimer/qperformancetimer.pro
+++ b/tests/auto/declarative/qperformancetimer/qperformancetimer.pro
@@ -2,7 +2,7 @@ CONFIG += testcase
TARGET = tst_qperformancetimer
QT += testlib
-contains(QT_CONFIG,quick1): QT += quick1
+contains(QT_CONFIG,quick1): QT += quick1 quick1-private
SOURCES += tst_qperformancetimer.cpp
macx:CONFIG -= app_bundle
diff --git a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp
index 958fb1a2..d253f9f7 100644
--- a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp
+++ b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp
@@ -64,20 +64,14 @@ void tst_qperformancetimer::units()
QVERIFY(elapsed > 300000000 && elapsed < 310000000);
}
{
- qint64 monotonic_time_in_far_future = 1000000000 * 60 * 60 * 24 * 365 * 10; /// 10 years uptime
- qint64 elapsed = timer.elapsedToAbsoluteTime(time_in_far_future);
- elapsed = elapsed - timer.elapsedToAbsoluteTime(time_in_far_future - 2000000);
- QVERIFY(elapsed == 2000000);
- }
- {
- qint64 elapsed = timer.elapsed();
- qint64 elapsed2 = timer.elapsedToAbsoluteTime(elapsed);
- qint64 monotonic_now = 2 * elapsed - elapsed2;
- QTest::qWait(300);
- elapsed = timer.elapsed();
- elapsed2 = timer.elapsedToAbsoluteTime(monotonic_now + 300 * 1000000);
- qint64 diff = elapsed - elapsed2;
- QVERIFY(diff > -10000000 && diff < 10000000);
+ timer.start();
+ qint64 monotonic_start = -timer.elapsedToAbsoluteTime(0);
+ qint64 wait_ms = 300;
+ QTest::qWait(wait_ms);
+ qint64 elapsed1 = timer.elapsed();
+ qint64 elapsed2 = timer.elapsedToAbsoluteTime(monotonic_start + elapsed1);
+ qint64 diff = elapsed1 - elapsed2;
+ QVERIFY(diff == 0);
}
}