summaryrefslogtreecommitdiffstats
path: root/tests/auto/integration/qdeclarativevideooutput
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-27 12:38:35 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-27 07:35:09 +0100
commit88431b2841b5c6a13c360aae402847409953c867 (patch)
tree6658b917d4e957c9edeabb50d5a821fab375b53a /tests/auto/integration/qdeclarativevideooutput
parentbad94a532996339da23906764521447803f24b16 (diff)
Fix some surface assignment errors.
On destruction and changing sources, make sure we don't clobber the surface property if it's been changed. Change-Id: I3080b98a547911543a391c8bc040792d260782fd Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
Diffstat (limited to 'tests/auto/integration/qdeclarativevideooutput')
-rw-r--r--tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp b/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp
index 029a64eee..07d824895 100644
--- a/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp
+++ b/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp
@@ -70,6 +70,9 @@ public:
}
void setVideoSurface(QAbstractVideoSurface *surface)
{
+ if (m_surface != surface && m_surface && m_surface->isActive()) {
+ m_surface->stop();
+ }
m_surface = surface;
}
@@ -133,6 +136,9 @@ private slots:
void mappingRect();
void mappingRect_data();
+ // XXX May be worth adding tests that the surface activeChanged signals are sent appropriately
+ // to holder?
+
private:
QDeclarativeEngine m_engine;
QByteArray m_plainQML;
@@ -293,7 +299,6 @@ void tst_QDeclarativeVideoOutput::surfaceSource()
delete videoOutput;
// This should clear the surface
- QEXPECT_FAIL("", "Surface not cleared on destruction", Continue);
QCOMPARE(holder.videoSurface(), static_cast<QAbstractVideoSurface*>(0));
// Also, creating two sources, setting them in order, and destroying the first
@@ -324,9 +329,22 @@ void tst_QDeclarativeVideoOutput::surfaceSource()
QCOMPARE(holder.videoSurface(), static_cast<QAbstractVideoSurface*>(0));
QVERIFY(holder2.videoSurface() != 0);
- // XXX May be worth adding tests that the surface activeChanged signals are sent appropriately
- // to holder?
+ // Finally a combination - set the same source to two things, then assign a new source
+ // to the first output - should not reset the first source
+ videoOutput = component.create();
+ videoOutput->setProperty("source", QVariant::fromValue(static_cast<QObject*>(&holder2)));
+ // Both vo and vo2 were pointed to holder2 - setting vo2 should not clear holder2
+ QVERIFY(holder2.videoSurface() != 0);
+ QVERIFY(holder.videoSurface() == 0);
+ videoOutput2->setProperty("source", QVariant::fromValue(static_cast<QObject*>(&holder)));
+ QVERIFY(holder2.videoSurface() != 0);
+ QVERIFY(holder.videoSurface() != 0);
+
+ // They should also be independent
+ QVERIFY(holder.videoSurface() != holder2.videoSurface());
+
+ delete videoOutput;
delete videoOutput2;
}