From 9b345360dc1c008150efe57fbd28d6a194132dee Mon Sep 17 00:00:00 2001 From: Christiaan Janssen Date: Fri, 28 Sep 2012 16:58:11 +0200 Subject: 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 Reviewed-by: Aurindam Jana --- tests/auto/declarative/declarative.pro | 3 ++- .../qperformancetimer/qperformancetimer.pro | 2 +- .../qperformancetimer/tst_qperformancetimer.cpp | 22 ++++++++-------------- 3 files changed, 11 insertions(+), 16 deletions(-) (limited to 'tests/auto/declarative') 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); } } -- cgit v1.2.3