diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-13 09:51:04 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-13 09:51:11 (GMT) |
commit | 63856f13721bce420fe94dab31c36329af976276 (patch) | |
tree | 5a2c1d5d49a76a7794fcfd46a6fa664f657ae0fe /tests | |
parent | f5c5cc585cef8d2d2f77e7d83d7a07c6d70f0d09 (diff) | |
parent | 6e209bb09f3feef210bc65f94cf8f58dd8e3b4a9 (diff) | |
download | Qt-63856f13721bce420fe94dab31c36329af976276.zip Qt-63856f13721bce420fe94dab31c36329af976276.tar.gz Qt-63856f13721bce420fe94dab31c36329af976276.tar.bz2 |
Merge commit upstream/4.6 into oslo-staging-2/4.6
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcoreapplication/tst_qcoreapplication.cpp | 36 | ||||
-rw-r--r-- | tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp | 10 |
2 files changed, 41 insertions, 5 deletions
diff --git a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp index c5f06e2..3c61f81 100644 --- a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp @@ -58,6 +58,7 @@ private slots: #endif void applicationPid(); void globalPostedEventsCount(); + void processEventsAlwaysSendsPostedEvents(); }; class EventSpy : public QObject @@ -488,5 +489,40 @@ void tst_QCoreApplication::globalPostedEventsCount() QCOMPARE(x.globalPostedEventsCount, expected); } +class ProcessEventsAlwaysSendsPostedEventsObject : public QObject +{ +public: + int counter; + + inline ProcessEventsAlwaysSendsPostedEventsObject() + : counter(0) + { } + + bool event(QEvent *event) + { + if (event->type() == QEvent::User) + ++counter; + return QObject::event(event); + } +}; + +void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents() +{ + int argc = 1; + char *argv[] = { "tst_qcoreapplication" }; + QCoreApplication app(argc, argv); + + ProcessEventsAlwaysSendsPostedEventsObject object; + QTime t; + t.start(); + int i = 1; + do { + QCoreApplication::postEvent(&object, new QEvent(QEvent::User)); + QCoreApplication::processEvents(); + QCOMPARE(object.counter, i); + ++i; + } while (t.elapsed() < 3000); +} + QTEST_APPLESS_MAIN(tst_QCoreApplication) #include "tst_qcoreapplication.moc" diff --git a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp index a47cb48..2b78d20 100644 --- a/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp +++ b/tests/auto/qvideosurfaceformat/tst_qvideosurfaceformat.cpp @@ -292,13 +292,13 @@ void tst_QVideoSurfaceFormat::frameRate_data() QTest::addColumn<qreal>("frameRate"); QTest::newRow("null") - << 0.0; + << qreal(0.0); QTest::newRow("1/1") - << 1.0; + << qreal(1.0); QTest::newRow("24/1") - << 24.0; + << qreal(24.0); QTest::newRow("15/2") - << 7.5; + << qreal(7.5); } void tst_QVideoSurfaceFormat::frameRate() @@ -583,7 +583,7 @@ void tst_QVideoSurfaceFormat::compare() QCOMPARE(format1 == format2, false); QCOMPARE(format1 != format2, true); - format2.setFrameRate(7.50001); + format2.setFrameRate(qreal(7.50001)); // Equal. QCOMPARE(format1 == format2, true); |