diff options
Diffstat (limited to 'tests')
9 files changed, 273 insertions, 25 deletions
diff --git a/tests/auto/integration/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/integration/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp index abc0b934b..9d44dc16f 100644 --- a/tests/auto/integration/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp +++ b/tests/auto/integration/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp @@ -190,7 +190,7 @@ void tst_QAudioDeviceInfo::supportedSampleRates() void tst_QAudioDeviceInfo::assignOperator() { QAudioDeviceInfo dev; - QVERIFY(dev.deviceName() == NULL); + QVERIFY(dev.deviceName().isNull()); QVERIFY(dev.isNull() == true); QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput); @@ -204,7 +204,7 @@ void tst_QAudioDeviceInfo::assignOperator() // Returns human readable name of audio device void tst_QAudioDeviceInfo::deviceName() { - QVERIFY(device->deviceName() != NULL); + QVERIFY(!device->deviceName().isNull()); QVERIFY(device->deviceName() == QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).at(0).deviceName()); } @@ -213,7 +213,7 @@ void tst_QAudioDeviceInfo::defaultConstructor() { QAudioDeviceInfo dev; QVERIFY(dev.isNull() == true); - QVERIFY(dev.deviceName() == NULL); + QVERIFY(dev.deviceName().isNull()); } void tst_QAudioDeviceInfo::equalityOperator() diff --git a/tests/auto/integration/qmediaplayerbackend/BLACKLIST b/tests/auto/integration/qmediaplayerbackend/BLACKLIST index 43b8e8b26..5560abf75 100644 --- a/tests/auto/integration/qmediaplayerbackend/BLACKLIST +++ b/tests/auto/integration/qmediaplayerbackend/BLACKLIST @@ -19,13 +19,8 @@ opensuse-13.1 64bit windows 64bit developer-build [playPauseStop] -opensuse-13.1 64bit -redhatenterpriselinuxworkstation-6.6 -rhel-7.1 -ubuntu-14.04 64bit -ubuntu-16.04 64bit +linux windows 64bit developer-build -rhel-7.2 [processEOS] opensuse-13.1 64bit diff --git a/tests/auto/integration/qsoundeffect/BLACKLIST b/tests/auto/integration/qsoundeffect/BLACKLIST index abf85ae93..0f872a576 100644 --- a/tests/auto/integration/qsoundeffect/BLACKLIST +++ b/tests/auto/integration/qsoundeffect/BLACKLIST @@ -1,3 +1,6 @@ +[testSetSourceWhileLoading] +linux + #QTBUG-55735 [testSetSourceWhilePlaying] linux diff --git a/tests/auto/integration/qsoundeffect/qsoundeffect.pro b/tests/auto/integration/qsoundeffect/qsoundeffect.pro index 7a0f63e4b..c4d965121 100644 --- a/tests/auto/integration/qsoundeffect/qsoundeffect.pro +++ b/tests/auto/integration/qsoundeffect/qsoundeffect.pro @@ -14,6 +14,3 @@ unix:!mac { } TESTDATA += test.wav - - -config_pulseaudio: CONFIG += insignificant_testcase # Crashes in QSoundEffectPrivate::sampleReady with bufferAttr == 0 diff --git a/tests/auto/unit/multimediawidgets.pro b/tests/auto/unit/multimediawidgets.pro index 31f8e546c..1bcfc6c2e 100644 --- a/tests/auto/unit/multimediawidgets.pro +++ b/tests/auto/unit/multimediawidgets.pro @@ -7,7 +7,7 @@ SUBDIRS += \ # Tests depending on private interfaces should only be built if # these interfaces are exported. -contains (QT_CONFIG, private_tests) { +qtConfig(private_tests) { SUBDIRS += \ qgraphicsvideoitem \ qpaintervideosurface \ diff --git a/tests/auto/unit/qaudionamespace/tst_qaudionamespace.cpp b/tests/auto/unit/qaudionamespace/tst_qaudionamespace.cpp index ebc58b66b..5cd89ec3e 100644 --- a/tests/auto/unit/qaudionamespace/tst_qaudionamespace.cpp +++ b/tests/auto/unit/qaudionamespace/tst_qaudionamespace.cpp @@ -30,7 +30,7 @@ #include <QtTest/QtTest> -#include "qaudio.h" +#include <QtMultimedia/qaudio.h> // Adds an enum, and the stringized version #define ADD_ENUM_TEST(x) \ @@ -49,6 +49,10 @@ private slots: void debugState_data(); void debugMode(); void debugMode_data(); + void debugVolumeScale(); + void debugVolumeScale_data(); + void convertVolume(); + void convertVolume_data(); }; void tst_QAudioNamespace::debugError_data() @@ -109,6 +113,150 @@ void tst_QAudioNamespace::debugMode() QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData()); qDebug() << mode; } + +void tst_QAudioNamespace::debugVolumeScale_data() +{ + QTest::addColumn<QAudio::VolumeScale>("volumeScale"); + QTest::addColumn<QString>("stringized"); + + ADD_ENUM_TEST(LinearVolumeScale); + ADD_ENUM_TEST(CubicVolumeScale); + ADD_ENUM_TEST(DecibelVolumeScale); +} + +void tst_QAudioNamespace::debugVolumeScale() +{ + QFETCH(QAudio::VolumeScale, volumeScale); + QFETCH(QString, stringized); + + QTest::ignoreMessage(QtDebugMsg, stringized.toLatin1().constData()); + qDebug() << volumeScale; +} + +void tst_QAudioNamespace::convertVolume_data() +{ + QTest::addColumn<qreal>("input"); + QTest::addColumn<QAudio::VolumeScale>("from"); + QTest::addColumn<QAudio::VolumeScale>("to"); + QTest::addColumn<qreal>("expectedOutput"); + + QTest::newRow("-1.0 from linear to linear") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("0.0 from linear to linear") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("0.5 from linear to linear") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(0.5); + QTest::newRow("1.0 from linear to linear") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::LinearVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from linear to cubic") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("0.0 from linear to cubic") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("0.33 from linear to cubic") << qreal(0.33) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.69); + QTest::newRow("0.5 from linear to cubic") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.79); + QTest::newRow("0.72 from linear to cubic") << qreal(0.72) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(0.89); + QTest::newRow("1.0 from linear to cubic") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::CubicVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from linear to logarithmic") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("0.0 from linear to logarithmic") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("0.33 from linear to logarithmic") << qreal(0.33) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.78); + QTest::newRow("0.5 from linear to logarithmic") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.9); + QTest::newRow("0.72 from linear to logarithmic") << qreal(0.72) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.96); + QTest::newRow("1.0 from linear to logarithmic") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from linear to decibel") << qreal(-1.0) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-200); + QTest::newRow("0.0 from linear to decibel") << qreal(0.0) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-200); + QTest::newRow("0.33 from linear to decibel") << qreal(0.33) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-9.63); + QTest::newRow("0.5 from linear to decibel") << qreal(0.5) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-6.02); + QTest::newRow("0.72 from linear to decibel") << qreal(0.72) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(-2.85); + QTest::newRow("1.0 from linear to decibel") << qreal(1.0) << QAudio::LinearVolumeScale << QAudio::DecibelVolumeScale << qreal(0); + + QTest::newRow("-1.0 from cubic to linear") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("0.0 from cubic to linear") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("0.33 from cubic to linear") << qreal(0.33) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.04); + QTest::newRow("0.5 from cubic to linear") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.13); + QTest::newRow("0.72 from cubic to linear") << qreal(0.72) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(0.37); + QTest::newRow("1.0 from cubic to linear") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::LinearVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from cubic to cubic") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("0.0 from cubic to cubic") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("0.5 from cubic to cubic") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(0.5); + QTest::newRow("1.0 from cubic to cubic") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::CubicVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from cubic to logarithmic") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("0.0 from cubic to logarithmic") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("0.33 from cubic to logarithmic") << qreal(0.33) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.15); + QTest::newRow("0.5 from cubic to logarithmic") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.44); + QTest::newRow("0.72 from cubic to logarithmic") << qreal(0.72) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.82); + QTest::newRow("1.0 from cubic to logarithmic") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from cubic to decibel") << qreal(-1.0) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200); + QTest::newRow("0.0 from cubic to decibel") << qreal(0.0) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200); + QTest::newRow("0.33 from cubic to decibel") << qreal(0.33) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-28.89); + QTest::newRow("0.5 from cubic to decibel") << qreal(0.5) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-18.06); + QTest::newRow("0.72 from cubic to decibel") << qreal(0.72) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(-8.56); + QTest::newRow("1.0 from cubic to decibel") << qreal(1.0) << QAudio::CubicVolumeScale << QAudio::DecibelVolumeScale << qreal(0); + + QTest::newRow("-1.0 from logarithmic to linear") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("0.0 from logarithmic to linear") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("0.33 from logarithmic to linear") << qreal(0.33) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.09); + QTest::newRow("0.5 from logarithmic to linear") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.15); + QTest::newRow("0.72 from logarithmic to linear") << qreal(0.72) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(0.28); + QTest::newRow("1.0 from logarithmic to linear") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::LinearVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from logarithmic to cubic") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("0.0 from logarithmic to cubic") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("0.33 from logarithmic to cubic") << qreal(0.33) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.44); + QTest::newRow("0.5 from logarithmic to cubic") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.53); + QTest::newRow("0.72 from logarithmic to cubic") << qreal(0.72) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(0.65); + QTest::newRow("1.0 from logarithmic to cubic") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::CubicVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from logarithmic to logarithmic") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("0.0 from logarithmic to logarithmic") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("0.5 from logarithmic to logarithmic") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.5); + QTest::newRow("1.0 from logarithmic to logarithmic") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0); + + QTest::newRow("-1.0 from logarithmic to decibel") << qreal(-1.0) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200); + QTest::newRow("0.0 from logarithmic to decibel") << qreal(0.0) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-200); + QTest::newRow("0.33 from logarithmic to decibel") << qreal(0.33) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-21.21); + QTest::newRow("0.5 from logarithmic to decibel") << qreal(0.5) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-16.45); + QTest::newRow("0.72 from logarithmic to decibel") << qreal(0.72) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(-11.17); + QTest::newRow("1.0 from logarithmic to decibel") << qreal(1.0) << QAudio::LogarithmicVolumeScale << QAudio::DecibelVolumeScale << qreal(0); + + QTest::newRow("-1000 from decibel to linear") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("-200 from decibel to linear") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.0); + QTest::newRow("-40 from decibel to linear") << qreal(-40.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.01); + QTest::newRow("-10 from decibel to linear") << qreal(-10.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.32); + QTest::newRow("-5 from decibel to linear") << qreal(-5.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(0.56); + QTest::newRow("0 from decibel to linear") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::LinearVolumeScale << qreal(1.0); + + QTest::newRow("-1000 from decibel to cubic") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("-200 from decibel to cubic") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.0); + QTest::newRow("-40 from decibel to cubic") << qreal(-40.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.22); + QTest::newRow("-10 from decibel to cubic") << qreal(-10.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.68); + QTest::newRow("-5 from decibel to cubic") << qreal(-5.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(0.83); + QTest::newRow("0 from decibel to cubic") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::CubicVolumeScale << qreal(1.0); + + QTest::newRow("-1000 from decibel to logarithmic") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("-200 from decibel to logarithmic") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.0); + QTest::newRow("-40 from decibel to logarithmic") << qreal(-40.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.05); + QTest::newRow("-10 from decibel to logarithmic") << qreal(-10.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.77); + QTest::newRow("-5 from decibel to logarithmic") << qreal(-5.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(0.92); + QTest::newRow("0 from decibel to logarithmic") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::LogarithmicVolumeScale << qreal(1.0); + + QTest::newRow("-1000 from decibel to decibel") << qreal(-1000.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(-1000.0); + QTest::newRow("-200 from decibel to decibel") << qreal(-200.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(-200.0); + QTest::newRow("-30 from decibel to decibel") << qreal(-30.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(-30.0); + QTest::newRow("0 from decibel to decibel") << qreal(0.0) << QAudio::DecibelVolumeScale << QAudio::DecibelVolumeScale << qreal(0.0); +} + +void tst_QAudioNamespace::convertVolume() +{ + QFETCH(qreal, input); + QFETCH(QAudio::VolumeScale, from); + QFETCH(QAudio::VolumeScale, to); + QFETCH(qreal, expectedOutput); + + qreal actualOutput = QAudio::convertVolume(input, from, to); + QVERIFY2(qAbs(actualOutput - expectedOutput) < 0.01, + QString("actual: %1, expected: %2").arg(actualOutput).arg(expectedOutput).toLocal8Bit().constData()); +} + QTEST_MAIN(tst_QAudioNamespace) #include "tst_qaudionamespace.moc" diff --git a/tests/auto/unit/qdeclarativemultimediaglobal/tst_qdeclarativemultimediaglobal.qml b/tests/auto/unit/qdeclarativemultimediaglobal/tst_qdeclarativemultimediaglobal.qml index bce0ca791..e44c68a29 100644 --- a/tests/auto/unit/qdeclarativemultimediaglobal/tst_qdeclarativemultimediaglobal.qml +++ b/tests/auto/unit/qdeclarativemultimediaglobal/tst_qdeclarativemultimediaglobal.qml @@ -63,4 +63,118 @@ TestCase { compare(camera.orientation, 0, "orientation"); } + function test_convertVolume_data() { + return [ + { tag: "-1.0 from linear to linear", input: -1, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from linear to linear", input: 0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "0.5 from linear to linear", input: 0.5, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.5 }, + { tag: "1.0 from linear to linear", input: 1.0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from linear to cubic", input: -1, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from linear to cubic", input: 0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "0.33 from linear to cubic", input: 0.33, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.69 }, + { tag: "0.5 from linear to cubic", input: 0.5, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.79 }, + { tag: "0.72 from linear to cubic", input: 0.72, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.89 }, + { tag: "1.0 from linear to cubic", input: 1.0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from linear to logarithmic", input: -1, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from linear to logarithmic", input: 0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "0.33 from linear to logarithmic", input: 0.33, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.78 }, + { tag: "0.5 from linear to logarithmic", input: 0.5, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.9 }, + { tag: "0.72 from linear to logarithmic", input: 0.72, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.96 }, + { tag: "1.0 from linear to logarithmic", input: 1.0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from linear to decibel", input: -1, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "0.0 from linear to decibel", input: 0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "0.33 from linear to decibel", input: 0.33, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -9.63 }, + { tag: "0.5 from linear to decibel", input: 0.5, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -6.02 }, + { tag: "0.72 from linear to decibel", input: 0.72, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -2.85 }, + { tag: "1.0 from linear to decibel", input: 1.0, from: QtMultimedia.LinearVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: 0 }, + + { tag: "-1.0 from cubic to linear", input: -1, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from cubic to linear", input: 0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "0.33 from cubic to linear", input: 0.33, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.04 }, + { tag: "0.5 from cubic to linear", input: 0.5, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.13 }, + { tag: "0.72 from cubic to linear", input: 0.72, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.37 }, + { tag: "1.0 from cubic to linear", input: 1.0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 1 }, + + { tag: "-1.0 from cubic to cubic", input: -1, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from cubic to cubic", input: 0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "0.5 from cubic to cubic", input: 0.5, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.5 }, + { tag: "1.0 from cubic to cubic", input: 1.0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from cubic to logarithmic", input: -1, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from cubic to logarithmic", input: 0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "0.33 from cubic to logarithmic", input: 0.33, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.15 }, + { tag: "0.5 from cubic to logarithmic", input: 0.5, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.44 }, + { tag: "0.72 from cubic to logarithmic", input: 0.72, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.82 }, + { tag: "1.0 from cubic to logarithmic", input: 1.0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 1 }, + + { tag: "-1.0 from cubic to decibel", input: -1, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "0.0 from cubic to decibel", input: 0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "0.33 from cubic to decibel", input: 0.33, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -28.89 }, + { tag: "0.5 from cubic to decibel", input: 0.5, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -18.06 }, + { tag: "0.72 from cubic to decibel", input: 0.72, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -8.56 }, + { tag: "1.0 from cubic to decibel", input: 1.0, from: QtMultimedia.CubicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: 0 }, + + { tag: "-1.0 from logarithmic to linear", input: -1, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from logarithmic to linear", input: 0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "0.33 from logarithmic to linear", input: 0.33, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.09 }, + { tag: "0.5 from logarithmic to linear", input: 0.5, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.15 }, + { tag: "0.72 from logarithmic to linear", input: 0.72, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.28 }, + { tag: "1.0 from logarithmic to linear", input: 1.0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from logarithmic to cubic", input: -1, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from logarithmic to cubic", input: 0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "0.33 from logarithmic to cubic", input: 0.33, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.44 }, + { tag: "0.5 from logarithmic to cubic", input: 0.5, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.53 }, + { tag: "0.72 from logarithmic to cubic", input: 0.72, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.65 }, + { tag: "1.0 from logarithmic to cubic", input: 1.0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from logarithmic to logarithmic", input: -1, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "0.0 from logarithmic to logarithmic", input: 0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "0.5 from logarithmic to logarithmic", input: 0.5, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.5 }, + { tag: "1.0 from logarithmic to logarithmic", input: 1.0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 1.0 }, + + { tag: "-1.0 from logarithmic to decibel", input: -1, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "0.0 from logarithmic to decibel", input: 0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "0.33 from logarithmic to decibel", input: 0.33, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -21.21 }, + { tag: "0.5 from logarithmic to decibel", input: 0.5, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -16.45 }, + { tag: "0.72 from logarithmic to decibel", input: 0.72, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -11.17 }, + { tag: "1.0 from logarithmic to decibel", input: 1.0, from: QtMultimedia.LogarithmicVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: 0 }, + + { tag: "-1000 from decibel to linear", input: -1000, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "-200 from decibel to linear", input: -200, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0 }, + { tag: "-40 from decibel to linear", input: -40, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.01 }, + { tag: "-10 from decibel to linear", input: -10, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.32 }, + { tag: "-5 from decibel to linear", input: -5, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 0.56 }, + { tag: "0 from decibel to linear", input: 0, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LinearVolumeScale, expectedOutput: 1 }, + + { tag: "-1000 from decibel to cubic", input: -1000, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "-200 from decibel to cubic", input: -200, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0 }, + { tag: "-40 from decibel to cubic", input: -40, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.22 }, + { tag: "-10 from decibel to cubic", input: -10, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.68 }, + { tag: "-5 from decibel to cubic", input: -5, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 0.83 }, + { tag: "0 from decibel to cubic", input: 0, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.CubicVolumeScale, expectedOutput: 1 }, + + { tag: "-1000 from decibel to logarithmic", input: -1000, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "-200 from decibel to logarithmic", input: -200, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0 }, + { tag: "-40 from decibel to logarithmic", input: -40, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.05 }, + { tag: "-10 from decibel to logarithmic", input: -10, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.77 }, + { tag: "-5 from decibel to logarithmic", input: -5, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 0.92 }, + { tag: "0 from decibel to logarithmic", input: 0, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.LogarithmicVolumeScale, expectedOutput: 1 }, + + { tag: "-1000 from decibel to decibel", input: -1000, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -1000 }, + { tag: "-200 from decibel to decibel", input: -200, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -200 }, + { tag: "-30 from decibel to decibel", input: -30, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: -30 }, + { tag: "0 from decibel to decibel", input: 0, from: QtMultimedia.DecibelVolumeScale, to: QtMultimedia.DecibelVolumeScale, expectedOutput: 0 }, + ] + } + + function test_convertVolume(data) { + fuzzyCompare(QtMultimedia.convertVolume(data.input, data.from, data.to), + data.expectedOutput, + 0.01); + } + } diff --git a/tests/auto/unit/qmediapluginloader/qmediapluginloader.pro b/tests/auto/unit/qmediapluginloader/qmediapluginloader.pro index 26f232010..90b02ac59 100644 --- a/tests/auto/unit/qmediapluginloader/qmediapluginloader.pro +++ b/tests/auto/unit/qmediapluginloader/qmediapluginloader.pro @@ -4,10 +4,3 @@ TARGET = tst_qmediapluginloader QT += multimedia-private testlib SOURCES += tst_qmediapluginloader.cpp - -wince* { - PLUGIN_DEPLOY.sources = $$OUTPUT_DIR/plugins/mediaservice/*.dll - PLUGIN_DEPLOY.path = mediaservice - DEPLOYMENT += PLUGIN_DEPLOY -} - diff --git a/tests/auto/unit/qpaintervideosurface/qpaintervideosurface.pro b/tests/auto/unit/qpaintervideosurface/qpaintervideosurface.pro index 848b1c806..f1db2c5fb 100644 --- a/tests/auto/unit/qpaintervideosurface/qpaintervideosurface.pro +++ b/tests/auto/unit/qpaintervideosurface/qpaintervideosurface.pro @@ -2,11 +2,9 @@ CONFIG += testcase TARGET = tst_qpaintervideosurface QT += multimedia-private multimediawidgets-private testlib -qtHaveModule(opengl) { +qtHaveModule(opengl): \ QT += opengl -} else { - DEFINES += QT_NO_OPENGL -} + SOURCES += tst_qpaintervideosurface.cpp |