diff options
Diffstat (limited to 'tests')
4 files changed, 78 insertions, 43 deletions
diff --git a/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp b/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp index 0e9cf6aa3..5b9fdd03c 100644 --- a/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp +++ b/tests/auto/integration/qdeclarativevideooutput/tst_qdeclarativevideooutput.cpp @@ -106,6 +106,7 @@ public slots: private slots: void fillMode(); + void flushMode(); void orientation(); void surfaceSource(); void sourceRect(); @@ -152,6 +153,7 @@ void tst_QDeclarativeVideoOutput::initTestCase() } Q_DECLARE_METATYPE(QDeclarativeVideoOutput::FillMode) +Q_DECLARE_METATYPE(QDeclarativeVideoOutput::FlushMode) tst_QDeclarativeVideoOutput::tst_QDeclarativeVideoOutput() : m_mappingComponent(0) @@ -190,6 +192,24 @@ void tst_QDeclarativeVideoOutput::fillMode() delete videoOutput; } +void tst_QDeclarativeVideoOutput::flushMode() +{ + QQmlComponent component(&m_engine); + component.loadUrl(QUrl("qrc:/main.qml")); + + QObject *videoOutput = component.create(); + QVERIFY(videoOutput != 0); + + QSignalSpy propSpy(videoOutput, SIGNAL(flushModeChanged())); + + QCOMPARE(videoOutput->property("flushMode").value<QDeclarativeVideoOutput::FlushMode>(), QDeclarativeVideoOutput::EmptyFrame); + QCOMPARE(propSpy.count(), 0); + + videoOutput->setProperty("flushMode", QVariant(int(QDeclarativeVideoOutput::FirstFrame))); + QCOMPARE(videoOutput->property("fillMode").value<QDeclarativeVideoOutput::FlushMode>(), QDeclarativeVideoOutput::FirstFrame); + QCOMPARE(propSpy.count(), 1); +} + void tst_QDeclarativeVideoOutput::orientation() { QQmlComponent component(&m_engine); diff --git a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp index fa98c8b16..7cbd57007 100644 --- a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp +++ b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp @@ -60,6 +60,7 @@ private slots: void testSetSourceWhileLoading(); void testSetSourceWhilePlaying(); + void testSupportedMimeTypes_data(); void testSupportedMimeTypes(); void testCorruptFile(); void testPlaying24Bits(); @@ -387,9 +388,19 @@ void tst_QSoundEffect::testSetSourceWhilePlaying() } } +void tst_QSoundEffect::testSupportedMimeTypes_data() +{ + // Verify also passing of audio device info as parameter + QTest::addColumn<QSoundEffect*>("instance"); + QTest::newRow("without QAudioDeviceInfo") << sound; + QAudioDeviceInfo deviceInfo(QAudioDeviceInfo::defaultOutputDevice()); + QTest::newRow("with QAudioDeviceInfo") << new QSoundEffect(deviceInfo, this); +} + void tst_QSoundEffect::testSupportedMimeTypes() { - QStringList mimeTypes = sound->supportedMimeTypes(); + QFETCH(QSoundEffect*, instance); + QStringList mimeTypes = instance->supportedMimeTypes(); QVERIFY(!mimeTypes.empty()); QVERIFY(mimeTypes.indexOf(QLatin1String("audio/wav")) != -1 || mimeTypes.indexOf(QLatin1String("audio/x-wav")) != -1 || diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp index fd0917943..43dc52022 100644 --- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp +++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp @@ -74,6 +74,8 @@ private slots: void shaderPresentGLFrame_data(); void shaderPresentGLFrame(); #endif +private: + bool m_libGL = QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL; }; Q_DECLARE_METATYPE(const uchar *) @@ -212,9 +214,9 @@ void tst_QPainterVideoSurface::supportedFormat_data() << QAbstractVideoBuffer::NoHandle << QVideoFrame::Format_RGB24 << QSize(1024, 768) -#ifndef QT_OPENGL_ES - << true - << true; +#if !defined(QT_OPENGL_ES) + << m_libGL + << m_libGL; #else << false << false; @@ -223,8 +225,8 @@ void tst_QPainterVideoSurface::supportedFormat_data() << QAbstractVideoBuffer::NoHandle << QVideoFrame::Format_RGB24 << QSize(-1024, -768) -#ifndef QT_OPENGL_ES - << true +#if !defined(QT_OPENGL_ES) + << m_libGL #else << false #endif @@ -374,18 +376,19 @@ void tst_QPainterVideoSurface::present_data() << int(sizeof(argb32ImageData)) << 8; -#ifndef QT_OPENGL_ES - QTest::newRow("rgb32 -> rgb24") - << QVideoFrame::Format_RGB32 - << QSize(2, 2) - << static_cast<const uchar *>(rgb32ImageData) - << int(sizeof(rgb32ImageData)) - << 8 - << QVideoFrame::Format_RGB24 - << QSize(2, 2) - << static_cast<const uchar *>(rgb24ImageData) - << int(sizeof(rgb24ImageData)) - << 8; +#if !defined(QT_OPENGL_ES) + if (m_libGL) + QTest::newRow("rgb32 -> rgb24") + << QVideoFrame::Format_RGB32 + << QSize(2, 2) + << static_cast<const uchar *>(rgb32ImageData) + << int(sizeof(rgb32ImageData)) + << 8 + << QVideoFrame::Format_RGB24 + << QSize(2, 2) + << static_cast<const uchar *>(rgb24ImageData) + << int(sizeof(rgb24ImageData)) + << 8; #endif QTest::newRow("rgb32 -> rgb565") @@ -400,18 +403,19 @@ void tst_QPainterVideoSurface::present_data() << int(sizeof(rgb565ImageData)) << 4; -#ifndef QT_OPENGL_ES - QTest::newRow("rgb24 -> rgb565") - << QVideoFrame::Format_RGB24 - << QSize(2, 2) - << static_cast<const uchar *>(rgb24ImageData) - << int(sizeof(rgb24ImageData)) - << 8 - << QVideoFrame::Format_RGB565 - << QSize(2, 2) - << static_cast<const uchar *>(rgb565ImageData) - << int(sizeof(rgb565ImageData)) - << 4; +#if !defined(QT_OPENGL_ES) + if (m_libGL) + QTest::newRow("rgb24 -> rgb565") + << QVideoFrame::Format_RGB24 + << QSize(2, 2) + << static_cast<const uchar *>(rgb24ImageData) + << int(sizeof(rgb24ImageData)) + << 8 + << QVideoFrame::Format_RGB565 + << QSize(2, 2) + << static_cast<const uchar *>(rgb565ImageData) + << int(sizeof(rgb565ImageData)) + << 4; #endif } @@ -580,7 +584,7 @@ void tst_QPainterVideoSurface::shaderType() QCOMPARE(spy.count(), 0); } -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) if (surface.supportedShaderTypes() & QPainterVideoSurface::FragmentProgramShader) { QSignalSpy spy(&surface, SIGNAL(supportedFormatsChanged())); @@ -625,7 +629,7 @@ void tst_QPainterVideoSurface::shaderType() QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders); QCOMPARE(spy.count(), 0); -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) surface.setShaderType(QPainterVideoSurface::FragmentProgramShader); QCOMPARE(surface.shaderType(), QPainterVideoSurface::NoShaders); QCOMPARE(spy.count(), 0); @@ -641,7 +645,7 @@ void tst_QPainterVideoSurface::shaderTypeStarted_data() { QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType"); -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) QTest::newRow("ARBfp") << QPainterVideoSurface::FragmentProgramShader; #endif @@ -729,7 +733,7 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data() QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types; -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: ")); #endif types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: ")); @@ -776,9 +780,9 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data() << QAbstractVideoBuffer::NoHandle << QVideoFrame::Format_RGB24 << QSize(1024, 768) -#ifndef QT_OPENGL_ES - << true - << true; +#if !defined(QT_OPENGL_ES) + << m_libGL + << m_libGL; #else << false << false; @@ -788,8 +792,8 @@ void tst_QPainterVideoSurface::shaderSupportedFormat_data() << QAbstractVideoBuffer::NoHandle << QVideoFrame::Format_RGB24 << QSize(-1024, -768) -#ifndef QT_OPENGL_ES - << true +#if !defined(QT_OPENGL_ES) + << m_libGL #else << false #endif @@ -949,7 +953,7 @@ void tst_QPainterVideoSurface::shaderPresent_data() QTest::addColumn<int>("bytesPerLineB"); QList<QPair<QPainterVideoSurface::ShaderType, QByteArray> > types; -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) types << qMakePair(QPainterVideoSurface::FragmentProgramShader, QByteArray("ARBfp: ")); #endif types << qMakePair(QPainterVideoSurface::GlslShader, QByteArray("GLSL: ")); @@ -1149,7 +1153,7 @@ void tst_QPainterVideoSurface::shaderPresentOpaqueFrame_data() { QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType"); -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) QTest::newRow("ARBfp") << QPainterVideoSurface::FragmentProgramShader; #endif @@ -1203,7 +1207,7 @@ void tst_QPainterVideoSurface::shaderPresentGLFrame_data() { QTest::addColumn<QPainterVideoSurface::ShaderType>("shaderType"); -#ifndef QT_OPENGL_ES +#if !defined(QT_OPENGL_ES) QTest::newRow("ARBfp") << QPainterVideoSurface::FragmentProgramShader; #endif diff --git a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp index 63307913b..6be039108 100644 --- a/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp +++ b/tests/auto/unit/qvideoframe/tst_qvideoframe.cpp @@ -733,7 +733,7 @@ void tst_QVideoFrame::mapImage() QVERIFY(frame.map(mode)); QVERIFY(frame.bits()); - QCOMPARE(frame.mappedBytes(), image.byteCount()); + QCOMPARE(qsizetype(frame.mappedBytes()), image.sizeInBytes()); QCOMPARE(frame.bytesPerLine(), image.bytesPerLine()); QCOMPARE(frame.mapMode(), mode); |