diff options
author | Michael Goddard <michael.goddard@nokia.com> | 2011-10-07 12:03:35 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-07 08:29:57 +0200 |
commit | adca03adfd80c0a87083d73e8d8c71229fc35652 (patch) | |
tree | 51e76584ae08b14f85fbf8f5197fac554d63cd64 /tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp | |
parent | 03f22bcdaf1f80083618856d6e4140d3062f175b (diff) |
Improve video test coverage and debugging output.
Added a few debug operators for some useful enums, and
added tests for them. One or two other features not really
tested.
Change-Id: Idffec6ade1d4e05dbf72f3dc47dfc0d01ddddf8b
Reviewed-on: http://codereview.qt-project.org/6201
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp')
-rw-r--r-- | tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp index f62cd5aeb..7413fdd98 100644 --- a/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp +++ b/tests/auto/qabstractvideosurface/tst_qabstractvideosurface.cpp @@ -314,6 +314,12 @@ void tst_QAbstractVideoSurface::start() QCOMPARE(activeSpy.count(), 1); QCOMPARE(activeSpy.last().at(0).toBool(), true); + // Starting twice won't change active + // XXX should this also not emit surfaceFormatChanged? + QVERIFY(surface.start(format)); + QCOMPARE(activeSpy.count(), 1); + QVERIFY(surface.isActive()); + // error() is reset on a successful start. QCOMPARE(surface.error(), QAbstractVideoSurface::NoError); @@ -322,7 +328,19 @@ void tst_QAbstractVideoSurface::start() QVERIFY(!surface.isActive()); QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); - QCOMPARE(formatSpy.count(), 2); + QCOMPARE(formatSpy.count(), 3); + QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat()); + + QCOMPARE(activeSpy.count(), 2); + QCOMPARE(activeSpy.last().at(0).toBool(), false); + + // Stopping a stopped surface shouldn't hurt + surface.stop(); + + QVERIFY(!surface.isActive()); + QCOMPARE(surface.surfaceFormat(), QVideoSurfaceFormat()); + + QCOMPARE(formatSpy.count(), 3); QCOMPARE(qvariant_cast<QVideoSurfaceFormat>(formatSpy.last().at(0)), QVideoSurfaceFormat()); QCOMPARE(activeSpy.count(), 2); @@ -346,6 +364,15 @@ void tst_QAbstractVideoSurface::nativeResolution() QSize size2 = qvariant_cast<QSize>(spy.at(0).at(0)); QVERIFY(size2.width() == 100); QVERIFY(size2.height() == 150); + + // Setting again should not emit + surface.setNativeResolution(res); + QVERIFY(spy.count() == 1); + + size2 = qvariant_cast<QSize>(spy.at(0).at(0)); + QVERIFY(size2.width() == 100); + QVERIFY(size2.height() == 150); + spy.clear(); } |