From 91ebcc413f0650ab235b93689776d4457bdbc80e Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Mon, 22 Mar 2010 10:28:27 +1000 Subject: Fixed inconsistent test naming. TARGET and test class name should always match. --- tests/auto/declarative/declarative.pro | 2 +- tests/auto/declarative/layouts/data/layouts.qml | 34 -- tests/auto/declarative/layouts/layouts.pro | 7 - tests/auto/declarative/layouts/tst_layouts.cpp | 147 ------- .../qdeclarativelayouts/data/layouts.qml | 34 ++ .../qdeclarativelayouts/qdeclarativelayouts.pro | 7 + .../tst_qdeclarativelayouts.cpp | 147 +++++++ tests/auto/network.pro | 2 +- tests/auto/opengl.pro | 2 +- .../qdeclarativeaudio/tst_qdeclarativeaudio.cpp | 42 +- .../qdeclarativevideo/tst_qdeclarativevideo.cpp | 24 +- tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 76 ++-- tests/auto/qgl_threads/qgl_threads.pro | 11 - tests/auto/qgl_threads/tst_openglthreading.cpp | 480 --------------------- tests/auto/qgl_threads/tst_openglthreading.h | 61 --- tests/auto/qglthreads/qglthreads.pro | 7 + tests/auto/qglthreads/tst_qglthreads.cpp | 480 +++++++++++++++++++++ tests/auto/qglthreads/tst_qglthreads.h | 61 +++ .../qnetworkconfigmanager.pro | 15 - .../tst_qnetworkconfigmanager.cpp | 335 -------------- .../qnetworkconfigurationmanager.pro | 15 + .../tst_qnetworkconfigurationmanager.cpp | 335 ++++++++++++++ .../tst_qtconcurrentiteratekernel.cpp | 22 +- tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp | 62 +-- tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp | 22 +- .../tst_qtconcurrentthreadengine.cpp | 24 +- tests/auto/qvectornd/tst_qvectornd.cpp | 166 +++---- .../tst_xmlpatternsdiagnosticsts.cpp | 10 +- 28 files changed, 1313 insertions(+), 1317 deletions(-) delete mode 100644 tests/auto/declarative/layouts/data/layouts.qml delete mode 100644 tests/auto/declarative/layouts/layouts.pro delete mode 100644 tests/auto/declarative/layouts/tst_layouts.cpp create mode 100644 tests/auto/declarative/qdeclarativelayouts/data/layouts.qml create mode 100644 tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro create mode 100644 tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp delete mode 100644 tests/auto/qgl_threads/qgl_threads.pro delete mode 100644 tests/auto/qgl_threads/tst_openglthreading.cpp delete mode 100644 tests/auto/qgl_threads/tst_openglthreading.h create mode 100644 tests/auto/qglthreads/qglthreads.pro create mode 100644 tests/auto/qglthreads/tst_qglthreads.cpp create mode 100644 tests/auto/qglthreads/tst_qglthreads.h delete mode 100644 tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro delete mode 100644 tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp create mode 100644 tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro create mode 100644 tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 36eade8..eb74244 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -1,7 +1,6 @@ TEMPLATE = subdirs SUBDIRS += \ graphicswidgets \ # Cover - layouts \ # Cover parserstress \ # Cover qmetaobjectbuilder \ # Cover qdeclarativeanimations \ # Cover @@ -29,6 +28,7 @@ SUBDIRS += \ qdeclarativeitem \ # Cover qdeclarativelistview \ # Cover qdeclarativeloader \ # Cover + qdeclarativelayouts \ # Cover qdeclarativemousearea \ # Cover qdeclarativeparticles \ # Cover qdeclarativepathview \ # Cover diff --git a/tests/auto/declarative/layouts/data/layouts.qml b/tests/auto/declarative/layouts/data/layouts.qml deleted file mode 100644 index 1792500..0000000 --- a/tests/auto/declarative/layouts/data/layouts.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import Qt.widgets 4.6 - -Item { - id: resizable - width:300 - height:300 - - GraphicsObjectContainer { - anchors.fill: parent - synchronizedResizing: true - - QGraphicsWidget { - - layout: QGraphicsLinearLayout { - spacing: 0 - LayoutItem { - objectName: "left" - minimumSize: "100x100" - maximumSize: "300x300" - preferredSize: "100x100" - Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } - } - LayoutItem { - objectName: "right" - minimumSize: "100x100" - maximumSize: "400x400" - preferredSize: "200x200" - Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } - } - } - } - } -} diff --git a/tests/auto/declarative/layouts/layouts.pro b/tests/auto/declarative/layouts/layouts.pro deleted file mode 100644 index f38e155..0000000 --- a/tests/auto/declarative/layouts/layouts.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_layouts.cpp -macx:CONFIG -= app_bundle - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp deleted file mode 100644 index 942125f..0000000 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include -#include -#include -#include -#include - -class tst_QDeclarativeLayouts : public QObject -{ - Q_OBJECT -public: - tst_QDeclarativeLayouts(); - -private slots: - void test_qml();//GraphicsLayout set up in Qml - void test_cpp();//GraphicsLayout set up in C++ - -private: - QDeclarativeView *createView(const QString &filename); -}; - -tst_QDeclarativeLayouts::tst_QDeclarativeLayouts() -{ -} - -void tst_QDeclarativeLayouts::test_qml() -{ - QDeclarativeView *canvas = createView(SRCDIR "/data/layouts.qml"); - - qApp->processEvents(); - QDeclarativeLayoutItem *left = static_cast(canvas->rootObject()->findChild("left")); - QVERIFY(left != 0); - - QDeclarativeLayoutItem *right = static_cast(canvas->rootObject()->findChild("right")); - QVERIFY(right != 0); - - qreal l = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin); - qreal r = QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin); - qreal t = QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); - qreal b = QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin); - QVERIFY2(l == r && r == t && t == b, "Test assumes equal margins."); - qreal gvMargin = l; - - QDeclarativeItem *rootItem = qobject_cast(canvas->rootObject()); - QVERIFY(rootItem != 0); - - //Preferred Size - rootItem->setWidth(300 + 2*gvMargin); - rootItem->setHeight(300 + 2*gvMargin); - - QCOMPARE(left->x(), gvMargin); - QCOMPARE(left->y(), gvMargin); - QCOMPARE(left->width(), 100.0); - QCOMPARE(left->height(), 300.0); - - QCOMPARE(right->x(), 100.0 + gvMargin); - QCOMPARE(right->y(), 0.0 + gvMargin); - QCOMPARE(right->width(), 200.0); - QCOMPARE(right->height(), 300.0); - - //Minimum Size - rootItem->setWidth(10+2*gvMargin); - rootItem->setHeight(10+2*gvMargin); - - QCOMPARE(left->x(), gvMargin); - QCOMPARE(left->width(), 100.0); - QCOMPARE(left->height(), 100.0); - - QCOMPARE(right->x(), 100.0 + gvMargin); - QCOMPARE(right->width(), 100.0); - QCOMPARE(right->height(), 100.0); - - //Between preferred and Maximum Size - /*Note that if set to maximum size (or above) GraphicsLinearLayout behavior - is to shrink them down to preferred size. So the exact maximum size can't - be used*/ - rootItem->setWidth(670 + 2*gvMargin); - rootItem->setHeight(300 + 2*gvMargin); - - QCOMPARE(left->x(), gvMargin); - QCOMPARE(left->width(), 270.0); - QCOMPARE(left->height(), 300.0); - - QCOMPARE(right->x(), 270.0 + gvMargin); - QCOMPARE(right->width(), 400.0); - QCOMPARE(right->height(), 300.0); - - delete canvas; -} - -void tst_QDeclarativeLayouts::test_cpp() -{ - //TODO: Waiting on QT-2407 to write this test -} - -QDeclarativeView *tst_QDeclarativeLayouts::createView(const QString &filename) -{ - QDeclarativeView *canvas = new QDeclarativeView(0); - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - - -QTEST_MAIN(tst_QDeclarativeLayouts) - -#include "tst_layouts.moc" diff --git a/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml new file mode 100644 index 0000000..1792500 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml @@ -0,0 +1,34 @@ +import Qt 4.6 +import Qt.widgets 4.6 + +Item { + id: resizable + width:300 + height:300 + + GraphicsObjectContainer { + anchors.fill: parent + synchronizedResizing: true + + QGraphicsWidget { + + layout: QGraphicsLinearLayout { + spacing: 0 + LayoutItem { + objectName: "left" + minimumSize: "100x100" + maximumSize: "300x300" + preferredSize: "100x100" + Rectangle { objectName: "yellowRect"; color: "yellow"; anchors.fill: parent } + } + LayoutItem { + objectName: "right" + minimumSize: "100x100" + maximumSize: "400x400" + preferredSize: "200x200" + Rectangle { objectName: "greenRect"; color: "green"; anchors.fill: parent } + } + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro new file mode 100644 index 0000000..7276162 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativelayouts.cpp +macx:CONFIG -= app_bundle + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp new file mode 100644 index 0000000..879047e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include +#include +#include +#include +#include +#include + +class tst_QDeclarativeLayouts : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeLayouts(); + +private slots: + void test_qml();//GraphicsLayout set up in Qml + void test_cpp();//GraphicsLayout set up in C++ + +private: + QDeclarativeView *createView(const QString &filename); +}; + +tst_QDeclarativeLayouts::tst_QDeclarativeLayouts() +{ +} + +void tst_QDeclarativeLayouts::test_qml() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/layouts.qml"); + + qApp->processEvents(); + QDeclarativeLayoutItem *left = static_cast(canvas->rootObject()->findChild("left")); + QVERIFY(left != 0); + + QDeclarativeLayoutItem *right = static_cast(canvas->rootObject()->findChild("right")); + QVERIFY(right != 0); + + qreal l = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin); + qreal r = QApplication::style()->pixelMetric(QStyle::PM_LayoutRightMargin); + qreal t = QApplication::style()->pixelMetric(QStyle::PM_LayoutTopMargin); + qreal b = QApplication::style()->pixelMetric(QStyle::PM_LayoutBottomMargin); + QVERIFY2(l == r && r == t && t == b, "Test assumes equal margins."); + qreal gvMargin = l; + + QDeclarativeItem *rootItem = qobject_cast(canvas->rootObject()); + QVERIFY(rootItem != 0); + + //Preferred Size + rootItem->setWidth(300 + 2*gvMargin); + rootItem->setHeight(300 + 2*gvMargin); + + QCOMPARE(left->x(), gvMargin); + QCOMPARE(left->y(), gvMargin); + QCOMPARE(left->width(), 100.0); + QCOMPARE(left->height(), 300.0); + + QCOMPARE(right->x(), 100.0 + gvMargin); + QCOMPARE(right->y(), 0.0 + gvMargin); + QCOMPARE(right->width(), 200.0); + QCOMPARE(right->height(), 300.0); + + //Minimum Size + rootItem->setWidth(10+2*gvMargin); + rootItem->setHeight(10+2*gvMargin); + + QCOMPARE(left->x(), gvMargin); + QCOMPARE(left->width(), 100.0); + QCOMPARE(left->height(), 100.0); + + QCOMPARE(right->x(), 100.0 + gvMargin); + QCOMPARE(right->width(), 100.0); + QCOMPARE(right->height(), 100.0); + + //Between preferred and Maximum Size + /*Note that if set to maximum size (or above) GraphicsLinearLayout behavior + is to shrink them down to preferred size. So the exact maximum size can't + be used*/ + rootItem->setWidth(670 + 2*gvMargin); + rootItem->setHeight(300 + 2*gvMargin); + + QCOMPARE(left->x(), gvMargin); + QCOMPARE(left->width(), 270.0); + QCOMPARE(left->height(), 300.0); + + QCOMPARE(right->x(), 270.0 + gvMargin); + QCOMPARE(right->width(), 400.0); + QCOMPARE(right->height(), 300.0); + + delete canvas; +} + +void tst_QDeclarativeLayouts::test_cpp() +{ + //TODO: Waiting on QT-2407 to write this test +} + +QDeclarativeView *tst_QDeclarativeLayouts::createView(const QString &filename) +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(filename)); + + return canvas; +} + + +QTEST_MAIN(tst_QDeclarativeLayouts) + +#include "tst_qdeclarativelayouts.moc" diff --git a/tests/auto/network.pro b/tests/auto/network.pro index 6b24850..dbefa91 100644 --- a/tests/auto/network.pro +++ b/tests/auto/network.pro @@ -17,8 +17,8 @@ SUBDIRS=\ qhttpsocketengine \ qnativesocketengine \ qnetworkaddressentry \ - qnetworkconfigmanager \ qnetworkconfiguration \ + qnetworkconfigurationmanager \ qnetworkcookie \ qnetworkcookiejar \ qnetworkinterface \ diff --git a/tests/auto/opengl.pro b/tests/auto/opengl.pro index 7220c45..9b59cd1 100644 --- a/tests/auto/opengl.pro +++ b/tests/auto/opengl.pro @@ -1,6 +1,6 @@ TEMPLATE=subdirs SUBDIRS=\ qgl \ - qgl_threads \ + qglthreads \ qglbuffer \ diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp index a215bd5..af0ed76 100644 --- a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp +++ b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp @@ -49,7 +49,7 @@ #include -class tst_QmlAudio : public QObject +class tst_QDeclarativeAudio : public QObject { Q_OBJECT public slots: @@ -285,12 +285,12 @@ public: }; -void tst_QmlAudio::initTestCase() +void tst_QDeclarativeAudio::initTestCase() { qRegisterMetaType(); } -void tst_QmlAudio::nullPlayerControl() +void tst_QDeclarativeAudio::nullPlayerControl() { QtTestMetaDataControl metaDataControl; QtTestMediaServiceProvider provider(0, &metaDataControl); @@ -339,7 +339,7 @@ void tst_QmlAudio::nullPlayerControl() QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing); } -void tst_QmlAudio::nullMetaDataControl() +void tst_QDeclarativeAudio::nullMetaDataControl() { QtTestMediaPlayerControl playerControl; QtTestMediaServiceProvider provider(&playerControl, 0); @@ -351,7 +351,7 @@ void tst_QmlAudio::nullMetaDataControl() QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1); } -void tst_QmlAudio::nullService() +void tst_QDeclarativeAudio::nullService() { QtTestMediaServiceProvider provider(0); @@ -403,7 +403,7 @@ void tst_QmlAudio::nullService() QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1); } -void tst_QmlAudio::source() +void tst_QDeclarativeAudio::source() { const QUrl url1("http://example.com"); const QUrl url2("file:///local/path"); @@ -431,7 +431,7 @@ void tst_QmlAudio::source() QCOMPARE(spy.count(), 3); } -void tst_QmlAudio::autoLoad() +void tst_QDeclarativeAudio::autoLoad() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -458,7 +458,7 @@ void tst_QmlAudio::autoLoad() QCOMPARE(audio.isPaused(), true); } -void tst_QmlAudio::playing() +void tst_QDeclarativeAudio::playing() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -547,7 +547,7 @@ void tst_QmlAudio::playing() QCOMPARE(stoppedSpy.count(), stopped); } -void tst_QmlAudio::paused() +void tst_QDeclarativeAudio::paused() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -836,7 +836,7 @@ void tst_QmlAudio::paused() QCOMPARE(stoppedSpy.count(), stopped); } -void tst_QmlAudio::duration() +void tst_QDeclarativeAudio::duration() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -865,7 +865,7 @@ void tst_QmlAudio::duration() QCOMPARE(spy.count(), 4); } -void tst_QmlAudio::position() +void tst_QDeclarativeAudio::position() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -909,7 +909,7 @@ void tst_QmlAudio::position() QVERIFY(spy.count() < 6); } -void tst_QmlAudio::volume() +void tst_QDeclarativeAudio::volume() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -934,7 +934,7 @@ void tst_QmlAudio::volume() QCOMPARE(spy.count(), 2); } -void tst_QmlAudio::muted() +void tst_QDeclarativeAudio::muted() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -959,7 +959,7 @@ void tst_QmlAudio::muted() QCOMPARE(spy.count(), 3); } -void tst_QmlAudio::bufferProgress() +void tst_QDeclarativeAudio::bufferProgress() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -994,7 +994,7 @@ void tst_QmlAudio::bufferProgress() QVERIFY(spy.count() < 6); } -void tst_QmlAudio::seekable() +void tst_QDeclarativeAudio::seekable() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -1018,7 +1018,7 @@ void tst_QmlAudio::seekable() QCOMPARE(spy.count(), 3); } -void tst_QmlAudio::playbackRate() +void tst_QDeclarativeAudio::playbackRate() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -1044,7 +1044,7 @@ void tst_QmlAudio::playbackRate() QCOMPARE(spy.count(), 3); } -void tst_QmlAudio::status() +void tst_QDeclarativeAudio::status() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; @@ -1153,7 +1153,7 @@ void tst_QmlAudio::status() QCOMPARE(endOfMediaSpy.count(), 1); } -void tst_QmlAudio::metaData_data() +void tst_QDeclarativeAudio::metaData_data() { QTest::addColumn("propertyName"); QTest::addColumn("propertyKey"); @@ -1179,7 +1179,7 @@ void tst_QmlAudio::metaData_data() << QVariant(12); } -void tst_QmlAudio::metaData() +void tst_QDeclarativeAudio::metaData() { QFETCH(QByteArray, propertyName); QFETCH(QtMultimedia::MetaData, propertyKey); @@ -1209,7 +1209,7 @@ void tst_QmlAudio::metaData() QCOMPARE(spy.count(), 2); } -void tst_QmlAudio::error() +void tst_QDeclarativeAudio::error() { const QString errorString = QLatin1String("Failed to open device."); @@ -1247,6 +1247,6 @@ void tst_QmlAudio::error() } -QTEST_MAIN(tst_QmlAudio) +QTEST_MAIN(tst_QDeclarativeAudio) #include "tst_qdeclarativeaudio.moc" diff --git a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp index 56dce28..0fbd78c 100644 --- a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp +++ b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp @@ -53,7 +53,7 @@ #include -class tst_QmlGraphicsVideo : public QObject +class tst_QDeclarativeVideo : public QObject { Q_OBJECT public slots: @@ -291,12 +291,12 @@ public: }; -void tst_QmlGraphicsVideo::initTestCase() +void tst_QDeclarativeVideo::initTestCase() { qRegisterMetaType(); } -void tst_QmlGraphicsVideo::nullPlayerControl() +void tst_QDeclarativeVideo::nullPlayerControl() { QtTestMediaServiceProvider provider(0, 0, 0); @@ -347,7 +347,7 @@ void tst_QmlGraphicsVideo::nullPlayerControl() QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing); } -void tst_QmlGraphicsVideo::nullService() +void tst_QDeclarativeVideo::nullService() { QtTestMediaServiceProvider provider(0); @@ -402,7 +402,7 @@ void tst_QmlGraphicsVideo::nullService() QCOMPARE(video.metaObject()->indexOfProperty("description"), -1); } -void tst_QmlGraphicsVideo::playing() +void tst_QDeclarativeVideo::playing() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; @@ -490,7 +490,7 @@ void tst_QmlGraphicsVideo::playing() QCOMPARE(stoppedSpy.count(), stopped); } -void tst_QmlGraphicsVideo::paused() +void tst_QDeclarativeVideo::paused() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; @@ -778,7 +778,7 @@ void tst_QmlGraphicsVideo::paused() QCOMPARE(stoppedSpy.count(), stopped); } -void tst_QmlGraphicsVideo::error() +void tst_QDeclarativeVideo::error() { const QString errorString = QLatin1String("Failed to open device."); @@ -815,7 +815,7 @@ void tst_QmlGraphicsVideo::error() } -void tst_QmlGraphicsVideo::hasAudio() +void tst_QDeclarativeVideo::hasAudio() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; @@ -838,7 +838,7 @@ void tst_QmlGraphicsVideo::hasAudio() QCOMPARE(spy.count(), 3); } -void tst_QmlGraphicsVideo::hasVideo() +void tst_QDeclarativeVideo::hasVideo() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; @@ -862,7 +862,7 @@ void tst_QmlGraphicsVideo::hasVideo() QCOMPARE(spy.count(), 3); } -void tst_QmlGraphicsVideo::fillMode() +void tst_QDeclarativeVideo::fillMode() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; @@ -888,7 +888,7 @@ void tst_QmlGraphicsVideo::fillMode() QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatio); } -void tst_QmlGraphicsVideo::geometry() +void tst_QDeclarativeVideo::geometry() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; @@ -916,6 +916,6 @@ void tst_QmlGraphicsVideo::geometry() QCOMPARE(videoItem->size().height(), qreal(328)); } -QTEST_MAIN(tst_QmlGraphicsVideo) +QTEST_MAIN(tst_QDeclarativeVideo) #include "tst_qdeclarativevideo.moc" diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index f2e1dbd..6bfa8be 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -87,13 +87,13 @@ public: } }; -class tst_QFiledialog : public QObject +class tst_QFileDialog2 : public QObject { Q_OBJECT public: - tst_QFiledialog(); - virtual ~tst_QFiledialog(); + tst_QFileDialog2(); + virtual ~tst_QFileDialog2(); public slots: void init(); @@ -138,18 +138,18 @@ private: QByteArray userSettings; }; -tst_QFiledialog::tst_QFiledialog() +tst_QFileDialog2::tst_QFileDialog2() { #if defined(Q_OS_WINCE) qApp->setAutoMaximizeThreshold(-1); #endif } -tst_QFiledialog::~tst_QFiledialog() +tst_QFileDialog2::~tst_QFileDialog2() { } -void tst_QFiledialog::init() +void tst_QFileDialog2::init() { // Save the developers settings so they don't get mad when their sidebar folders are gone. QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); @@ -164,14 +164,14 @@ void tst_QFiledialog::init() #endif } -void tst_QFiledialog::cleanup() +void tst_QFileDialog2::cleanup() { QSettings settings(QSettings::UserScope, QLatin1String("Trolltech")); settings.beginGroup(QLatin1String("Qt")); settings.setValue(QLatin1String("filedialog"), userSettings); } -void tst_QFiledialog::listRoot() +void tst_QFileDialog2::listRoot() { #if defined QT_BUILD_INTERNAL QFileInfoGatherer fileInfoGatherer; @@ -193,7 +193,7 @@ void tst_QFiledialog::listRoot() #endif } -void tst_QFiledialog::heapCorruption() +void tst_QFileDialog2::heapCorruption() { QVector dialogs; for (int i=0; i < 10; i++) { @@ -205,12 +205,12 @@ void tst_QFiledialog::heapCorruption() struct FriendlyQFileDialog : public QNonNativeFileDialog { - friend class tst_QFileDialog; + friend class tst_QFileDialog2; Q_DECLARE_PRIVATE(QFileDialog) }; -void tst_QFiledialog::deleteDirAndFiles() +void tst_QFileDialog2::deleteDirAndFiles() { #if defined QT_BUILD_INTERNAL QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir4FullDelete"; @@ -242,7 +242,7 @@ void tst_QFiledialog::deleteDirAndFiles() #endif } -void tst_QFiledialog::filter() +void tst_QFileDialog2::filter() { QNonNativeFileDialog fd; QAction *hiddenAction = qFindChild(&fd, "qt_show_hidden_action"); @@ -255,7 +255,7 @@ void tst_QFiledialog::filter() QVERIFY(hiddenAction->isChecked()); } -void tst_QFiledialog::showNameFilterDetails() +void tst_QFileDialog2::showNameFilterDetails() { QNonNativeFileDialog fd; QComboBox *filters = qFindChild(&fd, "fileTypeCombo"); @@ -280,7 +280,7 @@ void tst_QFiledialog::showNameFilterDetails() QCOMPARE(filters->itemText(2), filterChoices.at(2)); } -void tst_QFiledialog::unc() +void tst_QFileDialog2::unc() { #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Only test UNC on Windows./ @@ -295,7 +295,7 @@ void tst_QFiledialog::unc() QCOMPARE(model->index(fd.directory().absolutePath()), model->index(dir)); } -void tst_QFiledialog::emptyUncPath() +void tst_QFileDialog2::emptyUncPath() { QNonNativeFileDialog fd; fd.show(); @@ -308,7 +308,7 @@ void tst_QFiledialog::emptyUncPath() QVERIFY(model); } -void tst_QFiledialog::task178897_minimumSize() +void tst_QFileDialog2::task178897_minimumSize() { QNonNativeFileDialog fd; QSize oldMs = fd.layout()->minimumSize(); @@ -322,7 +322,7 @@ void tst_QFiledialog::task178897_minimumSize() QVERIFY(ms.width() <= oldMs.width()); } -void tst_QFiledialog::task180459_lastDirectory_data() +void tst_QFileDialog2::task180459_lastDirectory_data() { QTest::addColumn("path"); QTest::addColumn("directory"); @@ -345,7 +345,7 @@ void tst_QFiledialog::task180459_lastDirectory_data() } -void tst_QFiledialog::task180459_lastDirectory() +void tst_QFileDialog2::task180459_lastDirectory() { //first visit the temp directory and close the dialog QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", QDir::tempPath()); @@ -449,7 +449,7 @@ QString &dir, const QString &filter) } }; -void tst_QFiledialog::task227304_proxyOnFileDialog() +void tst_QFileDialog2::task227304_proxyOnFileDialog() { #if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0); @@ -488,7 +488,7 @@ void tst_QFiledialog::task227304_proxyOnFileDialog() #endif } -void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() +void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() { QDir current = QDir::currentPath(); current.mkdir("test"); @@ -527,7 +527,7 @@ void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() } #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) -void tst_QFiledialog::task226366_lowerCaseHardDriveWindows() +void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() { QNonNativeFileDialog fd; fd.setDirectory(QDir::root().path()); @@ -553,7 +553,7 @@ void tst_QFiledialog::task226366_lowerCaseHardDriveWindows() } #endif -void tst_QFiledialog::completionOnLevelAfterRoot() +void tst_QFileDialog2::completionOnLevelAfterRoot() { QNonNativeFileDialog fd; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) @@ -592,7 +592,7 @@ void tst_QFiledialog::completionOnLevelAfterRoot() #endif } -void tst_QFiledialog::task233037_selectingDirectory() +void tst_QFileDialog2::task233037_selectingDirectory() { QDir current = QDir::currentPath(); current.mkdir("test"); @@ -615,7 +615,7 @@ void tst_QFiledialog::task233037_selectingDirectory() current.rmdir("test"); } -void tst_QFiledialog::task235069_hideOnEscape() +void tst_QFileDialog2::task235069_hideOnEscape() { QDir current = QDir::currentPath(); QNonNativeFileDialog fd; @@ -637,7 +637,7 @@ void tst_QFiledialog::task235069_hideOnEscape() QCOMPARE(fd2.isVisible(), false); } -void tst_QFiledialog::task236402_dontWatchDeletedDir() +void tst_QFileDialog2::task236402_dontWatchDeletedDir() { #if defined QT_BUILD_INTERNAL //THIS TEST SHOULD NOT DISPLAY WARNINGS @@ -662,7 +662,7 @@ void tst_QFiledialog::task236402_dontWatchDeletedDir() #endif } -void tst_QFiledialog::task203703_returnProperSeparator() +void tst_QFileDialog2::task203703_returnProperSeparator() { QDir current = QDir::currentPath(); current.mkdir("aaaaaaaaaaaaaaaaaa"); @@ -687,7 +687,7 @@ void tst_QFiledialog::task203703_returnProperSeparator() current.rmdir("aaaaaaaaaaaaaaaaaa"); } -void tst_QFiledialog::task228844_ensurePreviousSorting() +void tst_QFileDialog2::task228844_ensurePreviousSorting() { QDir current = QDir::currentPath(); current.mkdir("aaaaaaaaaaaaaaaaaa"); @@ -789,7 +789,7 @@ void tst_QFiledialog::task228844_ensurePreviousSorting() } -void tst_QFiledialog::task239706_editableFilterCombo() +void tst_QFileDialog2::task239706_editableFilterCombo() { QNonNativeFileDialog d; d.setNameFilter("*.cpp *.h"); @@ -812,7 +812,7 @@ void tst_QFiledialog::task239706_editableFilterCombo() QTest::keyPress(filterCombo, Qt::Key_Enter); // should not trigger assertion failure } -void tst_QFiledialog::task218353_relativePaths() +void tst_QFileDialog2::task218353_relativePaths() { QDir appDir = QDir::current(); QVERIFY(appDir.cdUp() != false); @@ -829,7 +829,7 @@ void tst_QFiledialog::task218353_relativePaths() appDir.rmdir("test"); } -void tst_QFiledialog::task251321_sideBarHiddenEntries() +void tst_QFileDialog2::task251321_sideBarHiddenEntries() { #if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd; @@ -889,7 +889,7 @@ public : }; #endif -void tst_QFiledialog::task251341_sideBarRemoveEntries() +void tst_QFileDialog2::task251341_sideBarRemoveEntries() { #if defined QT_BUILD_INTERNAL QNonNativeFileDialog fd; @@ -954,7 +954,7 @@ void tst_QFiledialog::task251341_sideBarRemoveEntries() #endif } -void tst_QFiledialog::task254490_selectFileMultipleTimes() +void tst_QFileDialog2::task254490_selectFileMultipleTimes() { QString tempPath = QDir::tempPath(); QTemporaryFile *t; @@ -986,7 +986,7 @@ void tst_QFiledialog::task254490_selectFileMultipleTimes() t->deleteLater(); } -void tst_QFiledialog::task257579_sideBarWithNonCleanUrls() +void tst_QFileDialog2::task257579_sideBarWithNonCleanUrls() { #if defined QT_BUILD_INTERNAL QDir tempDir = QDir::temp(); @@ -1012,7 +1012,7 @@ void tst_QFiledialog::task257579_sideBarWithNonCleanUrls() #endif } -void tst_QFiledialog::task259105_filtersCornerCases() +void tst_QFileDialog2::task259105_filtersCornerCases() { QNonNativeFileDialog fd(0, "TestFileDialog"); fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)")); @@ -1056,7 +1056,7 @@ void tst_QFiledialog::task259105_filtersCornerCases() QCOMPARE(filters->currentText(), QLatin1String("Text Files")); } -void tst_QFiledialog::QTBUG4419_lineEditSelectAll() +void tst_QFileDialog2::QTBUG4419_lineEditSelectAll() { QString tempPath = QDir::tempPath(); QTemporaryFile *t; @@ -1082,7 +1082,7 @@ void tst_QFiledialog::QTBUG4419_lineEditSelectAll() QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName()); } -void tst_QFiledialog::QTBUG6558_showDirsOnly() +void tst_QFileDialog2::QTBUG6558_showDirsOnly() { const QString tempPath = QDir::tempPath(); QDir dirTemp(tempPath); @@ -1148,7 +1148,7 @@ void tst_QFiledialog::QTBUG6558_showDirsOnly() dirTemp.rmdir(tempName); } -void tst_QFiledialog::QTBUG4842_selectFilterWithHideNameFilterDetails() +void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails() { QStringList filtersStr; filtersStr << "Images (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "XML files (*.xml)"; @@ -1188,5 +1188,5 @@ void tst_QFiledialog::QTBUG4842_selectFilterWithHideNameFilterDetails() } -QTEST_MAIN(tst_QFiledialog) +QTEST_MAIN(tst_QFileDialog2) #include "tst_qfiledialog2.moc" diff --git a/tests/auto/qgl_threads/qgl_threads.pro b/tests/auto/qgl_threads/qgl_threads.pro deleted file mode 100644 index 9312c05..0000000 --- a/tests/auto/qgl_threads/qgl_threads.pro +++ /dev/null @@ -1,11 +0,0 @@ -############################################################ -# Project file for autotest for file qgl.h -############################################################ - -load(qttest_p4) -requires(contains(QT_CONFIG,opengl)) -QT += opengl - -HEADERS += tst_openglthreading.h -SOURCES += tst_openglthreading.cpp - diff --git a/tests/auto/qgl_threads/tst_openglthreading.cpp b/tests/auto/qgl_threads/tst_openglthreading.cpp deleted file mode 100644 index cf100cb..0000000 --- a/tests/auto/qgl_threads/tst_openglthreading.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include "tst_openglthreading.h" - -#ifdef Q_WS_X11 -#include -#endif - -#define RUNNING_TIME 5000 - -tst_OpenGLThreading::tst_OpenGLThreading(QObject *parent) - : QObject(parent) -{ -} - - - -/* - - swapInThread - - The purpose of this testcase is to verify that it is possible to do rendering into - a GL context from the GUI thread, then swap the contents in from a background thread. - - The usecase for this is to have the background thread do the waiting for vertical - sync while the GUI thread is idle. - - Currently the locking is handled directly in the paintEvent(). For the actual usecase - in Qt, the locking is done in the windowsurface before starting any drawing while - unlocking is done after all drawing has been done. - */ - - -class SwapThread : public QThread -{ - Q_OBJECT -public: - SwapThread(QGLWidget *widget) - : m_widget(widget) - { - moveToThread(this); - } - - void run() { - QTime time; - time.start(); - while (time.elapsed() < RUNNING_TIME) { - lock(); - wait(); - - m_widget->makeCurrent(); - m_widget->swapBuffers(); - m_widget->doneCurrent(); - unlock(); - } - } - - void lock() { m_mutex.lock(); } - void unlock() { m_mutex.unlock(); } - - void wait() { m_wait_condition.wait(&m_mutex); } - void notify() { m_wait_condition.wakeAll(); } - -private: - QGLWidget *m_widget; - QMutex m_mutex; - QWaitCondition m_wait_condition; -}; - -class ForegroundWidget : public QGLWidget -{ -public: - ForegroundWidget(const QGLFormat &format) - : QGLWidget(format), m_thread(0) - { - setAutoBufferSwap(false); - } - - void paintEvent(QPaintEvent *) - { - m_thread->lock(); - makeCurrent(); - QPainter p(this); - p.fillRect(rect(), QColor(rand() % 256, rand() % 256, rand() % 256)); - p.setPen(Qt::red); - p.setFont(QFont("SansSerif", 24)); - p.drawText(rect(), Qt::AlignCenter, "This is an autotest"); - p.end(); - doneCurrent(); - m_thread->notify(); - m_thread->unlock(); - - update(); - } - - void setThread(SwapThread *thread) { - m_thread = thread; - } - - SwapThread *m_thread; -}; - -void tst_OpenGLThreading::swapInThread() -{ -#ifdef Q_OS_MAC - QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); -#endif - - QGLFormat format; - format.setSwapInterval(1); - ForegroundWidget widget(format); - SwapThread thread(&widget); - widget.setThread(&thread); - widget.show(); - - QTest::qWaitForWindowShown(&widget); - thread.start(); - - while (thread.isRunning()) { - qApp->processEvents(); - } - - widget.hide(); - - QVERIFY(true); -} - - - - - - - -/* - textureUploadInThread - - The purpose of this testcase is to verify that doing texture uploads in a background - thread is possible and that it works. - */ - -class CreateAndUploadThread : public QThread -{ - Q_OBJECT -public: - CreateAndUploadThread(QGLWidget *shareWidget) - { - m_gl = new QGLWidget(0, shareWidget); - moveToThread(this); - } - - ~CreateAndUploadThread() - { - delete m_gl; - } - - void run() { - m_gl->makeCurrent(); - QTime time; - time.start(); - while (time.elapsed() < RUNNING_TIME) { - QImage image(400, 300, QImage::Format_RGB32); - QPainter p(&image); - p.fillRect(image.rect(), QColor(rand() % 256, rand() % 256, rand() % 256)); - p.setPen(Qt::red); - p.setFont(QFont("SansSerif", 24)); - p.drawText(image.rect(), Qt::AlignCenter, "This is an autotest"); - p.end(); - m_gl->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); - createdAndUploaded(image); - } - } - -signals: - void createdAndUploaded(const QImage &image); - -private: - QGLWidget *m_gl; -}; - -class TextureDisplay : public QGLWidget -{ - Q_OBJECT -public: - void paintEvent(QPaintEvent *) { - QPainter p(this); - for (int i=0; i 100) { - m_images.takeFirst(); - m_positions.takeFirst(); - } - } - -private: - QList m_images; - QList m_positions; -}; - -void tst_OpenGLThreading::textureUploadInThread() -{ -#ifdef Q_OS_MAC - QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); -#endif - - TextureDisplay display; - CreateAndUploadThread thread(&display); - - connect(&thread, SIGNAL(createdAndUploaded(QImage)), &display, SLOT(receiveImage(QImage))); - - display.show(); - QTest::qWaitForWindowShown(&display); - - thread.start(); - - while (thread.isRunning()) { - qApp->processEvents(); - } - - QVERIFY(true); -} - - - - - - -/* - renderInThread - - This test sets up a scene and renders it in a different thread. - For simplicity, the scene is simply a bunch of rectangles, but - if that works, we're in good shape.. - */ - -static inline float qrandom() { return (rand() % 100) / 100.f; } - -void renderAScene(int w, int h) -{ -#ifdef QT_OPENGL_ES_2 - QGLShaderProgram program; - program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = vec4(pos.xy, 1.0, 1.0); }"); - program.addShaderFromSourceCode(QGLShader::Fragment, "uniform lowp vec4 color; void main() { gl_FragColor = color; }"); - program.bindAttributeLocation("pos", 0); - program.bind(); - int colorId = program.uniformLocation("color"); - - glEnableVertexAttribArray(0); - - for (int i=0; i<1000; ++i) { - GLfloat pos[] = { - (rand() % 100) / 100., - (rand() % 100) / 100., - (rand() % 100) / 100., - (rand() % 100) / 100., - (rand() % 100) / 100., - (rand() % 100) / 100. - }; - - glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); - } -#else - glViewport(0, 0, w, h); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(0, w, h, 0, 1, 100); - glTranslated(0, 0, -1); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - for (int i=0;i<1000; ++i) { - glBegin(GL_TRIANGLES); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glColor3f(qrandom(), qrandom(), qrandom()); - glVertex2f(qrandom() * w, qrandom() * h); - glEnd(); - } -#endif -} - -class ThreadSafeGLWidget : public QGLWidget -{ -public: - void paintEvent(QPaintEvent *) - { - // ignored as we're anyway swapping as fast as we can - }; - - void resizeEvent(QResizeEvent *e) - { - mutex.lock(); - newSize = e->size(); - mutex.unlock(); - }; - - QMutex mutex; - QSize newSize; -}; - -class SceneRenderingThread : public QThread -{ - Q_OBJECT -public: - SceneRenderingThread(ThreadSafeGLWidget *widget) - : m_widget(widget) - { - moveToThread(this); - m_size = widget->size(); - } - - void run() { - QTime time; - time.start(); - failure = false; - - m_widget->makeCurrent(); - - while (time.elapsed() < RUNNING_TIME && !failure) { - - - m_widget->mutex.lock(); - QSize s = m_widget->newSize; - m_widget->mutex.unlock(); - - if (s != m_size) { - glViewport(0, 0, s.width(), s.height()); - } - - if (QGLContext::currentContext() != m_widget->context()) { - failure = true; - break; - } - - glClear(GL_COLOR_BUFFER_BIT); - - int w = m_widget->width(); - int h = m_widget->height(); - - renderAScene(w, h); - - int color; - glReadPixels(w / 2, h / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color); - - m_widget->swapBuffers(); - } - - m_widget->doneCurrent(); - } - - bool failure; - -private: - ThreadSafeGLWidget *m_widget; - QSize m_size; -}; - -void tst_OpenGLThreading::renderInThread_data() -{ - QTest::addColumn("resize"); - QTest::addColumn("update"); - - QTest::newRow("basic") << false << false; - QTest::newRow("with-resize") << true << false; - QTest::newRow("with-update") << false << true; - QTest::newRow("with-resize-and-update") << true << true; -} - -void tst_OpenGLThreading::renderInThread() -{ -#ifdef Q_OS_MAC - QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); -#endif - - QFETCH(bool, resize); - QFETCH(bool, update); - - ThreadSafeGLWidget widget; - widget.resize(200, 200); - SceneRenderingThread thread(&widget); - - widget.show(); - QTest::qWaitForWindowShown(&widget); - widget.doneCurrent(); - - thread.start(); - - int value = 10; - while (thread.isRunning()) { - if (resize) - widget.resize(200 + value, 200 + value); - if (update) - widget.update(100 + value, 100 + value, 20, 20); - qApp->processEvents(); - value = -value; - -#ifdef Q_WS_WIN - Sleep(100); -#else - usleep(100 * 1000); -#endif - } - - QVERIFY(!thread.failure); -} - - - - -int main(int argc, char **argv) -{ -#ifdef Q_WS_X11 - XInitThreads(); -#endif - - QApplication app(argc, argv); - QTEST_DISABLE_KEYPAD_NAVIGATION \ - - tst_OpenGLThreading tc; - return QTest::qExec(&tc, argc, argv); -} - -#include "tst_openglthreading.moc" diff --git a/tests/auto/qgl_threads/tst_openglthreading.h b/tests/auto/qgl_threads/tst_openglthreading.h deleted file mode 100644 index c4b55cd..0000000 --- a/tests/auto/qgl_threads/tst_openglthreading.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TST_OPENGLTHREADING_H -#define TST_OPENGLTHREADING_H - -#include - -class tst_OpenGLThreading : public QObject -{ -Q_OBJECT -public: - explicit tst_OpenGLThreading(QObject *parent = 0); - -private slots: - void swapInThread(); - void textureUploadInThread(); - - void renderInThread_data(); - void renderInThread(); -}; - -#endif // TST_OPENGLTHREADING_H diff --git a/tests/auto/qglthreads/qglthreads.pro b/tests/auto/qglthreads/qglthreads.pro new file mode 100644 index 0000000..4d20a19 --- /dev/null +++ b/tests/auto/qglthreads/qglthreads.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +requires(contains(QT_CONFIG,opengl)) +QT += opengl + +HEADERS += tst_qglthreads.h +SOURCES += tst_qglthreads.cpp + diff --git a/tests/auto/qglthreads/tst_qglthreads.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp new file mode 100644 index 0000000..cce3161 --- /dev/null +++ b/tests/auto/qglthreads/tst_qglthreads.cpp @@ -0,0 +1,480 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include "tst_qglthreads.h" + +#ifdef Q_WS_X11 +#include +#endif + +#define RUNNING_TIME 5000 + +tst_QGLThreads::tst_QGLThreads(QObject *parent) + : QObject(parent) +{ +} + + + +/* + + swapInThread + + The purpose of this testcase is to verify that it is possible to do rendering into + a GL context from the GUI thread, then swap the contents in from a background thread. + + The usecase for this is to have the background thread do the waiting for vertical + sync while the GUI thread is idle. + + Currently the locking is handled directly in the paintEvent(). For the actual usecase + in Qt, the locking is done in the windowsurface before starting any drawing while + unlocking is done after all drawing has been done. + */ + + +class SwapThread : public QThread +{ + Q_OBJECT +public: + SwapThread(QGLWidget *widget) + : m_widget(widget) + { + moveToThread(this); + } + + void run() { + QTime time; + time.start(); + while (time.elapsed() < RUNNING_TIME) { + lock(); + wait(); + + m_widget->makeCurrent(); + m_widget->swapBuffers(); + m_widget->doneCurrent(); + unlock(); + } + } + + void lock() { m_mutex.lock(); } + void unlock() { m_mutex.unlock(); } + + void wait() { m_wait_condition.wait(&m_mutex); } + void notify() { m_wait_condition.wakeAll(); } + +private: + QGLWidget *m_widget; + QMutex m_mutex; + QWaitCondition m_wait_condition; +}; + +class ForegroundWidget : public QGLWidget +{ +public: + ForegroundWidget(const QGLFormat &format) + : QGLWidget(format), m_thread(0) + { + setAutoBufferSwap(false); + } + + void paintEvent(QPaintEvent *) + { + m_thread->lock(); + makeCurrent(); + QPainter p(this); + p.fillRect(rect(), QColor(rand() % 256, rand() % 256, rand() % 256)); + p.setPen(Qt::red); + p.setFont(QFont("SansSerif", 24)); + p.drawText(rect(), Qt::AlignCenter, "This is an autotest"); + p.end(); + doneCurrent(); + m_thread->notify(); + m_thread->unlock(); + + update(); + } + + void setThread(SwapThread *thread) { + m_thread = thread; + } + + SwapThread *m_thread; +}; + +void tst_QGLThreads::swapInThread() +{ +#ifdef Q_OS_MAC + QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); +#endif + + QGLFormat format; + format.setSwapInterval(1); + ForegroundWidget widget(format); + SwapThread thread(&widget); + widget.setThread(&thread); + widget.show(); + + QTest::qWaitForWindowShown(&widget); + thread.start(); + + while (thread.isRunning()) { + qApp->processEvents(); + } + + widget.hide(); + + QVERIFY(true); +} + + + + + + + +/* + textureUploadInThread + + The purpose of this testcase is to verify that doing texture uploads in a background + thread is possible and that it works. + */ + +class CreateAndUploadThread : public QThread +{ + Q_OBJECT +public: + CreateAndUploadThread(QGLWidget *shareWidget) + { + m_gl = new QGLWidget(0, shareWidget); + moveToThread(this); + } + + ~CreateAndUploadThread() + { + delete m_gl; + } + + void run() { + m_gl->makeCurrent(); + QTime time; + time.start(); + while (time.elapsed() < RUNNING_TIME) { + QImage image(400, 300, QImage::Format_RGB32); + QPainter p(&image); + p.fillRect(image.rect(), QColor(rand() % 256, rand() % 256, rand() % 256)); + p.setPen(Qt::red); + p.setFont(QFont("SansSerif", 24)); + p.drawText(image.rect(), Qt::AlignCenter, "This is an autotest"); + p.end(); + m_gl->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + createdAndUploaded(image); + } + } + +signals: + void createdAndUploaded(const QImage &image); + +private: + QGLWidget *m_gl; +}; + +class TextureDisplay : public QGLWidget +{ + Q_OBJECT +public: + void paintEvent(QPaintEvent *) { + QPainter p(this); + for (int i=0; i 100) { + m_images.takeFirst(); + m_positions.takeFirst(); + } + } + +private: + QList m_images; + QList m_positions; +}; + +void tst_QGLThreads::textureUploadInThread() +{ +#ifdef Q_OS_MAC + QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); +#endif + + TextureDisplay display; + CreateAndUploadThread thread(&display); + + connect(&thread, SIGNAL(createdAndUploaded(QImage)), &display, SLOT(receiveImage(QImage))); + + display.show(); + QTest::qWaitForWindowShown(&display); + + thread.start(); + + while (thread.isRunning()) { + qApp->processEvents(); + } + + QVERIFY(true); +} + + + + + + +/* + renderInThread + + This test sets up a scene and renders it in a different thread. + For simplicity, the scene is simply a bunch of rectangles, but + if that works, we're in good shape.. + */ + +static inline float qrandom() { return (rand() % 100) / 100.f; } + +void renderAScene(int w, int h) +{ +#ifdef QT_OPENGL_ES_2 + QGLShaderProgram program; + program.addShaderFromSourceCode(QGLShader::Vertex, "attribute highp vec2 pos; void main() { gl_Position = vec4(pos.xy, 1.0, 1.0); }"); + program.addShaderFromSourceCode(QGLShader::Fragment, "uniform lowp vec4 color; void main() { gl_FragColor = color; }"); + program.bindAttributeLocation("pos", 0); + program.bind(); + int colorId = program.uniformLocation("color"); + + glEnableVertexAttribArray(0); + + for (int i=0; i<1000; ++i) { + GLfloat pos[] = { + (rand() % 100) / 100., + (rand() % 100) / 100., + (rand() % 100) / 100., + (rand() % 100) / 100., + (rand() % 100) / 100., + (rand() % 100) / 100. + }; + + glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, pos); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 3); + } +#else + glViewport(0, 0, w, h); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(0, w, h, 0, 1, 100); + glTranslated(0, 0, -1); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + for (int i=0;i<1000; ++i) { + glBegin(GL_TRIANGLES); + glColor3f(qrandom(), qrandom(), qrandom()); + glVertex2f(qrandom() * w, qrandom() * h); + glColor3f(qrandom(), qrandom(), qrandom()); + glVertex2f(qrandom() * w, qrandom() * h); + glColor3f(qrandom(), qrandom(), qrandom()); + glVertex2f(qrandom() * w, qrandom() * h); + glEnd(); + } +#endif +} + +class ThreadSafeGLWidget : public QGLWidget +{ +public: + void paintEvent(QPaintEvent *) + { + // ignored as we're anyway swapping as fast as we can + }; + + void resizeEvent(QResizeEvent *e) + { + mutex.lock(); + newSize = e->size(); + mutex.unlock(); + }; + + QMutex mutex; + QSize newSize; +}; + +class SceneRenderingThread : public QThread +{ + Q_OBJECT +public: + SceneRenderingThread(ThreadSafeGLWidget *widget) + : m_widget(widget) + { + moveToThread(this); + m_size = widget->size(); + } + + void run() { + QTime time; + time.start(); + failure = false; + + m_widget->makeCurrent(); + + while (time.elapsed() < RUNNING_TIME && !failure) { + + + m_widget->mutex.lock(); + QSize s = m_widget->newSize; + m_widget->mutex.unlock(); + + if (s != m_size) { + glViewport(0, 0, s.width(), s.height()); + } + + if (QGLContext::currentContext() != m_widget->context()) { + failure = true; + break; + } + + glClear(GL_COLOR_BUFFER_BIT); + + int w = m_widget->width(); + int h = m_widget->height(); + + renderAScene(w, h); + + int color; + glReadPixels(w / 2, h / 2, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &color); + + m_widget->swapBuffers(); + } + + m_widget->doneCurrent(); + } + + bool failure; + +private: + ThreadSafeGLWidget *m_widget; + QSize m_size; +}; + +void tst_QGLThreads::renderInThread_data() +{ + QTest::addColumn("resize"); + QTest::addColumn("update"); + + QTest::newRow("basic") << false << false; + QTest::newRow("with-resize") << true << false; + QTest::newRow("with-update") << false << true; + QTest::newRow("with-resize-and-update") << true << true; +} + +void tst_QGLThreads::renderInThread() +{ +#ifdef Q_OS_MAC + QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); +#endif + + QFETCH(bool, resize); + QFETCH(bool, update); + + ThreadSafeGLWidget widget; + widget.resize(200, 200); + SceneRenderingThread thread(&widget); + + widget.show(); + QTest::qWaitForWindowShown(&widget); + widget.doneCurrent(); + + thread.start(); + + int value = 10; + while (thread.isRunning()) { + if (resize) + widget.resize(200 + value, 200 + value); + if (update) + widget.update(100 + value, 100 + value, 20, 20); + qApp->processEvents(); + value = -value; + +#ifdef Q_WS_WIN + Sleep(100); +#else + usleep(100 * 1000); +#endif + } + + QVERIFY(!thread.failure); +} + + + + +int main(int argc, char **argv) +{ +#ifdef Q_WS_X11 + XInitThreads(); +#endif + + QApplication app(argc, argv); + QTEST_DISABLE_KEYPAD_NAVIGATION \ + + tst_QGLThreads tc; + return QTest::qExec(&tc, argc, argv); +} + +#include "tst_qglthreads.moc" diff --git a/tests/auto/qglthreads/tst_qglthreads.h b/tests/auto/qglthreads/tst_qglthreads.h new file mode 100644 index 0000000..9e97909 --- /dev/null +++ b/tests/auto/qglthreads/tst_qglthreads.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TST_QGLTHREADS_H +#define TST_QGLTHREADS_H + +#include + +class tst_QGLThreads : public QObject +{ +Q_OBJECT +public: + explicit tst_QGLThreads(QObject *parent = 0); + +private slots: + void swapInThread(); + void textureUploadInThread(); + + void renderInThread_data(); + void renderInThread(); +}; + +#endif // TST_QGLTHREADS_H diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro deleted file mode 100644 index 30eb5f0..0000000 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ /dev/null @@ -1,15 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qnetworkconfigmanager.cpp -HEADERS += ../qbearertestcommon.h - -QT = core network - -symbian { - TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData -} - -maemo6 { - CONFIG += link_pkgconfig - - PKGCONFIG += conninet -} diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp deleted file mode 100644 index 3052330..0000000 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "../qbearertestcommon.h" -#include "qnetworkconfiguration.h" -#include "qnetworkconfigmanager.h" - -#ifdef Q_WS_MAEMO_6 -#include -#include -#endif - -QT_USE_NAMESPACE -class tst_QNetworkConfigurationManager : public QObject -{ - Q_OBJECT - -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - -private slots: - void allConfigurations(); - void defaultConfiguration(); - void configurationFromIdentifier(); - -private: -#ifdef Q_WS_MAEMO_6 - Maemo::IAPConf *iapconf; - Maemo::IAPConf *iapconf2; - Maemo::IAPConf *gprsiap; -#define MAX_IAPS 50 - Maemo::IAPConf *iaps[MAX_IAPS]; - QProcess *icd_stub; -#endif -}; - -void tst_QNetworkConfigurationManager::initTestCase() -{ -#ifdef Q_WS_MAEMO_6 - iapconf = new Maemo::IAPConf("007"); - iapconf->setValue("ipv4_type", "AUTO"); - iapconf->setValue("wlan_wepkey1", "connt"); - iapconf->setValue("wlan_wepdefkey", 1); - iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); - iapconf->setValue("name", "James Bond"); - iapconf->setValue("type", "WLAN_INFRA"); - - gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); - gprsiap->setValue("ask_password", false); - gprsiap->setValue("gprs_accesspointname", "internet"); - gprsiap->setValue("gprs_password", ""); - gprsiap->setValue("gprs_username", ""); - gprsiap->setValue("ipv4_autodns", true); - gprsiap->setValue("ipv4_type", "AUTO"); - gprsiap->setValue("sim_imsi", "244070123456789"); - gprsiap->setValue("name", "MI6"); - gprsiap->setValue("type", "GPRS"); - - iapconf2 = new Maemo::IAPConf("osso.net"); - iapconf2->setValue("ipv4_type", "AUTO"); - iapconf2->setValue("wlan_wepkey1", "osso.net"); - iapconf2->setValue("wlan_wepdefkey", 1); - iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); - iapconf2->setValue("name", "osso.net"); - iapconf2->setValue("type", "WLAN_INFRA"); - iapconf2->setValue("wlan_security", "WEP"); - - /* Create large number of IAPs in the gconf and see what happens */ - fflush(stdout); - printf("Creating %d IAPS: ", MAX_IAPS); - for (int i=0; isetValue("name", QString("test-iap-")+num); - iaps[i]->setValue("type", "WLAN_INFRA"); - iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); - iaps[i]->setValue("wlan_security", "WPA_PSK"); - iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); - printf("."); - fflush(stdout); - } - printf("\n"); - fflush(stdout); - - icd_stub = new QProcess(this); - icd_stub->start("/usr/bin/icd2_stub.py"); - QTest::qWait(1000); - - // Add a known network to scan list that icd2 stub returns - QProcess dbus_send; - // 007 network - dbus_send.start("dbus-send --type=method_call --system " - "--dest=com.nokia.icd2 /com/nokia/icd2 " - "com.nokia.icd2.testing.add_available_network " - "string:'' uint32:0 string:'' " - "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); - dbus_send.waitForFinished(); - - // osso.net network - dbus_send.start("dbus-send --type=method_call --system " - "--dest=com.nokia.icd2 /com/nokia/icd2 " - "com.nokia.icd2.testing.add_available_network " - "string:'' uint32:0 string:'' " - "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); - dbus_send.waitForFinished(); -#endif -} - - -void tst_QNetworkConfigurationManager::cleanupTestCase() -{ -#ifdef Q_WS_MAEMO_6 - iapconf->clear(); - delete iapconf; - iapconf2->clear(); - delete iapconf2; - gprsiap->clear(); - delete gprsiap; - - printf("Deleting %d IAPS : ", MAX_IAPS); - for (int i=0; iclear(); - delete iaps[i]; - printf("."); - fflush(stdout); - } - printf("\n"); - qDebug() << "Deleted" << MAX_IAPS << "IAPs"; - - icd_stub->terminate(); - icd_stub->waitForFinished(); -#endif -} - -void tst_QNetworkConfigurationManager::init() -{ -} - -void tst_QNetworkConfigurationManager::cleanup() -{ -} - -void printConfigurationDetails(const QNetworkConfiguration& p) -{ - qDebug() << p.name() <<": isvalid->" <"<< p.type() << - " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << - " purpose->" << p.purpose() << " state->" << p.state(); -} - -void tst_QNetworkConfigurationManager::allConfigurations() -{ - QNetworkConfigurationManager manager; - QList preScanConfigs = manager.allConfigurations(); - - foreach(QNetworkConfiguration c, preScanConfigs) - { - QVERIFY2(c.type()!=QNetworkConfiguration::UserChoice, "allConfiguration must not return UserChoice configs"); - } - - QSignalSpy spy(&manager, SIGNAL(updateCompleted())); - manager.updateConfigurations(); //initiate scans - QTRY_VERIFY(spy.count() == 1); //wait for scan to complete - - QList configs = manager.allConfigurations(); - - int all = configs.count(); - qDebug() << "All configurations:" << all; - QVERIFY(all); - foreach(QNetworkConfiguration p, configs) { - QVERIFY(p.isValid()); - printConfigurationDetails(p); - QVERIFY(p.type() != QNetworkConfiguration::Invalid); - QVERIFY(p.type() != QNetworkConfiguration::UserChoice); - } - - configs = manager.allConfigurations(QNetworkConfiguration::Undefined); - int undefined = configs.count(); - QVERIFY(undefined <= all); - qDebug() << "Undefined configurations:" << undefined; - foreach( const QNetworkConfiguration p, configs) { - printConfigurationDetails(p); - QVERIFY(p.state() & QNetworkConfiguration::Undefined); - QVERIFY(!(p.state() & QNetworkConfiguration::Defined)); - } - - //get defined configs only (same as all) - configs = manager.allConfigurations(QNetworkConfiguration::Defined); - int defined = configs.count(); - qDebug() << "Defined configurations:" << defined; - QVERIFY(defined <= all); - foreach( const QNetworkConfiguration p, configs) { - printConfigurationDetails(p); - QVERIFY(p.state() & QNetworkConfiguration::Defined); - QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); - } - - //get discovered configurations only - configs = manager.allConfigurations(QNetworkConfiguration::Discovered); - int discovered = configs.count(); - //QVERIFY(discovered); - qDebug() << "Discovered configurations:" << discovered; - foreach(const QNetworkConfiguration p, configs) { - printConfigurationDetails(p); - QVERIFY(p.isValid()); - QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); - QVERIFY(p.state() & QNetworkConfiguration::Defined); - QVERIFY(p.state() & QNetworkConfiguration::Discovered); - } - - //getactive configurations only - configs = manager.allConfigurations(QNetworkConfiguration::Active); - int active = configs.count(); - if (active) - QVERIFY(manager.isOnline()); - else - QVERIFY(!manager.isOnline()); - - //QVERIFY(active); - qDebug() << "Active configurations:" << active; - foreach(const QNetworkConfiguration p, configs) { - printConfigurationDetails(p); - QVERIFY(p.isValid()); - QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); - QVERIFY(p.state() & QNetworkConfiguration::Active); - QVERIFY(p.state() & QNetworkConfiguration::Discovered); - QVERIFY(p.state() & QNetworkConfiguration::Defined); - } - - QVERIFY(all >= discovered); - QVERIFY(discovered >= active); -} - - -void tst_QNetworkConfigurationManager::defaultConfiguration() -{ - QNetworkConfigurationManager manager; - QSignalSpy spy(&manager, SIGNAL(updateCompleted())); - manager.updateConfigurations(); //initiate scans - QTRY_VERIFY(spy.count() == 1); //wait for scan to complete - - QList configs = manager.allConfigurations(); - QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); - - bool confirm = configs.contains(defaultConfig); - bool isUserChoice = (defaultConfig.type() == QNetworkConfiguration::UserChoice); - - //user choice config is not part of allConfigurations() - QVERIFY(isUserChoice != confirm); - if (!isUserChoice) { - QVERIFY(confirm || !defaultConfig.isValid()); - QVERIFY(!(confirm && !defaultConfig.isValid())); - } else { - QVERIFY(defaultConfig.isValid()); - QCOMPARE(defaultConfig.name(), QString("UserChoice")); - QCOMPARE(defaultConfig.children().count(), 0); - QVERIFY(!defaultConfig.isRoamingAvailable()); - QCOMPARE(defaultConfig.state(), QNetworkConfiguration::Discovered); - QNetworkConfiguration copy = manager.configurationFromIdentifier(defaultConfig.identifier()); - QVERIFY(copy == defaultConfig); - } -} - -void tst_QNetworkConfigurationManager::configurationFromIdentifier() -{ - QNetworkConfigurationManager manager; - QSet allIdentifier; - - //force an update to get maximum number of configs - QSignalSpy spy(&manager, SIGNAL(updateCompleted())); - manager.updateConfigurations(); //initiate scans - QTRY_VERIFY(spy.count() == 1); //wait for scan to complete - - QList configs = manager.allConfigurations(); - - foreach(QNetworkConfiguration c, configs) { - QVERIFY(!allIdentifier.contains(c.identifier())); - allIdentifier.insert(c.identifier()); - - QNetworkConfiguration direct = manager.configurationFromIdentifier(c.identifier()); - QVERIFY(direct.isValid()); - QVERIFY(direct == c); - } - - //assume that there is no item with identifier 'FooBar' - QVERIFY(!allIdentifier.contains("FooBar")); - QNetworkConfiguration invalid = manager.configurationFromIdentifier("FooBar"); - QVERIFY(!invalid.isValid()); -} - - -QTEST_MAIN(tst_QNetworkConfigurationManager) -#include "tst_qnetworkconfigmanager.moc" diff --git a/tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro b/tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro new file mode 100644 index 0000000..e0028e5 --- /dev/null +++ b/tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro @@ -0,0 +1,15 @@ +load(qttest_p4) +SOURCES += tst_qnetworkconfigurationmanager.cpp +HEADERS += ../qbearertestcommon.h + +QT = core network + +symbian { + TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData +} + +maemo6 { + CONFIG += link_pkgconfig + + PKGCONFIG += conninet +} diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp new file mode 100644 index 0000000..8b68006 --- /dev/null +++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp @@ -0,0 +1,335 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "../qbearertestcommon.h" +#include "qnetworkconfiguration.h" +#include "qnetworkconfigmanager.h" + +#ifdef Q_WS_MAEMO_6 +#include +#include +#endif + +QT_USE_NAMESPACE +class tst_QNetworkConfigurationManager : public QObject +{ + Q_OBJECT + +public slots: + void initTestCase(); + void cleanupTestCase(); + void init(); + void cleanup(); + +private slots: + void allConfigurations(); + void defaultConfiguration(); + void configurationFromIdentifier(); + +private: +#ifdef Q_WS_MAEMO_6 + Maemo::IAPConf *iapconf; + Maemo::IAPConf *iapconf2; + Maemo::IAPConf *gprsiap; +#define MAX_IAPS 50 + Maemo::IAPConf *iaps[MAX_IAPS]; + QProcess *icd_stub; +#endif +}; + +void tst_QNetworkConfigurationManager::initTestCase() +{ +#ifdef Q_WS_MAEMO_6 + iapconf = new Maemo::IAPConf("007"); + iapconf->setValue("ipv4_type", "AUTO"); + iapconf->setValue("wlan_wepkey1", "connt"); + iapconf->setValue("wlan_wepdefkey", 1); + iapconf->setValue("wlan_ssid", QByteArray("JamesBond")); + iapconf->setValue("name", "James Bond"); + iapconf->setValue("type", "WLAN_INFRA"); + + gprsiap = new Maemo::IAPConf("This-is-GPRS-IAP"); + gprsiap->setValue("ask_password", false); + gprsiap->setValue("gprs_accesspointname", "internet"); + gprsiap->setValue("gprs_password", ""); + gprsiap->setValue("gprs_username", ""); + gprsiap->setValue("ipv4_autodns", true); + gprsiap->setValue("ipv4_type", "AUTO"); + gprsiap->setValue("sim_imsi", "244070123456789"); + gprsiap->setValue("name", "MI6"); + gprsiap->setValue("type", "GPRS"); + + iapconf2 = new Maemo::IAPConf("osso.net"); + iapconf2->setValue("ipv4_type", "AUTO"); + iapconf2->setValue("wlan_wepkey1", "osso.net"); + iapconf2->setValue("wlan_wepdefkey", 1); + iapconf2->setValue("wlan_ssid", QByteArray("osso.net")); + iapconf2->setValue("name", "osso.net"); + iapconf2->setValue("type", "WLAN_INFRA"); + iapconf2->setValue("wlan_security", "WEP"); + + /* Create large number of IAPs in the gconf and see what happens */ + fflush(stdout); + printf("Creating %d IAPS: ", MAX_IAPS); + for (int i=0; isetValue("name", QString("test-iap-")+num); + iaps[i]->setValue("type", "WLAN_INFRA"); + iaps[i]->setValue("wlan_ssid", QString(QString("test-ssid-")+num).toAscii()); + iaps[i]->setValue("wlan_security", "WPA_PSK"); + iaps[i]->setValue("EAP_wpa_preshared_passphrase", QString("test-passphrase-")+num); + printf("."); + fflush(stdout); + } + printf("\n"); + fflush(stdout); + + icd_stub = new QProcess(this); + icd_stub->start("/usr/bin/icd2_stub.py"); + QTest::qWait(1000); + + // Add a known network to scan list that icd2 stub returns + QProcess dbus_send; + // 007 network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:5000011 array:byte:48,48,55"); + dbus_send.waitForFinished(); + + // osso.net network + dbus_send.start("dbus-send --type=method_call --system " + "--dest=com.nokia.icd2 /com/nokia/icd2 " + "com.nokia.icd2.testing.add_available_network " + "string:'' uint32:0 string:'' " + "string:WLAN_INFRA uint32:83886097 array:byte:111,115,115,111,46,110,101,116"); + dbus_send.waitForFinished(); +#endif +} + + +void tst_QNetworkConfigurationManager::cleanupTestCase() +{ +#ifdef Q_WS_MAEMO_6 + iapconf->clear(); + delete iapconf; + iapconf2->clear(); + delete iapconf2; + gprsiap->clear(); + delete gprsiap; + + printf("Deleting %d IAPS : ", MAX_IAPS); + for (int i=0; iclear(); + delete iaps[i]; + printf("."); + fflush(stdout); + } + printf("\n"); + qDebug() << "Deleted" << MAX_IAPS << "IAPs"; + + icd_stub->terminate(); + icd_stub->waitForFinished(); +#endif +} + +void tst_QNetworkConfigurationManager::init() +{ +} + +void tst_QNetworkConfigurationManager::cleanup() +{ +} + +void printConfigurationDetails(const QNetworkConfiguration& p) +{ + qDebug() << p.name() <<": isvalid->" <"<< p.type() << + " roaming->" << p.isRoamingAvailable() << "identifier->" << p.identifier() << + " purpose->" << p.purpose() << " state->" << p.state(); +} + +void tst_QNetworkConfigurationManager::allConfigurations() +{ + QNetworkConfigurationManager manager; + QList preScanConfigs = manager.allConfigurations(); + + foreach(QNetworkConfiguration c, preScanConfigs) + { + QVERIFY2(c.type()!=QNetworkConfiguration::UserChoice, "allConfiguration must not return UserChoice configs"); + } + + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(); + + int all = configs.count(); + qDebug() << "All configurations:" << all; + QVERIFY(all); + foreach(QNetworkConfiguration p, configs) { + QVERIFY(p.isValid()); + printConfigurationDetails(p); + QVERIFY(p.type() != QNetworkConfiguration::Invalid); + QVERIFY(p.type() != QNetworkConfiguration::UserChoice); + } + + configs = manager.allConfigurations(QNetworkConfiguration::Undefined); + int undefined = configs.count(); + QVERIFY(undefined <= all); + qDebug() << "Undefined configurations:" << undefined; + foreach( const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.state() & QNetworkConfiguration::Undefined); + QVERIFY(!(p.state() & QNetworkConfiguration::Defined)); + } + + //get defined configs only (same as all) + configs = manager.allConfigurations(QNetworkConfiguration::Defined); + int defined = configs.count(); + qDebug() << "Defined configurations:" << defined; + QVERIFY(defined <= all); + foreach( const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.state() & QNetworkConfiguration::Defined); + QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); + } + + //get discovered configurations only + configs = manager.allConfigurations(QNetworkConfiguration::Discovered); + int discovered = configs.count(); + //QVERIFY(discovered); + qDebug() << "Discovered configurations:" << discovered; + foreach(const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.isValid()); + QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); + QVERIFY(p.state() & QNetworkConfiguration::Defined); + QVERIFY(p.state() & QNetworkConfiguration::Discovered); + } + + //getactive configurations only + configs = manager.allConfigurations(QNetworkConfiguration::Active); + int active = configs.count(); + if (active) + QVERIFY(manager.isOnline()); + else + QVERIFY(!manager.isOnline()); + + //QVERIFY(active); + qDebug() << "Active configurations:" << active; + foreach(const QNetworkConfiguration p, configs) { + printConfigurationDetails(p); + QVERIFY(p.isValid()); + QVERIFY(!(p.state() & QNetworkConfiguration::Undefined)); + QVERIFY(p.state() & QNetworkConfiguration::Active); + QVERIFY(p.state() & QNetworkConfiguration::Discovered); + QVERIFY(p.state() & QNetworkConfiguration::Defined); + } + + QVERIFY(all >= discovered); + QVERIFY(discovered >= active); +} + + +void tst_QNetworkConfigurationManager::defaultConfiguration() +{ + QNetworkConfigurationManager manager; + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(); + QNetworkConfiguration defaultConfig = manager.defaultConfiguration(); + + bool confirm = configs.contains(defaultConfig); + bool isUserChoice = (defaultConfig.type() == QNetworkConfiguration::UserChoice); + + //user choice config is not part of allConfigurations() + QVERIFY(isUserChoice != confirm); + if (!isUserChoice) { + QVERIFY(confirm || !defaultConfig.isValid()); + QVERIFY(!(confirm && !defaultConfig.isValid())); + } else { + QVERIFY(defaultConfig.isValid()); + QCOMPARE(defaultConfig.name(), QString("UserChoice")); + QCOMPARE(defaultConfig.children().count(), 0); + QVERIFY(!defaultConfig.isRoamingAvailable()); + QCOMPARE(defaultConfig.state(), QNetworkConfiguration::Discovered); + QNetworkConfiguration copy = manager.configurationFromIdentifier(defaultConfig.identifier()); + QVERIFY(copy == defaultConfig); + } +} + +void tst_QNetworkConfigurationManager::configurationFromIdentifier() +{ + QNetworkConfigurationManager manager; + QSet allIdentifier; + + //force an update to get maximum number of configs + QSignalSpy spy(&manager, SIGNAL(updateCompleted())); + manager.updateConfigurations(); //initiate scans + QTRY_VERIFY(spy.count() == 1); //wait for scan to complete + + QList configs = manager.allConfigurations(); + + foreach(QNetworkConfiguration c, configs) { + QVERIFY(!allIdentifier.contains(c.identifier())); + allIdentifier.insert(c.identifier()); + + QNetworkConfiguration direct = manager.configurationFromIdentifier(c.identifier()); + QVERIFY(direct.isValid()); + QVERIFY(direct == c); + } + + //assume that there is no item with identifier 'FooBar' + QVERIFY(!allIdentifier.contains("FooBar")); + QNetworkConfiguration invalid = manager.configurationFromIdentifier("FooBar"); + QVERIFY(!invalid.isValid()); +} + + +QTEST_MAIN(tst_QNetworkConfigurationManager) +#include "tst_qnetworkconfigurationmanager.moc" diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index 29cb341..4f7822d 100644 --- a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -90,7 +90,7 @@ int distance(TestIterator &a, TestIterator &b) using namespace QtConcurrent; -class tst_iteratekernel: public QObject +class tst_QtConcurrentIterateKernel: public QObject { Q_OBJECT private slots: @@ -149,13 +149,13 @@ public: }; -void tst_iteratekernel::instantiate() +void tst_QtConcurrentIterateKernel::instantiate() { startThreadEngine(new PrintFor(0, 40)).startBlocking(); QCOMPARE((int)iterations, 40); } -void tst_iteratekernel::cancel() +void tst_QtConcurrentIterateKernel::cancel() { { QFuture f = startThreadEngine(new SleepPrintFor(0, 40)).startAsynchronously(); @@ -182,7 +182,7 @@ public: } }; -void tst_iteratekernel::stresstest() +void tst_QtConcurrentIterateKernel::stresstest() { const int iterations = 1000; const int times = 50; @@ -194,7 +194,7 @@ void tst_iteratekernel::stresstest() } } -void tst_iteratekernel::noIterations() +void tst_QtConcurrentIterateKernel::noIterations() { const int times = 20000; for (int i = 0; i < times; ++i) @@ -242,7 +242,7 @@ public: bool throttling; }; -void tst_iteratekernel::throttling() +void tst_QtConcurrentIterateKernel::throttling() { const int totalIterations = 400; iterations = 0; @@ -271,7 +271,7 @@ public: } }; -void tst_iteratekernel::blockSize() +void tst_QtConcurrentIterateKernel::blockSize() { #ifdef QT_NO_STL QSKIP("Missing stl iterators prevent correct block size calculation", SkipAll); @@ -296,7 +296,7 @@ public: }; -void tst_iteratekernel::multipleResults() +void tst_QtConcurrentIterateKernel::multipleResults() { #ifdef QT_NO_STL QSKIP("Missing stl iterators prevent correct summation", SkipAll); @@ -320,7 +320,7 @@ public: } }; -void tst_iteratekernel::instantiateWhile() +void tst_QtConcurrentIterateKernel::instantiateWhile() { PrintWhile w; w.startBlocking(); @@ -339,7 +339,7 @@ public: } }; -void tst_iteratekernel::stresstestWhile() +void tst_QtConcurrentIterateKernel::stresstestWhile() { int iterations = 100000; StressWhile w(iterations); @@ -348,7 +348,7 @@ void tst_iteratekernel::stresstestWhile() } #endif -QTEST_MAIN(tst_iteratekernel) +QTEST_MAIN(tst_QtConcurrentIterateKernel) #include "tst_qtconcurrentiteratekernel.moc" diff --git a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp index d3417b1..894bac4 100644 --- a/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp +++ b/tests/auto/qtconcurrentmap/tst_qtconcurrentmap.cpp @@ -56,7 +56,7 @@ Q_DECLARE_METATYPE(QList); Q_DECLARE_METATYPE(QList); Q_DECLARE_METATYPE(QList); -class tst_map: public QObject +class tst_QtConcurrentMap: public QObject { Q_OBJECT private slots: @@ -114,7 +114,7 @@ public: Q_DECLARE_METATYPE(QList); -void tst_map::map() +void tst_QtConcurrentMap::map() { // functors take arguments by reference, modifying the sequence in place { @@ -246,7 +246,7 @@ void tst_map::map() #endif } -void tst_map::blocking_map() +void tst_QtConcurrentMap::blocking_map() { // functors take arguments by reference, modifying the sequence in place { @@ -428,7 +428,7 @@ public: } }; -void tst_map::mapped() +void tst_QtConcurrentMap::mapped() { QList list; list << 1 << 2 << 3; @@ -790,7 +790,7 @@ void tst_map::mapped() } } -void tst_map::blocking_mapped() +void tst_QtConcurrentMap::blocking_mapped() { QList list; list << 1 << 2 << 3; @@ -1244,7 +1244,7 @@ public: } }; -void tst_map::mappedReduced() +void tst_QtConcurrentMap::mappedReduced() { QList list; list << 1 << 2 << 3; @@ -1625,7 +1625,7 @@ void tst_map::mappedReduced() // ### the same as above, with an initial result value } -void tst_map::blocking_mappedReduced() +void tst_QtConcurrentMap::blocking_mappedReduced() { QList list; list << 1 << 2 << 3; @@ -2010,7 +2010,7 @@ int sleeper(int val) return val; } -void tst_map::assignResult() +void tst_QtConcurrentMap::assignResult() { const QList startList = QList() << 0 << 1 << 2; QList list = QtConcurrent::blockingMapped(startList, sleeper); @@ -2077,7 +2077,7 @@ public: Q_DECLARE_METATYPE(QVector); Q_DECLARE_METATYPE(QList); -void tst_map::functionOverloads() +void tst_QtConcurrentMap::functionOverloads() { QList intList; const QList constIntList; @@ -2159,7 +2159,7 @@ void fastReduce(int &result, const InstanceCounter&) ++result; } -void tst_map::throttling() +void tst_QtConcurrentMap::throttling() { const int itemcount = 100; const int allowedTemporaries = QThread::idealThreadCount() * 40; @@ -2208,7 +2208,7 @@ void throwMapper(int &e) throw QtConcurrent::Exception(); } -void tst_map::exceptions() +void tst_QtConcurrentMap::exceptions() { bool caught = false; try { @@ -2228,7 +2228,7 @@ int mapper(const int &i) return i; } -void tst_map::incrementalResults() +void tst_QtConcurrentMap::incrementalResults() { const int count = 200; QList ints; @@ -2256,7 +2256,7 @@ void tst_map::incrementalResults() Test that mapped does not cause deep copies when holding references to Qt containers. */ -void tst_map::noDetatch() +void tst_QtConcurrentMap::noDetatch() { { QList l = QList() << 1; @@ -2299,7 +2299,7 @@ void tst_map::noDetatch() } -void tst_map::stlContainers() +void tst_QtConcurrentMap::stlContainers() { #ifdef QT_NO_STL QSKIP("Qt compiled without STL support", SkipAll); @@ -2331,7 +2331,7 @@ InstanceCounter ic_fn(const InstanceCounter & ic) // Verify that held results are deleted when a future is // assigned over with operator == -void tst_map::qFutureAssignmentLeak() +void tst_QtConcurrentMap::qFutureAssignmentLeak() { currentInstanceCount = 0; peakInstanceCount = 0; @@ -2370,7 +2370,7 @@ void add(int &result, const int &sum) result += sum; } -void tst_map::stressTest() +void tst_QtConcurrentMap::stressTest() { const int listSize = 1000; const int sum = (listSize - 1) * (listSize / 2); @@ -2399,26 +2399,26 @@ void tst_map::stressTest() } } -QTEST_MAIN(tst_map) +QTEST_MAIN(tst_QtConcurrentMap) #else -void tst_map::map() {} -void tst_map::blocking_map() {} -void tst_map::mapped() {} -void tst_map::blocking_mapped() {} -void tst_map::mappedReduced() {} -void tst_map::blocking_mappedReduced() {} -void tst_map::assignResult() {} -void tst_map::functionOverloads() {} +void tst_QtConcurrentMap::map() {} +void tst_QtConcurrentMap::blocking_map() {} +void tst_QtConcurrentMap::mapped() {} +void tst_QtConcurrentMap::blocking_mapped() {} +void tst_QtConcurrentMap::mappedReduced() {} +void tst_QtConcurrentMap::blocking_mappedReduced() {} +void tst_QtConcurrentMap::assignResult() {} +void tst_QtConcurrentMap::functionOverloads() {} #ifndef QT_NO_EXCEPTIONS -void tst_map::exceptions() {} +void tst_QtConcurrentMap::exceptions() {} #endif -void tst_map::incrementalResults() {} -void tst_map::stressTest() {} -void tst_map::throttling() {} -void tst_map::stlContainers() {} -void tst_map::noDetatch() {} +void tst_QtConcurrentMap::incrementalResults() {} +void tst_QtConcurrentMap::stressTest() {} +void tst_QtConcurrentMap::throttling() {} +void tst_QtConcurrentMap::stlContainers() {} +void tst_QtConcurrentMap::noDetatch() {} QTEST_NOOP_MAIN diff --git a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp index b9ab6d3..8fdc50c 100644 --- a/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp +++ b/tests/auto/qtconcurrentrun/tst_qtconcurrentrun.cpp @@ -49,7 +49,7 @@ using namespace QtConcurrent; -class TestRunFunction: public QObject +class tst_QtConcurrentRun: public QObject { Q_OBJECT private slots: @@ -73,7 +73,7 @@ private slots: #endif -QTEST_MAIN(TestRunFunction) +QTEST_MAIN(tst_QtConcurrentRun) void light() { @@ -91,7 +91,7 @@ void heavy() } -void TestRunFunction::runLightFunction() +void tst_QtConcurrentRun::runLightFunction() { qDebug("starting function"); QFuture future = run(F(light)); @@ -100,7 +100,7 @@ void TestRunFunction::runLightFunction() qDebug("done"); } -void TestRunFunction::runHeavyFunction() +void tst_QtConcurrentRun::runHeavyFunction() { qDebug("starting function"); QFuture future = run(F(heavy)); @@ -141,7 +141,7 @@ public: int operator()(int in) const { return in; } }; -void TestRunFunction::returnValue() +void tst_QtConcurrentRun::returnValue() { QFuture f; @@ -217,7 +217,7 @@ struct TestConstClass void fooInt(int) const { }; }; -void TestRunFunction::functionObject() +void tst_QtConcurrentRun::functionObject() { QFuture f; TestClass c; @@ -235,7 +235,7 @@ void TestRunFunction::functionObject() } -void TestRunFunction::memberFunctions() +void tst_QtConcurrentRun::memberFunctions() { TestClass c; @@ -278,7 +278,7 @@ void stringIntFunction(QString) } -void TestRunFunction::implicitConvertibleTypes() +void tst_QtConcurrentRun::implicitConvertibleTypes() { double d; run(F(doubleFunction), d).waitForFinished(); @@ -294,7 +294,7 @@ void TestRunFunction::implicitConvertibleTypes() void fn() { } -void TestRunFunction::runWaitLoop() +void tst_QtConcurrentRun::runWaitLoop() { for (int i = 0; i < 1000; ++i) run(fn).waitForFinished(); @@ -324,7 +324,7 @@ int recursiveResult(int level) return 1; } -void TestRunFunction::recursive() +void tst_QtConcurrentRun::recursive() { int levels = 15; @@ -375,7 +375,7 @@ int fn2(double, int *) } #if 0 -void TestRunFunction::createFunctor() +void tst_QtConcurrentRun::createFunctor() { e = 0; ::QtConcurrent::createFunctor(vfn0)(); diff --git a/tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp b/tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp index 6f586d7..23fd19b 100644 --- a/tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp +++ b/tests/auto/qtconcurrentthreadengine/tst_qtconcurrentthreadengine.cpp @@ -48,7 +48,7 @@ using namespace QtConcurrent; -class tst_threadengine: public QObject +class tst_QtConcurrentThreadEngine: public QObject { Q_OBJECT public: @@ -79,7 +79,7 @@ public: } }; -void tst_threadengine::runDirectly() +void tst_QtConcurrentThreadEngine::runDirectly() { { PrintUser engine; @@ -120,7 +120,7 @@ public: bool done; }; -void tst_threadengine::result() +void tst_QtConcurrentThreadEngine::result() { StringResultUser engine; QCOMPARE(*engine.startBlocking(), QString("Foo")); @@ -147,7 +147,7 @@ public: bool done; }; -void tst_threadengine::runThroughStarter() +void tst_QtConcurrentThreadEngine::runThroughStarter() { { ThreadEngineStarter starter = startThreadEngine(new StringResultUser()); @@ -180,7 +180,7 @@ public: } }; -void tst_threadengine::cancel() +void tst_QtConcurrentThreadEngine::cancel() { { CancelUser *engine = new CancelUser(); @@ -234,7 +234,7 @@ public: // Test that a user task with a thread function that always // want to be throttled still completes. The thread engine // should make keep one thread running at all times. -void tst_threadengine::throttle() +void tst_QtConcurrentThreadEngine::throttle() { const int repeats = 10; for (int i = 0; i < repeats; ++i) { @@ -280,7 +280,7 @@ public: bool finishing; }; -void tst_threadengine::threadCount() +void tst_QtConcurrentThreadEngine::threadCount() { const int repeats = 10; for (int i = 0; i < repeats; ++i) { @@ -320,7 +320,7 @@ public: }; -void tst_threadengine::multipleResults() +void tst_QtConcurrentThreadEngine::multipleResults() { MultipleResultsUser *engine = new MultipleResultsUser(); QFuture f = engine->startAsynchronously(); @@ -351,7 +351,7 @@ public: } }; -void tst_threadengine::stresstest() +void tst_QtConcurrentThreadEngine::stresstest() { const int times = 20000; @@ -379,7 +379,7 @@ public: ThreadFunctionResult threadFunction() { QTest::qSleep(sleepTime); return ThreadFinished; } }; -void tst_threadengine::cancelQueuedSlowUser() +void tst_QtConcurrentThreadEngine::cancelQueuedSlowUser() { const int times = 100; @@ -436,7 +436,7 @@ public: QThread *blockThread; }; -void tst_threadengine::exceptions() +void tst_QtConcurrentThreadEngine::exceptions() { // Asynchronous mode: { @@ -527,7 +527,7 @@ void tst_threadengine::exceptions() #endif -QTEST_MAIN(tst_threadengine) +QTEST_MAIN(tst_QtConcurrentThreadEngine) #include "tst_qtconcurrentthreadengine.moc" diff --git a/tests/auto/qvectornd/tst_qvectornd.cpp b/tests/auto/qvectornd/tst_qvectornd.cpp index 2be7264..2850f32 100644 --- a/tests/auto/qvectornd/tst_qvectornd.cpp +++ b/tests/auto/qvectornd/tst_qvectornd.cpp @@ -45,12 +45,12 @@ #include #include -class tst_QVector : public QObject +class tst_QVectorND : public QObject { Q_OBJECT public: - tst_QVector() {} - ~tst_QVector() {} + tst_QVectorND() {} + ~tst_QVectorND() {} private slots: void create2(); @@ -155,7 +155,7 @@ static bool fuzzyCompare(qreal x, qreal y) // Test the creation of QVector2D objects in various ways: // construct, copy, and modify. -void tst_QVector::create2() +void tst_QVectorND::create2() { QVector2D null; QCOMPARE(null.x(), (qreal)0.0f); @@ -244,7 +244,7 @@ void tst_QVector::create2() // Test the creation of QVector3D objects in various ways: // construct, copy, and modify. -void tst_QVector::create3() +void tst_QVectorND::create3() { QVector3D null; QCOMPARE(null.x(), (qreal)0.0f); @@ -370,7 +370,7 @@ void tst_QVector::create3() // Test the creation of QVector4D objects in various ways: // construct, copy, and modify. -void tst_QVector::create4() +void tst_QVectorND::create4() { QVector4D null; QCOMPARE(null.x(), (qreal)0.0f); @@ -556,7 +556,7 @@ void tst_QVector::create4() } // Test vector length computation for 2D vectors. -void tst_QVector::length2_data() +void tst_QVectorND::length2_data() { QTest::addColumn("x"); QTest::addColumn("y"); @@ -569,7 +569,7 @@ void tst_QVector::length2_data() QTest::newRow("-1y") << (qreal)0.0f << (qreal)-1.0f << (qreal)1.0f; QTest::newRow("two") << (qreal)2.0f << (qreal)-2.0f << (qreal)qSqrt(8.0f); } -void tst_QVector::length2() +void tst_QVectorND::length2() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -581,7 +581,7 @@ void tst_QVector::length2() } // Test vector length computation for 3D vectors. -void tst_QVector::length3_data() +void tst_QVectorND::length3_data() { QTest::addColumn("x"); QTest::addColumn("y"); @@ -597,7 +597,7 @@ void tst_QVector::length3_data() QTest::newRow("-1z") << (qreal)0.0f << (qreal)0.0f << (qreal)-1.0f << (qreal)1.0f; QTest::newRow("two") << (qreal)2.0f << (qreal)-2.0f << (qreal)2.0f << (qreal)qSqrt(12.0f); } -void tst_QVector::length3() +void tst_QVectorND::length3() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -610,7 +610,7 @@ void tst_QVector::length3() } // Test vector length computation for 4D vectors. -void tst_QVector::length4_data() +void tst_QVectorND::length4_data() { QTest::addColumn("x"); QTest::addColumn("y"); @@ -629,7 +629,7 @@ void tst_QVector::length4_data() QTest::newRow("-1w") << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)-1.0f << (qreal)1.0f; QTest::newRow("two") << (qreal)2.0f << (qreal)-2.0f << (qreal)2.0f << (qreal)2.0f << (qreal)qSqrt(16.0f); } -void tst_QVector::length4() +void tst_QVectorND::length4() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -643,12 +643,12 @@ void tst_QVector::length4() } // Test the unit vector conversion for 2D vectors. -void tst_QVector::normalized2_data() +void tst_QVectorND::normalized2_data() { // Use the same test data as the length test. length2_data(); } -void tst_QVector::normalized2() +void tst_QVectorND::normalized2() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -665,12 +665,12 @@ void tst_QVector::normalized2() } // Test the unit vector conversion for 3D vectors. -void tst_QVector::normalized3_data() +void tst_QVectorND::normalized3_data() { // Use the same test data as the length test. length3_data(); } -void tst_QVector::normalized3() +void tst_QVectorND::normalized3() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -689,12 +689,12 @@ void tst_QVector::normalized3() } // Test the unit vector conversion for 4D vectors. -void tst_QVector::normalized4_data() +void tst_QVectorND::normalized4_data() { // Use the same test data as the length test. length4_data(); } -void tst_QVector::normalized4() +void tst_QVectorND::normalized4() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -715,12 +715,12 @@ void tst_QVector::normalized4() } // Test the unit vector conversion for 2D vectors. -void tst_QVector::normalize2_data() +void tst_QVectorND::normalize2_data() { // Use the same test data as the length test. length2_data(); } -void tst_QVector::normalize2() +void tst_QVectorND::normalize2() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -735,12 +735,12 @@ void tst_QVector::normalize2() } // Test the unit vector conversion for 3D vectors. -void tst_QVector::normalize3_data() +void tst_QVectorND::normalize3_data() { // Use the same test data as the length test. length3_data(); } -void tst_QVector::normalize3() +void tst_QVectorND::normalize3() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -756,12 +756,12 @@ void tst_QVector::normalize3() } // Test the unit vector conversion for 4D vectors. -void tst_QVector::normalize4_data() +void tst_QVectorND::normalize4_data() { // Use the same test data as the length test. length4_data(); } -void tst_QVector::normalize4() +void tst_QVectorND::normalize4() { QFETCH(qreal, x); QFETCH(qreal, y); @@ -778,7 +778,7 @@ void tst_QVector::normalize4() } // Test the comparison operators for 2D vectors. -void tst_QVector::compare2() +void tst_QVectorND::compare2() { QVector2D v1(1, 2); QVector2D v2(1, 2); @@ -791,7 +791,7 @@ void tst_QVector::compare2() } // Test the comparison operators for 3D vectors. -void tst_QVector::compare3() +void tst_QVectorND::compare3() { QVector3D v1(1, 2, 4); QVector3D v2(1, 2, 4); @@ -806,7 +806,7 @@ void tst_QVector::compare3() } // Test the comparison operators for 4D vectors. -void tst_QVector::compare4() +void tst_QVectorND::compare4() { QVector4D v1(1, 2, 4, 8); QVector4D v2(1, 2, 4, 8); @@ -823,7 +823,7 @@ void tst_QVector::compare4() } // Test vector addition for 2D vectors. -void tst_QVector::add2_data() +void tst_QVectorND::add2_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -852,7 +852,7 @@ void tst_QVector::add2_data() << (qreal)4.0f << (qreal)5.0f << (qreal)5.0f << (qreal)7.0f; } -void tst_QVector::add2() +void tst_QVectorND::add2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -876,7 +876,7 @@ void tst_QVector::add2() } // Test vector addition for 3D vectors. -void tst_QVector::add3_data() +void tst_QVectorND::add3_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -913,7 +913,7 @@ void tst_QVector::add3_data() << (qreal)4.0f << (qreal)5.0f << (qreal)-6.0f << (qreal)5.0f << (qreal)7.0f << (qreal)-3.0f; } -void tst_QVector::add3() +void tst_QVectorND::add3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -941,7 +941,7 @@ void tst_QVector::add3() } // Test vector addition for 4D vectors. -void tst_QVector::add4_data() +void tst_QVectorND::add4_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -986,7 +986,7 @@ void tst_QVector::add4_data() << (qreal)4.0f << (qreal)5.0f << (qreal)-6.0f << (qreal)9.0f << (qreal)5.0f << (qreal)7.0f << (qreal)-3.0f << (qreal)17.0f; } -void tst_QVector::add4() +void tst_QVectorND::add4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1018,12 +1018,12 @@ void tst_QVector::add4() } // Test vector subtraction for 2D vectors. -void tst_QVector::subtract2_data() +void tst_QVectorND::subtract2_data() { // Use the same test data as the add test. add2_data(); } -void tst_QVector::subtract2() +void tst_QVectorND::subtract2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1055,12 +1055,12 @@ void tst_QVector::subtract2() } // Test vector subtraction for 3D vectors. -void tst_QVector::subtract3_data() +void tst_QVectorND::subtract3_data() { // Use the same test data as the add test. add3_data(); } -void tst_QVector::subtract3() +void tst_QVectorND::subtract3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1097,12 +1097,12 @@ void tst_QVector::subtract3() } // Test vector subtraction for 4D vectors. -void tst_QVector::subtract4_data() +void tst_QVectorND::subtract4_data() { // Use the same test data as the add test. add4_data(); } -void tst_QVector::subtract4() +void tst_QVectorND::subtract4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1144,7 +1144,7 @@ void tst_QVector::subtract4() } // Test component-wise vector multiplication for 2D vectors. -void tst_QVector::multiply2_data() +void tst_QVectorND::multiply2_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1173,7 +1173,7 @@ void tst_QVector::multiply2_data() << (qreal)4.0f << (qreal)5.0f << (qreal)4.0f << (qreal)10.0f; } -void tst_QVector::multiply2() +void tst_QVectorND::multiply2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1197,7 +1197,7 @@ void tst_QVector::multiply2() } // Test component-wise vector multiplication for 3D vectors. -void tst_QVector::multiply3_data() +void tst_QVectorND::multiply3_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1234,7 +1234,7 @@ void tst_QVector::multiply3_data() << (qreal)4.0f << (qreal)5.0f << (qreal)-6.0f << (qreal)4.0f << (qreal)10.0f << (qreal)-18.0f; } -void tst_QVector::multiply3() +void tst_QVectorND::multiply3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1262,7 +1262,7 @@ void tst_QVector::multiply3() } // Test component-wise vector multiplication for 4D vectors. -void tst_QVector::multiply4_data() +void tst_QVectorND::multiply4_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1307,7 +1307,7 @@ void tst_QVector::multiply4_data() << (qreal)4.0f << (qreal)5.0f << (qreal)-6.0f << (qreal)9.0f << (qreal)4.0f << (qreal)10.0f << (qreal)-18.0f << (qreal)72.0f; } -void tst_QVector::multiply4() +void tst_QVectorND::multiply4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1339,7 +1339,7 @@ void tst_QVector::multiply4() } // Test vector multiplication by a factor for 2D vectors. -void tst_QVector::multiplyFactor2_data() +void tst_QVectorND::multiplyFactor2_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1372,7 +1372,7 @@ void tst_QVector::multiplyFactor2_data() << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f; } -void tst_QVector::multiplyFactor2() +void tst_QVectorND::multiplyFactor2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1395,7 +1395,7 @@ void tst_QVector::multiplyFactor2() } // Test vector multiplication by a factor for 3D vectors. -void tst_QVector::multiplyFactor3_data() +void tst_QVectorND::multiplyFactor3_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1435,7 +1435,7 @@ void tst_QVector::multiplyFactor3_data() << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f; } -void tst_QVector::multiplyFactor3() +void tst_QVectorND::multiplyFactor3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1461,7 +1461,7 @@ void tst_QVector::multiplyFactor3() } // Test vector multiplication by a factor for 4D vectors. -void tst_QVector::multiplyFactor4_data() +void tst_QVectorND::multiplyFactor4_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1508,7 +1508,7 @@ void tst_QVector::multiplyFactor4_data() << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f << (qreal)0.0f; } -void tst_QVector::multiplyFactor4() +void tst_QVectorND::multiplyFactor4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1537,12 +1537,12 @@ void tst_QVector::multiplyFactor4() } // Test vector division by a factor for 2D vectors. -void tst_QVector::divide2_data() +void tst_QVectorND::divide2_data() { // Use the same test data as the multiply test. multiplyFactor2_data(); } -void tst_QVector::divide2() +void tst_QVectorND::divide2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1567,12 +1567,12 @@ void tst_QVector::divide2() } // Test vector division by a factor for 3D vectors. -void tst_QVector::divide3_data() +void tst_QVectorND::divide3_data() { // Use the same test data as the multiply test. multiplyFactor3_data(); } -void tst_QVector::divide3() +void tst_QVectorND::divide3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1600,12 +1600,12 @@ void tst_QVector::divide3() } // Test vector division by a factor for 4D vectors. -void tst_QVector::divide4_data() +void tst_QVectorND::divide4_data() { // Use the same test data as the multiply test. multiplyFactor4_data(); } -void tst_QVector::divide4() +void tst_QVectorND::divide4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1636,12 +1636,12 @@ void tst_QVector::divide4() } // Test vector negation for 2D vectors. -void tst_QVector::negate2_data() +void tst_QVectorND::negate2_data() { // Use the same test data as the add test. add2_data(); } -void tst_QVector::negate2() +void tst_QVectorND::negate2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1653,12 +1653,12 @@ void tst_QVector::negate2() } // Test vector negation for 3D vectors. -void tst_QVector::negate3_data() +void tst_QVectorND::negate3_data() { // Use the same test data as the add test. add3_data(); } -void tst_QVector::negate3() +void tst_QVectorND::negate3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1671,12 +1671,12 @@ void tst_QVector::negate3() } // Test vector negation for 4D vectors. -void tst_QVector::negate4_data() +void tst_QVectorND::negate4_data() { // Use the same test data as the add test. add4_data(); } -void tst_QVector::negate4() +void tst_QVectorND::negate4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1690,7 +1690,7 @@ void tst_QVector::negate4() } // Test the computation of vector cross-products. -void tst_QVector::crossProduct_data() +void tst_QVectorND::crossProduct_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1721,7 +1721,7 @@ void tst_QVector::crossProduct_data() << (qreal)-3.0f << (qreal)6.0f << (qreal)-3.0f << (qreal)32.0f; } -void tst_QVector::crossProduct() +void tst_QVectorND::crossProduct() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1751,12 +1751,12 @@ void tst_QVector::crossProduct() } // Test the computation of normals. -void tst_QVector::normal_data() +void tst_QVectorND::normal_data() { // Use the same test data as the crossProduct test. crossProduct_data(); } -void tst_QVector::normal() +void tst_QVectorND::normal() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1780,7 +1780,7 @@ void tst_QVector::normal() } // Test distance to plane calculations. -void tst_QVector::distanceToPlane_data() +void tst_QVectorND::distanceToPlane_data() { QTest::addColumn("x1"); // Point on plane QTest::addColumn("y1"); @@ -1823,7 +1823,7 @@ void tst_QVector::distanceToPlane_data() << (qreal)0.0f << (qreal)2.0f << (qreal)0.0f << (qreal)-2.0f; } -void tst_QVector::distanceToPlane() +void tst_QVectorND::distanceToPlane() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1853,7 +1853,7 @@ void tst_QVector::distanceToPlane() } // Test distance to line calculations. -void tst_QVector::distanceToLine_data() +void tst_QVectorND::distanceToLine_data() { QTest::addColumn("x1"); // Point on line QTest::addColumn("y1"); @@ -1896,7 +1896,7 @@ void tst_QVector::distanceToLine_data() << (qreal)0.0f << (qreal)5.0f << (qreal)0.0f << (qreal)5.0f; } -void tst_QVector::distanceToLine() +void tst_QVectorND::distanceToLine() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1917,7 +1917,7 @@ void tst_QVector::distanceToLine() } // Test the computation of dot products for 2D vectors. -void tst_QVector::dotProduct2_data() +void tst_QVectorND::dotProduct2_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -1940,7 +1940,7 @@ void tst_QVector::dotProduct2_data() << (qreal)4.0f << (qreal)5.0f << (qreal)14.0f; } -void tst_QVector::dotProduct2() +void tst_QVectorND::dotProduct2() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1960,12 +1960,12 @@ void tst_QVector::dotProduct2() } // Test the computation of dot products for 3D vectors. -void tst_QVector::dotProduct3_data() +void tst_QVectorND::dotProduct3_data() { // Use the same test data as the crossProduct test. crossProduct_data(); } -void tst_QVector::dotProduct3() +void tst_QVectorND::dotProduct3() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -1994,7 +1994,7 @@ void tst_QVector::dotProduct3() } // Test the computation of dot products for 4D vectors. -void tst_QVector::dotProduct4_data() +void tst_QVectorND::dotProduct4_data() { QTest::addColumn("x1"); QTest::addColumn("y1"); @@ -2021,7 +2021,7 @@ void tst_QVector::dotProduct4_data() << (qreal)4.0f << (qreal)5.0f << (qreal)6.0f << (qreal)7.0f << (qreal)60.0f; } -void tst_QVector::dotProduct4() +void tst_QVectorND::dotProduct4() { QFETCH(qreal, x1); QFETCH(qreal, y1); @@ -2044,14 +2044,14 @@ void tst_QVector::dotProduct4() QCOMPARE(QVector4D::dotProduct(v1, v2), d); } -class tst_QVectorProperties : public QObject +class tst_QVectorNDProperties : public QObject { Q_OBJECT Q_PROPERTY(QVector2D vector2D READ vector2D WRITE setVector2D) Q_PROPERTY(QVector3D vector3D READ vector3D WRITE setVector3D) Q_PROPERTY(QVector4D vector4D READ vector4D WRITE setVector4D) public: - tst_QVectorProperties(QObject *parent = 0) : QObject(parent) {} + tst_QVectorNDProperties(QObject *parent = 0) : QObject(parent) {} QVector2D vector2D() const { return v2; } void setVector2D(const QVector2D& value) { v2 = value; } @@ -2069,9 +2069,9 @@ private: }; // Test getting and setting vector properties via the metaobject system. -void tst_QVector::properties() +void tst_QVectorND::properties() { - tst_QVectorProperties obj; + tst_QVectorNDProperties obj; obj.setVector2D(QVector2D(1.0f, 2.0f)); obj.setVector3D(QVector3D(3.0f, 4.0f, 5.0f)); @@ -2115,7 +2115,7 @@ void tst_QVector::properties() QCOMPARE(v4.w(), (qreal)-9.0f); } -void tst_QVector::metaTypes() +void tst_QVectorND::metaTypes() { QVERIFY(QMetaType::type("QVector2D") == QMetaType::QVector2D); QVERIFY(QMetaType::type("QVector3D") == QMetaType::QVector3D); @@ -2137,6 +2137,6 @@ void tst_QVector::metaTypes() QVERIFY(qMetaTypeId() == QMetaType::QVector4D); } -QTEST_APPLESS_MAIN(tst_QVector) +QTEST_APPLESS_MAIN(tst_QVectorND) #include "tst_qvectornd.moc" diff --git a/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp index 4a11404..f4f6181 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp +++ b/tests/auto/xmlpatternsdiagnosticsts/tst_xmlpatternsdiagnosticsts.cpp @@ -52,25 +52,25 @@ \since 4.5 \brief Test QtXmlPatterns test suite driver in tests/auto/xmlpatternsxqts/lib/. */ -class tst_XmlPatternsXSLTS : public tst_SuiteTest +class tst_XmlPatternsDiagnosticsTS : public tst_SuiteTest { Q_OBJECT public: - tst_XmlPatternsXSLTS(); + tst_XmlPatternsDiagnosticsTS(); protected: virtual void catalogPath(QString &write) const; }; -tst_XmlPatternsXSLTS::tst_XmlPatternsXSLTS() : tst_SuiteTest(tst_SuiteTest::XQuerySuite, true) +tst_XmlPatternsDiagnosticsTS::tst_XmlPatternsDiagnosticsTS() : tst_SuiteTest(tst_SuiteTest::XQuerySuite, true) { } -void tst_XmlPatternsXSLTS::catalogPath(QString &write) const +void tst_XmlPatternsDiagnosticsTS::catalogPath(QString &write) const { write = QLatin1String("TestSuite/DiagnosticsCatalog.xml"); } -QTEST_MAIN(tst_XmlPatternsXSLTS) +QTEST_MAIN(tst_XmlPatternsDiagnosticsTS) #include "tst_xmlpatternsdiagnosticsts.moc" #else -- cgit v0.12