From ba847185e2b0dfaa39fddb9845ad7208b0d1018d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 11 Jan 2016 17:20:29 +0200 Subject: Remove checking exact remaining loop amount right after calling play() Depending on platform it is unknown how many times it has already been actually playing the audio. Change-Id: I27b65cee8de5f9f75ceda277ee22d86f7897ce7b Reviewed-by: Yoann Lopes --- tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp index 642c00ceb..e8ea3a487 100644 --- a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp +++ b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp @@ -150,8 +150,7 @@ void tst_QSoundEffect::testLooping() QCOMPARE(readSignal_Remaining.count(), 0); sound->play(); - QCOMPARE(sound->loopsRemaining(), 5); - QCOMPARE(readSignal_Remaining.count(), 1); + QVERIFY(readSignal_Remaining.count() > 0); // test.wav is about 200ms, wait until it has finished playing 5 times QTestEventLoop::instance().enterLoop(3); @@ -172,8 +171,7 @@ void tst_QSoundEffect::testLooping() QCOMPARE(readSignal_Remaining.count(), 0); sound->play(); - QCOMPARE(sound->loopsRemaining(), 30); - QCOMPARE(readSignal_Remaining.count(), 1); + QVERIFY(readSignal_Remaining.count() > 0); // wait for the sound to be played several times QTRY_COMPARE(sound->loopsRemaining(), 20); -- cgit v1.2.3 From 481dd30e2f62e6179fbb95d6b7a667813338dd00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 11 Jan 2016 13:42:00 +0200 Subject: Remove testing category to empty string Not all backends have empty default category Change-Id: I55025bf213063c5fd64dd5be4031aabf3a148a7b Reviewed-by: Yoann Lopes --- tests/auto/integration/qml/soundeffect/tst_soundeffect.qml | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qml/soundeffect/tst_soundeffect.qml b/tests/auto/integration/qml/soundeffect/tst_soundeffect.qml index 17908af94..f39dc1f75 100644 --- a/tests/auto/integration/qml/soundeffect/tst_soundeffect.qml +++ b/tests/auto/integration/qml/soundeffect/tst_soundeffect.qml @@ -134,7 +134,6 @@ Item { verify(sound1.muted == false) verify(sound1.playing == false) verify(sound1.status == 1) // Status.Loading - verify(sound1.category == "") } function test_muting() { -- cgit v1.2.3 From dd0fa191ffa22adc2e5a8a08293aea918780b6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Wed, 13 Jan 2016 14:44:12 +0200 Subject: Fix clearing signals already send after first part of audio data Previous place for clearing received signal could errounsely clear already sent signal which causes next signalState comparison to fail on some platform. Change-Id: Iaffdbbcab1ec9afa0be6f1f7b7aee62b981ee319 Reviewed-by: Yoann Lopes --- tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp index 81aa97d91..07043e9ce 100755 --- a/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp @@ -702,11 +702,11 @@ void tst_QAudioOutput::push() QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data"); QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data"); firstBuffer = false; + stateSignal.clear(); } } else QTest::qWait(20); } - stateSignal.clear(); // Wait until playback finishes QTest::qWait(3000); // 3 seconds should be plenty -- cgit v1.2.3 From f69a0516754ec2c6f1448fd3deac8d34bc35eb73 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Mon, 18 Jan 2016 12:19:53 +0100 Subject: Fix tst_QVideoWidget. Make sure the tested QVideoWidget has a valid size. Since 7b63c45d in qtbase, native widgets are required to have a valid size to be shown. This test relies on qWaitForWindowExposed() to work correctly, which means the widget must be shown and thus must have a valid size. Change-Id: I13bc1536d788d9ba56b4dcbf0c60851b5634be9e Reviewed-by: Simon Hausmann --- tests/auto/unit/qvideowidget/tst_qvideowidget.cpp | 103 +++++++++------------- 1 file changed, 42 insertions(+), 61 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/unit/qvideowidget/tst_qvideowidget.cpp b/tests/auto/unit/qvideowidget/tst_qvideowidget.cpp index 2f84de03f..8dd1f39f4 100644 --- a/tests/auto/unit/qvideowidget/tst_qvideowidget.cpp +++ b/tests/auto/unit/qvideowidget/tst_qvideowidget.cpp @@ -114,6 +114,17 @@ private: Q_DECLARE_METATYPE(Qt::AspectRatioMode) Q_DECLARE_METATYPE(const uchar *) +class QtTestVideoWidget : public QVideoWidget +{ +public: + QtTestVideoWidget(QWidget *parent = 0) + : QVideoWidget(parent) + { + setWindowFlags(Qt::X11BypassWindowManagerHint); + resize(320, 240); + } +}; + class QtTestWindowControl : public QVideoWindowControl { public: @@ -339,8 +350,7 @@ public: void tst_QVideoWidget::nullObject() { - QVideoWidget widget; - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); + QtTestVideoWidget widget; QVERIFY(widget.sizeHint().isEmpty()); @@ -425,11 +435,9 @@ void tst_QVideoWidget::nullService() { QtTestVideoObject object(0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); - QVERIFY(widget.sizeHint().isEmpty()); widget.show(); @@ -459,9 +467,8 @@ void tst_QVideoWidget::noOutputs() { QtTestVideoObject object(0, 0, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QVERIFY(widget.sizeHint().isEmpty()); @@ -489,9 +496,8 @@ void tst_QVideoWidget::serviceDestroyed() QtTestVideoObject object(new QtTestWindowControl, new QtTestWidgetControl, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -526,16 +532,14 @@ void tst_QVideoWidget::objectDestroyed() new QtTestWidgetControl, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object->bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(object->testService->windowRef, 0); QCOMPARE(object->testService->widgetRef, 1); QCOMPARE(object->testService->rendererRef, 0); widget.show(); - QVERIFY(QTest::qWaitForWindowExposed(&widget)); widget.setBrightness(100); widget.setContrast(100); @@ -569,8 +573,7 @@ void tst_QVideoWidget::setMediaObject() QtTestVideoObject widgetObject(0, new QtTestWidgetControl, 0); QtTestVideoObject rendererObject(0, 0, new QtTestRendererControl); - QVideoWidget widget; - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); + QtTestVideoWidget widget; widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -622,9 +625,8 @@ void tst_QVideoWidget::showWindowControl() QtTestVideoObject object(new QtTestWindowControl, 0, 0); object.testService->windowControl->setNativeSize(QSize(240, 180)); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -648,9 +650,8 @@ void tst_QVideoWidget::showWidgetControl() #endif QtTestVideoObject object(0, new QtTestWidgetControl, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -672,9 +673,8 @@ void tst_QVideoWidget::showRendererControl() #endif QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -693,9 +693,8 @@ void tst_QVideoWidget::aspectRatioWindowControl() QtTestVideoObject object(new QtTestWindowControl, 0, 0); object.testService->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); // Test the aspect ratio defaults to keeping the aspect ratio. QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); @@ -729,9 +728,8 @@ void tst_QVideoWidget::aspectRatioWidgetControl() QtTestVideoObject object(0, new QtTestWidgetControl, 0); object.testService->widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); // Test the aspect ratio defaults to keeping the aspect ratio. QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); @@ -764,9 +762,8 @@ void tst_QVideoWidget::aspectRatioRendererControl() QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); // Test the aspect ratio defaults to keeping the aspect ratio. QCOMPARE(widget.aspectRatioMode(), Qt::KeepAspectRatio); @@ -801,9 +798,8 @@ void tst_QVideoWidget::sizeHintWindowControl() QFETCH(QSize, size); QtTestVideoObject object(new QtTestWindowControl, 0, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -822,9 +818,8 @@ void tst_QVideoWidget::sizeHintWidgetControl() QFETCH(QSize, size); QtTestVideoObject object(0, new QtTestWidgetControl, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -877,9 +872,8 @@ void tst_QVideoWidget::sizeHintRendererControl() QFETCH(QSize, expectedSize); QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -897,7 +891,7 @@ void tst_QVideoWidget::sizeHintRendererControl() void tst_QVideoWidget::fullScreenWindowControl() { QtTestVideoObject object(new QtTestWindowControl, 0, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -982,7 +976,7 @@ void tst_QVideoWidget::fullScreenWidgetControl() #endif QtTestVideoObject object(0, new QtTestWidgetControl, 0); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1068,7 +1062,7 @@ void tst_QVideoWidget::fullScreenRendererControl() #endif QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); widget.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1164,9 +1158,8 @@ void tst_QVideoWidget::brightnessWindowControl() QtTestVideoObject object(new QtTestWindowControl, 0, 0); object.testService->windowControl->setBrightness(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1209,9 +1202,8 @@ void tst_QVideoWidget::brightnessWidgetControl() QtTestVideoObject object(0, new QtTestWidgetControl, 0); object.testService->widgetControl->setBrightness(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.brightness(), 0); @@ -1248,9 +1240,8 @@ void tst_QVideoWidget::brightnessRendererControl() QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1275,9 +1266,8 @@ void tst_QVideoWidget::contrastWindowControl() QtTestVideoObject object(new QtTestWindowControl, 0, 0); object.testService->windowControl->setContrast(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.contrast(), 0); @@ -1317,9 +1307,8 @@ void tst_QVideoWidget::contrastWidgetControl() QtTestVideoObject object(0, new QtTestWidgetControl, 0); object.testService->widgetControl->setContrast(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.contrast(), 0); widget.show(); @@ -1356,9 +1345,8 @@ void tst_QVideoWidget::contrastRendererControl() QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1383,9 +1371,8 @@ void tst_QVideoWidget::hueWindowControl() QtTestVideoObject object(new QtTestWindowControl, 0, 0); object.testService->windowControl->setHue(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.hue(), 0); widget.show(); @@ -1424,9 +1411,8 @@ void tst_QVideoWidget::hueWidgetControl() QtTestVideoObject object(0, new QtTestWidgetControl, 0); object.testService->widgetControl->setHue(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.hue(), 0); widget.show(); @@ -1463,9 +1449,8 @@ void tst_QVideoWidget::hueRendererControl() QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1490,9 +1475,8 @@ void tst_QVideoWidget::saturationWindowControl() QtTestVideoObject object(new QtTestWindowControl, 0, 0); object.testService->windowControl->setSaturation(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.saturation(), 0); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); @@ -1530,9 +1514,8 @@ void tst_QVideoWidget::saturationWidgetControl() QtTestVideoObject object(0, new QtTestWidgetControl, 0); object.testService->widgetControl->setSaturation(controlValue); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); QCOMPARE(widget.saturation(), 0); widget.show(); @@ -1570,9 +1553,8 @@ void tst_QVideoWidget::saturationRendererControl() QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); QSignalSpy spy(&widget, SIGNAL(saturationChanged(int))); @@ -1597,9 +1579,8 @@ void tst_QVideoWidget::paintRendererControl() { QtTestVideoObject object(0, 0, new QtTestRendererControl); - QVideoWidget widget; + QtTestVideoWidget widget; object.bind(&widget); - widget.setWindowFlags(Qt::X11BypassWindowManagerHint); widget.resize(640,480); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); -- cgit v1.2.3 From 8d84a30e4d5ebec6e9c921ca855fc0cc5f1d9269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Thu, 14 Jan 2016 15:56:00 +0200 Subject: Be more permissive in QSoundEffect integration test. Change-Id: I9f92fda79bb359f8fa53aa11b9b6889cd35fcb6e Reviewed-by: Yoann Lopes --- tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp index e8ea3a487..604607ab0 100644 --- a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp +++ b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp @@ -174,7 +174,7 @@ void tst_QSoundEffect::testLooping() QVERIFY(readSignal_Remaining.count() > 0); // wait for the sound to be played several times - QTRY_COMPARE(sound->loopsRemaining(), 20); + QTRY_VERIFY(sound->loopsRemaining() <= 20); QVERIFY(readSignal_Remaining.count() >= 10); readSignal_Count.clear(); readSignal_Remaining.clear(); -- cgit v1.2.3 From 42dc97388137b753fbe7dc77371a51dfbd98d127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pasi=20Pet=C3=A4j=C3=A4j=C3=A4rvi?= Date: Mon, 11 Jan 2016 13:52:50 +0200 Subject: Fix tst_QAudioOutput::pushSuspendResume(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Documentation states that state in push mode after suspend and resume should be QAudio::IdleState. Task-number: QTBUG-50390 Change-Id: I214f1808948ce862b62afd0fb9d245d0c7e4ad26 Reviewed-by: Pasi Petäjäjärvi --- tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp index 07043e9ce..b887d3f9a 100755 --- a/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/integration/qaudiooutput/tst_qaudiooutput.cpp @@ -825,10 +825,10 @@ void tst_QAudioOutput::pushSuspendResume() // but not too much or the rest of the file may be processed QTest::qWait(20); - // Check that QAudioOutput immediately transitions to ActiveState + // Check that QAudioOutput immediately transitions to IdleState QVERIFY2((stateSignal.count() == 1), QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData()); - QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after resume()"); + QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transition to IdleState after resume()"); QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()"); stateSignal.clear(); @@ -837,6 +837,7 @@ void tst_QAudioOutput::pushSuspendResume() if (audioOutput.bytesFree() >= audioOutput.periodSize()) { qint64 len = audioFile->read(buffer.data(),audioOutput.periodSize()); written += feed->write(buffer.constData(), len); + QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after writing audio data"); } else QTest::qWait(20); } -- cgit v1.2.3