diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2009-11-04 07:53:51 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2009-11-04 07:59:06 (GMT) |
commit | 14238b8f58b2f7496cde8b829870a6180286ea14 (patch) | |
tree | 6707eb820fb3c72ebba137f93cfe08948136a04b /tests | |
parent | 1400ce5b85fbe7c67899f5f62bfd276eecb21ae0 (diff) | |
download | Qt-14238b8f58b2f7496cde8b829870a6180286ea14.zip Qt-14238b8f58b2f7496cde8b829870a6180286ea14.tar.gz Qt-14238b8f58b2f7496cde8b829870a6180286ea14.tar.bz2 |
QAbstractVideoSurface API review changes.
Rename isStarted() and startedChanged() to is active() and
activeChanged().
Remove the the similar format argument from isFormatSupported() and add
a new nearestFormat() function which provides the same functionality.
Reviewed-by: Justin McPherson
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp index 20ca759..b4d2ac8 100644 --- a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp +++ b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp @@ -61,6 +61,8 @@ private slots: void setError(); void isFormatSupported_data(); void isFormatSupported(); + void nearestFormat_data(); + void nearestFormat(); void start_data(); void start(); }; @@ -232,6 +234,22 @@ void tst_QAbstractVideoSurface::isFormatSupported() QCOMPARE(surface.isFormatSupported(format), supported); } +void tst_QAbstractVideoSurface::nearestFormat_data() +{ + isFormatSupported_data(); +} + +void tst_QAbstractVideoSurface::nearestFormat() +{ + QFETCH(SupportedFormatMap, supportedFormats); + QFETCH(QVideoSurfaceFormat, format); + QFETCH(bool, supported); + + QtTestVideoSurface surface(supportedFormats); + + QCOMPARE(surface.nearestFormat(format) == format, supported); +} + void tst_QAbstractVideoSurface::start_data() { QTest::addColumn<QVideoSurfaceFormat>("format"); @@ -256,35 +274,35 @@ void tst_QAbstractVideoSurface::start() surface.setError(QAbstractVideoSurface::ResourceError); QSignalSpy formatSpy(&surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat))); - QSignalSpy startedSpy(&surface, SIGNAL(startedChanged(bool))); + QSignalSpy activeSpy(&surface, SIGNAL(activeChanged(bool))); - QVERIFY(!surface.isStarted()); + QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); QVERIFY(surface.start(format)); - QVERIFY(surface.isStarted()); + QVERIFY(surface.isActive()); QCOMPARE(surface.surfaceFormat(), format); QCOMPARE(formatSpy.count(), 1); - QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.at(0).at(0)), format); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), format); - QCOMPARE(startedSpy.count(), 1); - QCOMPARE(startedSpy.at(0).at(0).toBool(), true); + QCOMPARE(activeSpy.count(), 1); + QCOMPARE(activeSpy.last().at(0).toBool(), true); // error() is reset on a successful start. QCOMPARE(surface.error(), QAbstractVideoSurface::NoError); surface.stop(); - QVERIFY(!surface.isStarted()); + QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); QCOMPARE(formatSpy.count(), 2); - QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.at(1).at(0)), QVideoSurfaceFormat()); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat()); - QCOMPARE(startedSpy.count(), 2); - QCOMPARE(startedSpy.at(1).at(0).toBool(), false); + QCOMPARE(activeSpy.count(), 2); + QCOMPARE(activeSpy.last().at(0).toBool(), false); } QTEST_MAIN(tst_QAbstractVideoSurface) |