From 310b993657988220ce45dfd7dbab2ccac34c00e9 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Mon, 28 Sep 2009 09:20:57 +1000 Subject: Removed stateChanged and notify signals from win32 qaudiooutput builtin. stateChanged and notify signals are inherited from base class. Reviewed-by:Bill King --- src/multimedia/audio/qaudiooutput_win32_p.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 68f418e..5c08bf4 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -104,10 +104,6 @@ private slots: void feedback(); bool deviceReady(); -signals: - void stateChanged(QAudio::State); - void notify(); - private: QByteArray m_device; bool resuming; -- cgit v0.12 From 2f132101fbc1b9f988e1cd3baf79408d54a69a14 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Mon, 28 Sep 2009 11:17:45 +1000 Subject: Improved audio unit tests Added more checking in each step of the playback or recording tests. Reviewed-by:Justin McPherson --- tests/auto/qaudioinput/tst_qaudioinput.cpp | 34 +++++++++++++++++++++++++++- tests/auto/qaudiooutput/tst_qaudiooutput.cpp | 34 +++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp index 7331072..69b507d 100644 --- a/tests/auto/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp @@ -56,6 +56,7 @@ public: private slots: void initTestCase(); void settings(); + void buffers(); void notifyInterval(); void pullFile(); @@ -90,6 +91,7 @@ void tst_QAudioInput::initTestCase() void tst_QAudioInput::settings() { if(available) { + // Confirm the setting we added in the init function. QAudioFormat f = audio->format(); QVERIFY(format.channels() == f.channels()); @@ -101,6 +103,18 @@ void tst_QAudioInput::settings() } } +void tst_QAudioInput::buffers() +{ + if(available) { + // Should always have a buffer size greater than zero. + int store = audio->bufferSize(); + audio->setBufferSize(4096); + QVERIFY(audio->bufferSize() > 0); + audio->setBufferSize(store); + QVERIFY(audio->bufferSize() == store); + } +} + void tst_QAudioInput::notifyInterval() { if(available) { @@ -120,14 +134,32 @@ void tst_QAudioInput::pullFile() filename.open( QIODevice::WriteOnly | QIODevice::Truncate ); QSignalSpy readSignal(audio, SIGNAL(notify())); - audio->start(&filename); + QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State))); + + // Always have default states, before start + QVERIFY(audio->state() == QAudio::StopState); + QVERIFY(audio->error() == QAudio::NoError); + audio->start(&filename); + QTest::qWait(20); + // Check state and periodSize() are valid non-zero values. + QVERIFY(audio->state() == QAudio::ActiveState); + QVERIFY(audio->error() == QAudio::NoError); + QVERIFY(audio->periodSize() > 0); + QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState + + // Wait until finished... QTest::qWait(5000); QVERIFY(readSignal.count() > 0); QVERIFY(audio->totalTime() > 0); audio->stop(); + QTest::qWait(20); + QVERIFY(audio->state() == QAudio::StopState); + // Can only check to make sure we got at least 1 more signal, but can be more. + QVERIFY(stateSignal.count() > 1); + filename.close(); } } diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp index b45a57e..f1c75dc 100644 --- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp +++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp @@ -58,6 +58,7 @@ public: private slots: void initTestCase(); void settings(); + void buffers(); void notifyInterval(); void pullFile(); void pushFile(); @@ -91,6 +92,7 @@ void tst_QAudioOutput::initTestCase() void tst_QAudioOutput::settings() { if(available) { + // Confirm the setting we added in the init function. QAudioFormat f = audio->format(); QVERIFY(format.channels() == f.channels()); @@ -102,6 +104,18 @@ void tst_QAudioOutput::settings() } } +void tst_QAudioOutput::buffers() +{ + if(available) { + // Should always have a buffer size greater than zero. + int store = audio->bufferSize(); + audio->setBufferSize(4096); + QVERIFY(audio->bufferSize() > 0); + audio->setBufferSize(store); + QVERIFY(audio->bufferSize() == store); + } +} + void tst_QAudioOutput::notifyInterval() { if(available) { @@ -122,15 +136,33 @@ void tst_QAudioOutput::pullFile() file.open(QIODevice::ReadOnly); QSignalSpy readSignal(audio, SIGNAL(notify())); + QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State))); audio->setNotifyInterval(100); - audio->start(&file); + // Always have default states, before start + QVERIFY(audio->state() == QAudio::StopState); + QVERIFY(audio->error() == QAudio::NoError); + + audio->start(&file); + QTest::qWait(20); // wait 20ms + // Check state, bytesFree() and periodSize() are valid non-zero values. + QVERIFY(audio->state() == QAudio::ActiveState); + QVERIFY(audio->error() == QAudio::NoError); + QVERIFY(audio->periodSize() > 0); + QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState + + // Wait until finished... QTestEventLoop::instance().enterLoop(1); QCOMPARE(audio->totalTime(), qint64(692250)); // 4.wav is a little less than 700ms, so notify should fire 6 times! QVERIFY(readSignal.count() >= 6); audio->stop(); + QTest::qWait(20); // wait 20ms + QVERIFY(audio->state() == QAudio::StopState); + // Can only check to make sure we got at least 1 more signal, but can be more. + QVERIFY(stateSignal.count() > 1); + file.close(); } } -- cgit v0.12 From 635beba2a236dd3028c4ae20e321b183009ae7a9 Mon Sep 17 00:00:00 2001 From: Sarah Smith Date: Mon, 28 Sep 2009 12:05:16 +1000 Subject: Fix doc break in examples/hellogl Snippets pointing to moved code - now fixed. Reviewed-by: TrustMe --- doc/src/examples/hellogl.qdoc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/examples/hellogl.qdoc b/doc/src/examples/hellogl.qdoc index 77deefe..5fd2c6f 100644 --- a/doc/src/examples/hellogl.qdoc +++ b/doc/src/examples/hellogl.qdoc @@ -203,14 +203,14 @@ This class encapsulates the OpenGL geometry data which will be rendered in the basic 3D scene. - \snippet examples/opengl/hellogl/qtlogo.h 0 + \snippet examples/opengl/shared/qtlogo.h 0 The geometry is divided into a list of parts which may be rendered in different ways. The data itself is contained in a Geometry structure that includes the vertices, their lighting normals and index values which point into the vertices, grouping them into faces. - \snippet examples/opengl/hellogl/qtlogo.cpp 0 + \snippet examples/opengl/shared/qtlogo.cpp 0 The data in the Geometry class is stored in QVector members which are convenient for use with OpenGL because they expose raw @@ -218,7 +218,7 @@ are included for adding new vertex data, either with smooth normals, or facetted normals; and for enabling the geometry ready for rendering. - \snippet examples/opengl/hellogl/qtlogo.cpp 1 + \snippet examples/opengl/shared/qtlogo.cpp 1 The higher level Patch class has methods for accumulating the geometry one face at a time, and treating collections of faces or "patches" with @@ -226,14 +226,14 @@ may be added as triangles or quads, at the OpenGL level all data is treated as triangles for compatibility with OpenGL/ES. - \snippet examples/opengl/hellogl/qtlogo.cpp 2 + \snippet examples/opengl/shared/qtlogo.cpp 2 Drawing a Patch is simply acheived by applying any transformation, and material effect, then drawing the data using the index range for the patch. The model-view matrix is saved and then restored so that any transformation does not affect other parts of the scene. - \snippet examples/opengl/hellogl/qtlogo.cpp 3 + \snippet examples/opengl/shared/qtlogo.cpp 3 The geometry is built once on construction of the QtLogo, and it is paramaterized on a number of divisions - which controls how "chunky" the @@ -245,7 +245,7 @@ details) which only exist during the build phase, to assemble the parts of the scene. - \snippet examples/opengl/hellogl/qtlogo.cpp 4 + \snippet examples/opengl/shared/qtlogo.cpp 4 Finally the complete QtLogo scene is simply drawn by enabling the data arrays and then iterating over the parts, calling draw() on each one. -- cgit v0.12 From 802a2929a4218987a7a351802f63d2c0f2300bb2 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Mon, 28 Sep 2009 12:16:44 +1000 Subject: QSQL; Precision Policy - update test to reflect passing status. Reviewed-by: Bill King --- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 4198bfc..ce2396d 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -1705,8 +1705,6 @@ void tst_QSqlDatabase::precisionPolicy() QEXPECT_FAIL("QOCI", "Oracle fails here, to retrieve next", Continue); QVERIFY_SQL(q, exec(query)); QVERIFY_SQL(q, next()); - if(db.driverName().startsWith("QSQLITE")) - QEXPECT_FAIL("", "SQLite returns this value as determined by contents of the field, not the declaration", Continue); QCOMPARE(q.value(0).type(), QVariant::LongLong); QSql::NumericalPrecisionPolicy oldPrecision= db.numericalPrecisionPolicy(); @@ -1715,8 +1713,6 @@ void tst_QSqlDatabase::precisionPolicy() q2.exec(QString("SELECT num FROM %1 WHERE id = 2").arg(tableName)); QVERIFY_SQL(q2, exec(query)); QVERIFY_SQL(q2, next()); - if(db.driverName().startsWith("QSQLITE")) - QEXPECT_FAIL("", "SQLite returns this value as determined by contents of the field, not the declaration", Continue); QCOMPARE(q2.value(0).type(), QVariant::LongLong); db.setNumericalPrecisionPolicy(oldPrecision); } -- cgit v0.12