From abd7d1ffc94abda0259d8e4764a0a7813253d0f9 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Tue, 11 Jan 2011 17:48:56 +0200 Subject: Convert ClockTime to a class. * Move the related QTime conversion methods from Clock to ClockTime. * Make those quint64 constants portable with Q_UINT64_C(). * Add ClockTime::None and ClockTime.isValid(). --- tests/auto/clocktest.cpp | 20 ++++++++++---------- tests/auto/eventtest.cpp | 6 +++--- tests/auto/querytest.cpp | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/clocktest.cpp b/tests/auto/clocktest.cpp index 3cabc47..fac49d2 100644 --- a/tests/auto/clocktest.cpp +++ b/tests/auto/clocktest.cpp @@ -42,26 +42,26 @@ void ClockTest::systemTest() void ClockTest::timeFromClockTimeTest() { - QCOMPARE(QGst::Clock::timeFromClockTime(3600 * 1000 * 1000000LL).toString(), + QCOMPARE(QGst::ClockTime(3600 * 1000 * Q_UINT64_C(1000000)).toTime().toString(), QString("01:00:00")); // 1 hour - QCOMPARE(QGst::Clock::timeFromClockTime(4000 * 1000 * 1000000LL).toString(), + QCOMPARE(QGst::ClockTime(4000 * 1000 * Q_UINT64_C(1000000)).toTime().toString(), QString("01:06:40")); - QCOMPARE(QGst::Clock::timeFromClockTime(50001 * 1000 * 1000000LL).toString(), + QCOMPARE(QGst::ClockTime(50001 * 1000 * Q_UINT64_C(1000000)).toTime().toString(), QString("13:53:21")); - QCOMPARE(QGst::Clock::timeFromClockTime(120000 * 1000 * 1000000LL).toString(), + QCOMPARE(QGst::ClockTime(120000 * 1000 * Q_UINT64_C(1000000)).toTime().toString(), QString("09:20:00")); // wraps } void ClockTest::clockTimeFromTimeTest() { - QCOMPARE(static_cast(QGst::Clock::clockTimeFromTime(QTime(1, 0))), - static_cast(3600 * 1000 * 1000000LL)); // 1 hour + QCOMPARE(static_cast(QGst::ClockTime::fromTime(QTime(1, 0))), + static_cast(3600 * 1000 * Q_UINT64_C(1000000))); // 1 hour - QCOMPARE(static_cast(QGst::Clock::clockTimeFromTime(QTime(1, 6, 40))), - static_cast(4000 * 1000 * 1000000LL)); + QCOMPARE(static_cast(QGst::ClockTime::fromTime(QTime(1, 6, 40))), + static_cast(4000 * 1000 * Q_UINT64_C(1000000))); - QCOMPARE(static_cast(QGst::Clock::clockTimeFromTime(QTime(13, 53, 21, 15))), - static_cast((50001 * 1000 +15) * 1000000LL)); + QCOMPARE(static_cast(QGst::ClockTime::fromTime(QTime(13, 53, 21, 15))), + static_cast((50001 * 1000 +15) * Q_UINT64_C(1000000))); } diff --git a/tests/auto/eventtest.cpp b/tests/auto/eventtest.cpp index 5509eee..d36e3c0 100644 --- a/tests/auto/eventtest.cpp +++ b/tests/auto/eventtest.cpp @@ -134,8 +134,8 @@ void EventTest::qosTest() QCOMPARE(evt->typeName(), QString("qos")); QCOMPARE(evt->proportion(), 123.4); - QCOMPARE(evt->diff(), static_cast(23455)); - QCOMPARE(evt->timestamp(), static_cast(98765432)); + QCOMPARE(evt->diff(), QGst::ClockTimeDiff(23455)); + QCOMPARE(evt->timestamp(), QGst::ClockTime(98765432)); }; void EventTest::seekTest() @@ -174,7 +174,7 @@ void EventTest::latencyTest() QVERIFY(evt->type()==QGst::EventLatency); QCOMPARE(evt->typeName(), QString("latency")); - QCOMPARE(evt->latency(), static_cast(43210)); + QCOMPARE(evt->latency(), QGst::ClockTime(43210)); }; void EventTest::stepTest() diff --git a/tests/auto/querytest.cpp b/tests/auto/querytest.cpp index 3fec8d0..d9edb89 100644 --- a/tests/auto/querytest.cpp +++ b/tests/auto/querytest.cpp @@ -79,8 +79,8 @@ void QueryTest::latencyTest() query->setValues(true, 10000, 100000); QVERIFY(query->hasLive()); - QCOMPARE(query->minimumLatency(), static_cast(10000)); - QCOMPARE(query->maximumLatency(), static_cast(100000)); + QCOMPARE(query->minimumLatency(), QGst::ClockTime(10000)); + QCOMPARE(query->maximumLatency(), QGst::ClockTime(100000)); } void QueryTest::seekingTest() -- cgit v1.2.3