diff options
Diffstat (limited to 'tests/auto')
34 files changed, 1127 insertions, 356 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 497e720..c0004f7 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -18,6 +18,5 @@ contains(QT_CONFIG, webkit): SUBDIRS += webkit.pro contains(QT_CONFIG, multimedia): SUBDIRS += multimedia.pro contains(QT_CONFIG, phonon): SUBDIRS += phonon.pro contains(QT_CONFIG, svg): SUBDIRS += svg.pro -contains(QT_CONFIG, declarative): SUBDIRS += declarative - +contains(QT_CONFIG, declarative): SUBDIRS += declarative.pro diff --git a/tests/auto/declarative.pro b/tests/auto/declarative.pro new file mode 100644 index 0000000..f2173f0 --- /dev/null +++ b/tests/auto/declarative.pro @@ -0,0 +1,4 @@ +TEMPLATE=subdirs +SUBDIRS=\ + declarative \ + 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/qdeclarativelayouts/data/layouts.qml index 1792500..1792500 100644 --- a/tests/auto/declarative/layouts/data/layouts.qml +++ b/tests/auto/declarative/qdeclarativelayouts/data/layouts.qml diff --git a/tests/auto/declarative/layouts/layouts.pro b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro index f38e155..7276162 100644 --- a/tests/auto/declarative/layouts/layouts.pro +++ b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro @@ -1,6 +1,6 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_layouts.cpp +SOURCES += tst_qdeclarativelayouts.cpp macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp index 942125f..879047e 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/qdeclarativelayouts/tst_qdeclarativelayouts.cpp @@ -144,4 +144,4 @@ QDeclarativeView *tst_QDeclarativeLayouts::createView(const QString &filename) QTEST_MAIN(tst_QDeclarativeLayouts) -#include "tst_layouts.moc" +#include "tst_qdeclarativelayouts.moc" diff --git a/tests/auto/maketestselftest/features/dump_subdirs.prf b/tests/auto/maketestselftest/features/dump_subdirs.prf new file mode 100644 index 0000000..2547f58 --- /dev/null +++ b/tests/auto/maketestselftest/features/dump_subdirs.prf @@ -0,0 +1,4 @@ +for(dir, SUBDIRS) { + message(subdir: $$dir) +} + diff --git a/tests/auto/maketestselftest/tst_maketestselftest.cpp b/tests/auto/maketestselftest/tst_maketestselftest.cpp index 8264e27..437e143 100644 --- a/tests/auto/maketestselftest/tst_maketestselftest.cpp +++ b/tests/auto/maketestselftest/tst_maketestselftest.cpp @@ -44,16 +44,62 @@ #include <QRegExp> #include <QStringList> #include <QTest> +#include <QSet> +#include <QProcess> +#include <QDebug> + +enum FindSubdirsMode { + Flat = 0, + Recursive +}; class tst_MakeTestSelfTest: public QObject { Q_OBJECT private slots: + void tests_auto_pro(); + void tests_pro_files(); void tests_pro_files_data(); + + void naming_convention(); + void naming_convention_data(); + +private: + QStringList find_subdirs(QString const&, FindSubdirsMode, QString const& = QString()); + + QSet<QString> all_test_classes; }; +bool looks_like_testcase(QString const&,QString*); +bool looks_like_subdirs(QString const&); +QStringList find_test_class(QString const&); + +/* + Verify that auto.pro only contains other .pro files (and not directories). + We enforce this so that we can process every .pro file other than auto.pro + independently and get all the tests. + If tests were allowed to appear directly in auto.pro, we'd have the problem + that we need to somehow run these tests from auto.pro while preventing + recursion into the other .pro files. +*/ +void tst_MakeTestSelfTest::tests_auto_pro() +{ + QStringList subdirsList = find_subdirs(SRCDIR "/../auto.pro", Flat); + if (QTest::currentTestFailed()) { + return; + } + + foreach (QString const& subdir, subdirsList) { + QVERIFY2(subdir.endsWith(".pro"), qPrintable(QString( + "auto.pro contains a subdir `%1'.\n" + "auto.pro must _only_ contain other .pro files, not actual subdirs.\n" + "Please move `%1' into some other .pro file referenced by auto.pro." + ).arg(subdir))); + } +} + /* Verify that all tests are listed somewhere in one of the autotest .pro files */ void tst_MakeTestSelfTest::tests_pro_files() { @@ -82,6 +128,8 @@ void tst_MakeTestSelfTest::tests_pro_files() } } + + QFAIL(qPrintable(QString( "Subdir `%1' is missing from tests/auto/*.pro\n" "This means the test won't be compiled or run on any platform.\n" @@ -106,5 +154,355 @@ void tst_MakeTestSelfTest::tests_pro_files_data() } } +QString format_list(QStringList const& list) +{ + if (list.count() == 1) { + return list.at(0); + } + return QString("one of (%1)").arg(list.join(", ")); +} + +void tst_MakeTestSelfTest::naming_convention() +{ + QFETCH(QString, subdir); + QFETCH(QString, target); + + QDir dir(SRCDIR "/../" + subdir); + + QStringList cppfiles = dir.entryList(QStringList() << "*.h" << "*.cpp"); + if (cppfiles.isEmpty()) { + // Common convention is to have test/test.pro and source files in parent dir + if (dir.dirName() == "test") { + dir.cdUp(); + cppfiles = dir.entryList(QStringList() << "*.h" << "*.cpp"); + } + + if (cppfiles.isEmpty()) { + QSKIP("Couldn't locate source files for test", SkipSingle); + } + } + + QStringList possible_test_classes; + foreach (QString const& file, cppfiles) { + possible_test_classes << find_test_class(dir.path() + "/" + file); + } + + if (possible_test_classes.isEmpty()) { + QSKIP(qPrintable(QString("Couldn't locate test class in %1").arg(format_list(cppfiles))), SkipSingle); + } + + QVERIFY2(possible_test_classes.contains(target), qPrintable(QString( + "TARGET is %1, while test class appears to be %2.\n" + "TARGET and test class _must_ match so that all testcase names can be accurately " + "determined even if a test fails to compile or run.") + .arg(target) + .arg(format_list(possible_test_classes)) + )); + + QVERIFY2(!all_test_classes.contains(target), qPrintable(QString( + "It looks like there are multiple tests named %1.\n" + "This makes it impossible to separate results for these tests.\n" + "Please ensure all tests are uniquely named.") + .arg(target) + )); + + all_test_classes << target; +} + +void tst_MakeTestSelfTest::naming_convention_data() +{ + QTest::addColumn<QString>("subdir"); + QTest::addColumn<QString>("target"); + + foreach (const QString& subdir, find_subdirs(SRCDIR "/../auto.pro", Recursive)) { + if (QFileInfo(SRCDIR "/../" + subdir).isDir()) { + QString target; + if (looks_like_testcase(SRCDIR "/../" + subdir + "/" + QFileInfo(subdir).baseName() + ".pro", &target)) { + QTest::newRow(qPrintable(subdir)) << subdir << target.toLower(); + } + } + } +} + +/* + Returns true if a .pro file seems to be for an autotest. + Running qmake to figure this out takes too long. +*/ +bool looks_like_testcase(QString const& pro_file, QString* target) +{ + QFile file(pro_file); + if (!file.open(QIODevice::ReadOnly)) { + return false; + } + + *target = QString(); + + bool loaded_qttest = false; + + do { + QByteArray line = file.readLine(); + if (line.isEmpty()) { + break; + } + + line = line.trimmed(); + line.replace(' ', ""); + + if (line == "load(qttest_p4)") { + loaded_qttest = true; + } + + if (line.startsWith("TARGET=")) { + *target = QString::fromLatin1(line.mid(sizeof("TARGET=")-1)); + if (target->contains('/')) { + *target = target->right(target->lastIndexOf('/')+1); + } + } + + if (loaded_qttest && !target->isEmpty()) { + break; + } + } while(1); + + if (!loaded_qttest) { + return false; + } + + if (!target->isEmpty() && !target->startsWith("tst_")) { + return false; + } + + // If no target was set, default to tst_<dirname> + if (target->isEmpty()) { + *target = "tst_" + QFileInfo(pro_file).baseName(); + } + + return true; +} + +/* + Returns true if a .pro file seems to be a subdirs project. + Running qmake to figure this out takes too long. +*/ +bool looks_like_subdirs(QString const& pro_file) +{ + QFile file(pro_file); + if (!file.open(QIODevice::ReadOnly)) { + return false; + } + + do { + QByteArray line = file.readLine(); + if (line.isEmpty()) { + break; + } + + line = line.trimmed(); + line.replace(' ', ""); + + if (line == "TEMPLATE=subdirs") { + return true; + } + } while(1); + + return false; +} + +/* + Returns a list of all subdirs in a given .pro file +*/ +QStringList tst_MakeTestSelfTest::find_subdirs(QString const& pro_file, FindSubdirsMode mode, QString const& prefix) +{ + QStringList out; + + QByteArray features = qgetenv("QMAKEFEATURES"); + + if (features.isEmpty()) { + features = SRCDIR "/features"; + } + else { + features.prepend(SRCDIR "/features" +#ifdef Q_OS_WIN32 + ";" +#else + ":" +#endif + ); + } + + QStringList args; + args << pro_file << "-o" << SRCDIR "/dummy_output" << "CONFIG+=dump_subdirs"; + + /* Turn on every option there is, to ensure we process every single directory */ + args + << "QT_CONFIG+=dbus" + << "QT_CONFIG+=declarative" + << "QT_CONFIG+=egl" + << "QT_CONFIG+=multimedia" + << "QT_CONFIG+=OdfWriter" + << "QT_CONFIG+=opengl" + << "QT_CONFIG+=openvg" + << "QT_CONFIG+=phonon" + << "QT_CONFIG+=private_tests" + << "QT_CONFIG+=pulseaudio" + << "QT_CONFIG+=qt3support" + << "QT_CONFIG+=script" + << "QT_CONFIG+=svg" + << "QT_CONFIG+=webkit" + << "QT_CONFIG+=xmlpatterns" + << "CONFIG+=mac" + << "CONFIG+=embedded" + << "CONFIG+=symbian" + ; + + + + QString cmd_with_args = QString("qmake %1").arg(args.join(" ")); + + QProcess proc; + + proc.setProcessChannelMode(QProcess::MergedChannels); + + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + env.insert("QMAKEFEATURES", features); + proc.setProcessEnvironment(env); + + proc.start("qmake", args); + if (!proc.waitForStarted(10000)) { + QTest::qFail(qPrintable(QString("Failed to run qmake: %1\nCommand: %2") + .arg(proc.errorString()) + .arg(cmd_with_args)), + __FILE__, __LINE__ + ); + return out; + } + if (!proc.waitForFinished(30000)) { + QTest::qFail(qPrintable(QString("qmake did not finish within 30 seconds\nCommand: %1\nOutput: %2") + .arg(proc.errorString()) + .arg(cmd_with_args) + .arg(QString::fromLocal8Bit(proc.readAll()))), + __FILE__, __LINE__ + ); + return out; + } + + if (proc.exitStatus() != QProcess::NormalExit) { + QTest::qFail(qPrintable(QString("qmake crashed\nCommand: %1\nOutput: %2") + .arg(cmd_with_args) + .arg(QString::fromLocal8Bit(proc.readAll()))), + __FILE__, __LINE__ + ); + return out; + } + + if (proc.exitCode() != 0) { + QTest::qFail(qPrintable(QString("qmake exited with code %1\nCommand: %2\nOutput: %3") + .arg(proc.exitCode()) + .arg(cmd_with_args) + .arg(QString::fromLocal8Bit(proc.readAll()))), + __FILE__, __LINE__ + ); + return out; + } + + QList<QByteArray> lines = proc.readAll().split('\n'); + if (!lines.count()) { + QTest::qFail(qPrintable(QString("qmake seems to have not output anything\nCommand: %1\n") + .arg(cmd_with_args)), + __FILE__, __LINE__ + ); + return out; + } + + foreach (QByteArray const& line, lines) { + static const QByteArray marker = "Project MESSAGE: subdir: "; + if (line.startsWith(marker)) { + QString subdir = QString::fromLocal8Bit(line.mid(marker.size()).trimmed()); + out << prefix + subdir; + + if (mode == Flat) { + continue; + } + + // Need full path to subdir + QString subdir_filepath = subdir; + subdir_filepath.prepend(QFileInfo(pro_file).path() + "/"); + + // Add subdirs recursively + if (subdir.endsWith(".pro") && looks_like_subdirs(subdir_filepath)) { + // Need full path to .pro file + out << find_subdirs(subdir_filepath, mode, prefix); + } + + if (QFileInfo(subdir_filepath).isDir()) { + subdir_filepath += "/" + subdir + ".pro"; + if (looks_like_subdirs(subdir_filepath)) { + out << find_subdirs(subdir_filepath, mode, prefix + subdir + "/"); + } + } + } + } + + return out; +} + +QStringList find_test_class(QString const& filename) +{ + QStringList out; + + QFile file(filename); + if (!file.open(QIODevice::ReadOnly)) { + return out; + } + + static char const* klass_indicators[] = { + "QTEST_MAIN(", + "QTEST_APPLESS_MAIN(", + "class", + "staticconstcharklass[]=\"", /* hax0r tests which define their own metaobject */ + 0 + }; + + do { + QByteArray line = file.readLine(); + if (line.isEmpty()) { + break; + } + + line = line.trimmed(); + line.replace(' ', ""); + + for (int i = 0; klass_indicators[i]; ++i) { + char const* prefix = klass_indicators[i]; + if (!line.startsWith(prefix)) { + continue; + } + QByteArray klass = line.mid(strlen(prefix)); + if (!klass.startsWith("tst_")) { + continue; + } + for (int j = 0; j < klass.size(); ++j) { + char c = klass[j]; + if (c == '_' + || (c >= '0' && c <= '9') + || (c >= 'A' && c <= 'Z') + || (c >= 'a' && c <= 'z')) { + continue; + } + else { + klass.truncate(j); + break; + } + } + QString klass_str = QString::fromLocal8Bit(klass).toLower(); + if (!out.contains(klass_str)) + out << klass_str; + break; + } + } while(1); + + return out; +} + QTEST_MAIN(tst_MakeTestSelfTest) #include "tst_maketestselftest.moc" diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index fad4845..30c2721 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -484,6 +484,7 @@ private slots: void singleFunctionKeywordSignalAndSlot(); void templateGtGt(); void qprivateslots(); + void qprivateproperties(); void inlineSlotsWithThrowDeclaration(); void warnOnPropertyWithoutREAD(); void constructors(); @@ -1071,6 +1072,56 @@ void tst_Moc::qprivateslots() QVERIFY(mobj->indexOfMethod("method1()") != -1); //tast204730 } +class PrivatePropertyTest : public QObject +{ + Q_OBJECT + Q_PROPERTY(int foo READ foo WRITE setFoo); + Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar); + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop); + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz); + class MyDPointer { + public: + MyDPointer() : mBar(0), mPlop(0) {} + int bar() { return mBar ; } + void setBar(int value) { mBar = value; } + int plop() { return mPlop ; } + void setPlop(int value) { mPlop = value; } + int baz() { return mBaz ; } + void setBaz(int value) { mBaz = value; } + private: + int mBar; + int mPlop; + int mBaz; + }; +public: + PrivatePropertyTest() : mFoo(0), d (new MyDPointer) {} + int foo() { return mFoo ; } + void setFoo(int value) { mFoo = value; } + MyDPointer *d_func() {return d;} +private: + int mFoo; + MyDPointer *d; +}; + + +void tst_Moc::qprivateproperties() +{ + PrivatePropertyTest test; + + test.setProperty("foo", 1); + QCOMPARE(test.property("foo"), qVariantFromValue(1)); + + test.setProperty("bar", 2); + QCOMPARE(test.property("bar"), qVariantFromValue(2)); + + test.setProperty("plop", 3); + QCOMPARE(test.property("plop"), qVariantFromValue(3)); + + test.setProperty("baz", 4); + QCOMPARE(test.property("baz"), qVariantFromValue(4)); + +} + #include "task189996.h" void InlineSlotsWithThrowDeclaration::c() throw() {} 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/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 133cb33..e5a332a 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3923,9 +3923,8 @@ void tst_QAccessibility::comboBoxTest() acc = QAccessible::queryAccessibleInterface(cb); - QRect accRect = acc->rect(0); for (int i = 1; i < acc->childCount(); ++i) { - QVERIFY(accRect.contains(acc->rect(i))); + QTRY_VERIFY(acc->rect(0).contains(acc->rect(i))); } QCOMPARE(acc->doAction(QAccessible::Press, 2), true); QTest::qWait(400); 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 <QtMultimedia/qmetadatacontrol.h> -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<QDeclarativeAudio::Error>(); } -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<QByteArray>("propertyName"); QTest::addColumn<QtMultimedia::MetaData>("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 <QtMultimedia/qvideosurfaceformat.h> -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<QDeclarativeVideo::Error>(); } -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<QNonNativeFileDialog*> 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<QAction*>(&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<QComboBox*>(&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<QString>("path"); QTest::addColumn<QString>("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/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/qgl_threads/tst_openglthreading.cpp b/tests/auto/qglthreads/tst_qglthreads.cpp index cf100cb..cce3161 100644 --- a/tests/auto/qgl_threads/tst_openglthreading.cpp +++ b/tests/auto/qglthreads/tst_qglthreads.cpp @@ -43,7 +43,7 @@ #include <QtCore/QtCore> #include <QtGui/QtGui> #include <QtOpenGL/QtOpenGL> -#include "tst_openglthreading.h" +#include "tst_qglthreads.h" #ifdef Q_WS_X11 #include <private/qt_x11_p.h> @@ -51,7 +51,7 @@ #define RUNNING_TIME 5000 -tst_OpenGLThreading::tst_OpenGLThreading(QObject *parent) +tst_QGLThreads::tst_QGLThreads(QObject *parent) : QObject(parent) { } @@ -143,7 +143,7 @@ public: SwapThread *m_thread; }; -void tst_OpenGLThreading::swapInThread() +void tst_QGLThreads::swapInThread() { #ifdef Q_OS_MAC QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); @@ -249,7 +249,7 @@ private: QList <QPoint> m_positions; }; -void tst_OpenGLThreading::textureUploadInThread() +void tst_QGLThreads::textureUploadInThread() { #ifdef Q_OS_MAC QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); @@ -412,7 +412,7 @@ private: QSize m_size; }; -void tst_OpenGLThreading::renderInThread_data() +void tst_QGLThreads::renderInThread_data() { QTest::addColumn<bool>("resize"); QTest::addColumn<bool>("update"); @@ -423,7 +423,7 @@ void tst_OpenGLThreading::renderInThread_data() QTest::newRow("with-resize-and-update") << true << true; } -void tst_OpenGLThreading::renderInThread() +void tst_QGLThreads::renderInThread() { #ifdef Q_OS_MAC QSKIP("OpenGL threading tests are currently disabled on mac as they were causing reboots", SkipAll); @@ -473,8 +473,8 @@ int main(int argc, char **argv) QApplication app(argc, argv); QTEST_DISABLE_KEYPAD_NAVIGATION \ - tst_OpenGLThreading tc; + tst_QGLThreads tc; return QTest::qExec(&tc, argc, argv); } -#include "tst_openglthreading.moc" +#include "tst_qglthreads.moc" diff --git a/tests/auto/qgl_threads/tst_openglthreading.h b/tests/auto/qglthreads/tst_qglthreads.h index c4b55cd..9e97909 100644 --- a/tests/auto/qgl_threads/tst_openglthreading.h +++ b/tests/auto/qglthreads/tst_qglthreads.h @@ -39,16 +39,16 @@ ** ****************************************************************************/ -#ifndef TST_OPENGLTHREADING_H -#define TST_OPENGLTHREADING_H +#ifndef TST_QGLTHREADS_H +#define TST_QGLTHREADS_H #include <QObject> -class tst_OpenGLThreading : public QObject +class tst_QGLThreads : public QObject { Q_OBJECT public: - explicit tst_OpenGLThreading(QObject *parent = 0); + explicit tst_QGLThreads(QObject *parent = 0); private slots: void swapInThread(); @@ -58,4 +58,4 @@ private slots: void renderInThread(); }; -#endif // TST_OPENGLTHREADING_H +#endif // TST_QGLTHREADS_H diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index d37ff76..a155222 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -284,6 +284,7 @@ private slots: void task250680_childClip(); void taskQTBUG_5904_crashWithDeviceCoordinateCache(); void taskQT657_paintIntoCacheWithTransparentParts(); + void taskQTBUG_7863_paintIntoCacheWithTransparentParts(); }; void tst_QGraphicsScene::initTestCase() @@ -4349,12 +4350,14 @@ void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() { + // Test using DeviceCoordinateCache and opaque item QWidget *w = new QWidget(); - w->setPalette(Qt::blue); + w->setPalette(QColor(0, 0, 255)); w->setGeometry(0, 0, 50, 50); QGraphicsScene *scene = new QGraphicsScene(); - QGraphicsView *view = new QGraphicsView(scene); + CustomView *view = new CustomView; + view->setScene(scene); QGraphicsProxyWidget *proxy = scene->addWidget(w); proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); @@ -4362,13 +4365,14 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() view->show(); QTest::qWaitForWindowShown(view); - w->update(10,10,10,10); + view->repaints = 0; + proxy->update(10, 10, 10, 10); QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); QPixmap pix; QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(proxy); - QPixmapCache::Key key = itemp->extraItemCache()->deviceData.value(view->viewport()).key; - QVERIFY(QPixmapCache::find(key, &pix)); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->deviceData.value(view->viewport()).key, &pix)); QTransform t = proxy->sceneTransform(); // Map from scene coordinates to pixmap coordinates. @@ -4383,6 +4387,138 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() for(int j = 0; j < im.height(); j++) QCOMPARE(qAlpha(im.pixel(i, j)), 255); } + + delete w; +} + +void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() +{ + // Test using DeviceCoordinateCache and semi-transparent item + { + QGraphicsRectItem *backItem = new QGraphicsRectItem(0, 0, 100, 100); + backItem->setBrush(QColor(255, 255, 0)); + QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 50, 50); + rectItem->setBrush(QColor(0, 0, 255, 125)); + rectItem->setParentItem(backItem); + + QGraphicsScene *scene = new QGraphicsScene(); + CustomView *view = new CustomView; + view->setScene(scene); + + scene->addItem(backItem); + rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + backItem->rotate(15); + + view->show(); + QTest::qWaitForWindowShown(view); + view->repaints = 0; + rectItem->update(10, 10, 10, 10); + QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); + + QPixmap pix; + QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->deviceData.value(view->viewport()).key, &pix)); + + QTransform t = rectItem->sceneTransform(); + // Map from scene coordinates to pixmap coordinates. + // X origin in the pixmap is the most-left point + // of the item's boundingRect in the scene. + qreal adjust = t.mapRect(rectItem->boundingRect().toRect()).left(); + QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1); + QPixmap subpix = pix.copy(rect); + + QImage im = subpix.toImage(); + for(int i = 0; i < im.width(); i++) { + for(int j = 0; j < im.height(); j++) { + QCOMPARE(qAlpha(im.pixel(i, j)), 125); + } + } + + delete view; + } + + // Test using ItemCoordinateCache and opaque item + { + QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 50, 50); + rectItem->setBrush(QColor(0, 0, 255)); + + QGraphicsScene *scene = new QGraphicsScene(); + CustomView *view = new CustomView; + view->setScene(scene); + + scene->addItem(rectItem); + rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); + rectItem->rotate(15); + + view->show(); + QTest::qWaitForWindowShown(view); + view->repaints = 0; + rectItem->update(10, 10, 10, 10); + QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); + + QPixmap pix; + QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->key, &pix)); + + QTransform t = rectItem->sceneTransform(); + // Map from scene coordinates to pixmap coordinates. + // X origin in the pixmap is the most-left point + // of the item's boundingRect in the scene. + qreal adjust = t.mapRect(rectItem->boundingRect().toRect()).left(); + QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1); + QPixmap subpix = pix.copy(rect); + + QImage im = subpix.toImage(); + for(int i = 0; i < im.width(); i++) { + for(int j = 0; j < im.height(); j++) + QCOMPARE(qAlpha(im.pixel(i, j)), 255); + } + + delete view; + } + + // Test using ItemCoordinateCache and semi-transparent item + { + QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 50, 50); + rectItem->setBrush(QColor(0, 0, 255, 125)); + + QGraphicsScene *scene = new QGraphicsScene(); + CustomView *view = new CustomView; + view->setScene(scene); + + scene->addItem(rectItem); + rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); + rectItem->rotate(15); + + view->show(); + QTest::qWaitForWindowShown(view); + view->repaints = 0; + rectItem->update(10, 10, 10, 10); + QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); + + QPixmap pix; + QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->key, &pix)); + + QTransform t = rectItem->sceneTransform(); + // Map from scene coordinates to pixmap coordinates. + // X origin in the pixmap is the most-left point + // of the item's boundingRect in the scene. + qreal adjust = t.mapRect(rectItem->boundingRect().toRect()).left(); + QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1); + QPixmap subpix = pix.copy(rect); + + QImage im = subpix.toImage(); + for(int i = 0; i < im.width(); i++) { + for(int j = 0; j < im.height(); j++) + QCOMPARE(qAlpha(im.pixel(i, j)), 125); + } + + delete view; + } } QTEST_MAIN(tst_QGraphicsScene) diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 6941d23..587b7d5 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -462,7 +462,7 @@ void tst_QGraphicsWidget::focusWidget() QFETCH(int, childWithFocus); SubQGraphicsWidget *widget = children[childWithFocus]; widget->setFocus(); - QVERIFY(widget->hasFocus()); + QTRY_VERIFY(widget->hasFocus()); QCOMPARE(parent->focusWidget(), static_cast<QGraphicsWidget*>(widget)); } } @@ -479,23 +479,23 @@ void tst_QGraphicsWidget::focusWidget2() scene.addItem(widget); - QVERIFY(!widget->hasFocus()); + QTRY_VERIFY(!widget->hasFocus()); widget->setFocusPolicy(Qt::StrongFocus); - QVERIFY(!widget->hasFocus()); + QTRY_VERIFY(!widget->hasFocus()); QGraphicsWidget *subWidget = new QGraphicsWidget(widget); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); scene.setFocus(); - QVERIFY(!widget->hasFocus()); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!widget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); widget->setFocus(); - QVERIFY(widget->hasFocus()); - QCOMPARE(focusInSpy.count(), 1); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(widget->hasFocus()); + QTRY_COMPARE(focusInSpy.count(), 1); + QTRY_VERIFY(!subWidget->hasFocus()); QGraphicsWidget *otherSubWidget = new QGraphicsWidget; EventSpy otherFocusInSpy(otherSubWidget, QEvent::FocusIn); @@ -504,18 +504,18 @@ void tst_QGraphicsWidget::focusWidget2() otherSubWidget->setFocusPolicy(Qt::StrongFocus); otherSubWidget->setParentItem(widget); - QVERIFY(widget->hasFocus()); + QTRY_VERIFY(widget->hasFocus()); QCOMPARE(scene.focusItem(), (QGraphicsItem *)widget); - QVERIFY(!subWidget->hasFocus()); - QVERIFY(!otherSubWidget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!otherSubWidget->hasFocus()); widget->hide(); - QVERIFY(!widget->hasFocus()); // lose but still has subfocus + QTRY_VERIFY(!widget->hasFocus()); // lose but still has subfocus QCOMPARE(focusInSpy.count(), 1); QCOMPARE(focusOutSpy.count(), 1); widget->show(); - QVERIFY(!widget->hasFocus()); // no regain + QTRY_VERIFY(!widget->hasFocus()); // no regain QCOMPARE(focusInSpy.count(), 1); QCOMPARE(focusOutSpy.count(), 1); @@ -523,24 +523,24 @@ void tst_QGraphicsWidget::focusWidget2() // try to setup subFocus on item that can't take focus subWidget->setFocus(); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); QVERIFY(!scene.focusItem()); // but isn't the scene's focus item // try to setup subFocus on item that can take focus otherSubWidget->setFocus(); - QVERIFY(!otherSubWidget->hasFocus()); + QTRY_VERIFY(!otherSubWidget->hasFocus()); QCOMPARE(widget->focusWidget(), otherSubWidget); QVERIFY(!scene.focusItem()); // but isn't the scene's focus item widget->show(); - QCOMPARE(scene.focusItem(), (QGraphicsItem *)otherSubWidget); // but isn't the scene's focus item + QTRY_COMPARE(scene.focusItem(), (QGraphicsItem *)otherSubWidget); // but isn't the scene's focus item QCOMPARE(otherFocusInSpy.count(), 1); QCOMPARE(otherFocusOutSpy.count(), 0); delete otherSubWidget; - QCOMPARE(otherFocusOutSpy.count(), 1); + QTRY_COMPARE(otherFocusOutSpy.count(), 1); QVERIFY(!scene.focusItem()); QVERIFY(!widget->focusWidget()); } @@ -579,16 +579,16 @@ void tst_QGraphicsWidget::focusPolicy() SubQGraphicsWidget *widget = new SubQGraphicsWidget; scene.addItem(widget); - QCOMPARE(Qt::NoFocus, widget->focusPolicy()); + QTRY_COMPARE(Qt::NoFocus, widget->focusPolicy()); QFETCH(Qt::FocusPolicy, focusPolicy1); widget->setFocusPolicy(focusPolicy1); - QCOMPARE(widget->focusPolicy(), focusPolicy1); + QTRY_COMPARE(widget->focusPolicy(), focusPolicy1); bool isFocusable = widget->flags() & QGraphicsItem::ItemIsFocusable; bool wasFocusable = isFocusable; - QVERIFY(isFocusable == (focusPolicy1 != Qt::NoFocus)); + QTRY_VERIFY(isFocusable == (focusPolicy1 != Qt::NoFocus)); widget->setFocus(); - QCOMPARE(widget->hasFocus(), isFocusable); + QTRY_COMPARE(widget->hasFocus(), isFocusable); QFETCH(Qt::FocusPolicy, focusPolicy2); widget->setFocusPolicy(focusPolicy2); @@ -691,25 +691,21 @@ void tst_QGraphicsWidget::fontChangedEvent() EventSpy rootSpyFont(root, QEvent::FontChange); EventSpy rootSpyPolish(root, QEvent::Polish); - QCOMPARE(rootSpyFont.count(), 0); - QApplication::processEvents(); //The polish event is sent - QCOMPARE(rootSpyPolish.count(), 1); - QApplication::processEvents(); //Process events to see if we get the font change event + QTRY_COMPARE(rootSpyFont.count(), 0); + QTRY_COMPARE(rootSpyPolish.count(), 1); //The font is still the same so no fontChangeEvent - QCOMPARE(rootSpyFont.count(), 0); + QTRY_COMPARE(rootSpyFont.count(), 0); QFont font; font.setPointSize(43); root->setFont(font); - QApplication::processEvents(); //Process events to get the font change event //The font changed - QCOMPARE(rootSpyFont.count(), 1); + QTRY_COMPARE(rootSpyFont.count(), 1); //then roll back to the default one. root->setFont(appFont); - QApplication::processEvents(); //Process events to get the font change event //The font changed - QCOMPARE(rootSpyFont.count(), 2); + QTRY_COMPARE(rootSpyFont.count(), 2); } void tst_QGraphicsWidget::fontPropagationWidgetItemWidget() @@ -770,11 +766,13 @@ void tst_QGraphicsWidget::geometry() { SubQGraphicsWidget widget; QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - + QSignalSpy spy(&widget, SIGNAL(geometryChanged())); QFETCH(QPointF, pos); QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); + if (!size.isNull()) + QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } @@ -843,7 +841,6 @@ void tst_QGraphicsWidget::initStyleOption() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); view.setAlignment(Qt::AlignTop | Qt::AlignLeft); @@ -868,7 +865,6 @@ void tst_QGraphicsWidget::initStyleOption() view.resize(300, 300); view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(20); sendMouseMove(view.viewport(), view.mapFromScene(widget->mapToScene(widget->boundingRect().center()))); } @@ -921,9 +917,7 @@ void tst_QGraphicsWidget::layout() } widget.setLayout(layout); - QTest::qWait(25); - - QCOMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout)); + QTRY_COMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout)); for (int i = 0; i < children.count(); ++i) { SubQGraphicsWidget *item = children[i]; QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); @@ -963,10 +957,9 @@ void tst_QGraphicsWidget::layoutDirection() view->show(); QTest::qWaitForWindowShown(view); for (int i = 0; i < children.count(); ++i) { - QCOMPARE(children[i]->layoutDirection(), layoutDirection); - QCOMPARE(children[i]->testAttribute(Qt::WA_SetLayoutDirection), false); + QTRY_COMPARE(children[i]->layoutDirection(), layoutDirection); + QTRY_COMPARE(children[i]->testAttribute(Qt::WA_SetLayoutDirection), false); view->repaint(); - QApplication::processEvents(); QTRY_COMPARE(children[i]->m_painterLayoutDirection, layoutDirection); } delete view; @@ -1179,7 +1172,6 @@ void tst_QGraphicsWidget::setTabOrder() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); QGraphicsWidget *lastItem = 0; @@ -1200,7 +1192,6 @@ void tst_QGraphicsWidget::setTabOrder() if (!children.isEmpty()) { QGraphicsWidget *first = children.first(); view.viewport()->setFocus(); - QApplication::processEvents(); QTRY_VERIFY(view.viewport()->hasFocus()); first->setFocus(); QVERIFY(first->hasFocus()); @@ -1461,18 +1452,14 @@ void tst_QGraphicsWidget::verifyFocusChain() QTest::qWaitForWindowShown(window); lineEdit->setFocus(); - QTest::qWait(25); QTRY_VERIFY(lineEdit->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_2->hasFocus()); // remove the tabFocusFirst and insert new item delete w1_1; // calls _q_removeItemLater - QTest::qWait(25); SubQGraphicsWidget *w1_3 = new SubQGraphicsWidget; w1_3->setFocusPolicy(Qt::StrongFocus); w1_3->setData(0, "w1_3"); @@ -1480,14 +1467,11 @@ void tst_QGraphicsWidget::verifyFocusChain() scene.addItem(w1_3); QTRY_VERIFY(w1_2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(25); QTRY_VERIFY(lineEdit->hasFocus()); // tabFocusFirst should now point to w1_2 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_3->hasFocus()); scene.removeItem(w1_2); // does not call _q_removeItemLater delete w1_2; // calls _q_removeItemLater @@ -1498,16 +1482,12 @@ void tst_QGraphicsWidget::verifyFocusChain() w1_4->setGeometry(75,0,25, 25); scene.addItem(w1_4); QTRY_VERIFY(w1_3->hasFocus()); - QTest::qWait(25); QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4)); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(25); QTRY_VERIFY(lineEdit->hasFocus()); // tabFocusFirst should now point to w1_3 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_3->hasFocus()); - QTest::qWait(25); QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4)); delete window; } @@ -1522,7 +1502,6 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); // delete item in focus chain with no focus and verify chain @@ -1756,31 +1735,29 @@ void tst_QGraphicsWidget::setSizes() widget->setPreferredSize(pref); widget->setMaximumSize(max); - QApplication::processEvents(); - for (i = 0; i < compareInstructions.count(); ++i) { Inst input = compareInstructions.at(i); switch (input.first) { case MinimumSize: - QCOMPARE(widget->minimumSize(), input.second.toSizeF()); + QTRY_COMPARE(widget->minimumSize(), input.second.toSizeF()); break; case PreferredSize: - QCOMPARE(widget->preferredSize(), input.second.toSizeF()); + QTRY_COMPARE(widget->preferredSize(), input.second.toSizeF()); break; case MaximumSize: - QCOMPARE(widget->maximumSize(), input.second.toSizeF()); + QTRY_COMPARE(widget->maximumSize(), input.second.toSizeF()); break; case Size: - QCOMPARE(widget->size(), input.second.toSizeF()); + QTRY_COMPARE(widget->size(), input.second.toSizeF()); break; case MinimumWidth: - QCOMPARE(widget->minimumWidth(), qreal(input.second.toDouble())); + QTRY_COMPARE(widget->minimumWidth(), qreal(input.second.toDouble())); break; case PreferredWidth: - QCOMPARE(widget->preferredWidth(), qreal(input.second.toDouble())); + QTRY_COMPARE(widget->preferredWidth(), qreal(input.second.toDouble())); break; case MaximumWidth: - QCOMPARE(widget->maximumWidth(), qreal(input.second.toDouble())); + QTRY_COMPARE(widget->maximumWidth(), qreal(input.second.toDouble())); break; default: qWarning("instruction not implemented"); @@ -1835,14 +1812,13 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTest::qWait(100); - QVERIFY(!scene.itemAt(25, 25)); + QTRY_VERIFY(!scene.itemAt(25, 25)); widget->setGeometry(0, 112, 360, 528); - QCOMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); widget2->setGeometry(0, 573, 360, 67); - QCOMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); - QCOMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2); + QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2); } void tst_QGraphicsWidget::defaultSize() @@ -1857,7 +1833,6 @@ void tst_QGraphicsWidget::defaultSize() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTest::qWait(50); QSizeF initialSize = widget->size(); widget->resize(initialSize); @@ -1867,9 +1842,8 @@ void tst_QGraphicsWidget::defaultSize() widget->setPreferredSize(60, 60); widget->setMaximumSize(110, 110); widget->setVisible(true); - QTest::qWait(50); // should still have its size set to initialsize - QCOMPARE(widget->geometry().size(), initialSize); + QTRY_COMPARE(widget->geometry().size(), initialSize); } @@ -2391,7 +2365,6 @@ void tst_QGraphicsWidget::painterStateProtectionOnWindowFrame() scene.addItem(widget); view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(500); } class ProxyStyle : public QCommonStyle @@ -2480,7 +2453,6 @@ void tst_QGraphicsWidget::task250119_shortcutContext() view.setScene(&scene); view.show(); QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); @@ -2735,9 +2707,7 @@ void tst_QGraphicsWidget::respectHFW() QTest::qWaitForWindowShown(view); { // here we go - simulate a interactive resize of the window - QTest::qWait(100); QTest::mouseMove(view, view->mapFromScene(71, 71)); // bottom right corner - QTest::qWait(100); QTest::mousePress(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(71, 71), 200); view->grabMouse(); @@ -2751,10 +2721,9 @@ void tst_QGraphicsWidget::respectHFW() QApplication::sendEvent(view->viewport(), &e); view->releaseMouse(); } - QTest::qWait(100); const QSizeF winSize = window->size(); qreal minHFW = window->effectiveSizeHint(Qt::MinimumSize, QSizeF(winSize.width(), -1)).height(); - QVERIFY(qAbs(minHFW - winSize.height()) < 1); + QTRY_VERIFY(qAbs(minHFW - winSize.height()) < 1); #endif } @@ -2806,7 +2775,7 @@ void tst_QGraphicsWidget::addChildInpolishEvent() view.resize(200, 200); view.show(); QTest::qWaitForWindowShown(&view); - QCOMPARE(PolishWidget::numberOfPolish, 2); + QTRY_COMPARE(PolishWidget::numberOfPolish, 2); } void tst_QGraphicsWidget::polishEvent() @@ -2853,10 +2822,8 @@ void tst_QGraphicsWidget::polishEvent2() widget->events.clear(); - QApplication::processEvents(); - // Make sure the item got polish event. - QVERIFY(widget->events.contains(QEvent::Polish)); + QTRY_VERIFY(widget->events.contains(QEvent::Polish)); } void tst_QGraphicsWidget::autoFillBackground() @@ -2902,11 +2869,9 @@ void tst_QGraphicsWidget::initialShow() view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(100); scene.addItem(widget); - QTest::qWait(100); - QCOMPARE(widget->repaints, 1); + QTRY_COMPARE(widget->repaints, 1); } void tst_QGraphicsWidget::initialShow2() @@ -2935,7 +2900,6 @@ void tst_QGraphicsWidget::initialShow2() const int expectedRepaintCount = paintSpy.count(); delete dummyView; dummyView = 0; - QTest::qWait(200); MyGraphicsWidget *widget = new MyGraphicsWidget; widget->resize(100, 100); @@ -2948,7 +2912,7 @@ void tst_QGraphicsWidget::initialShow2() view.show(); QTest::qWaitForWindowShown(&view); - QCOMPARE(widget->repaints, expectedRepaintCount); + QTRY_COMPARE(widget->repaints, expectedRepaintCount); } void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro index 30eb5f0..e0028e5 100644 --- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro +++ b/tests/auto/qnetworkconfigurationmanager/qnetworkconfigurationmanager.pro @@ -1,5 +1,5 @@ load(qttest_p4) -SOURCES += tst_qnetworkconfigmanager.cpp +SOURCES += tst_qnetworkconfigurationmanager.cpp HEADERS += ../qbearertestcommon.h QT = core network diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp index 3052330..8b68006 100644 --- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp +++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp @@ -332,4 +332,4 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier() QTEST_MAIN(tst_QNetworkConfigurationManager) -#include "tst_qnetworkconfigmanager.moc" +#include "tst_qnetworkconfigurationmanager.moc" diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index e11900e..4922a89 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -205,6 +205,10 @@ private Q_SLOTS: #endif void ioGetFromHttpBrokenServer_data(); void ioGetFromHttpBrokenServer(); + void ioGetFromHttpStatus100_data(); + void ioGetFromHttpStatus100(); + void ioGetFromHttpNoHeaders_data(); + void ioGetFromHttpNoHeaders(); void ioGetFromHttpWithCache_data(); void ioGetFromHttpWithCache(); @@ -2159,6 +2163,60 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer() QVERIFY(reply->error() != QNetworkReply::NoError); } +void tst_QNetworkReply::ioGetFromHttpStatus100_data() +{ + QTest::addColumn<QByteArray>("dataToSend"); + QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n"); + QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n"); + QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); +} + +void tst_QNetworkReply::ioGetFromHttpStatus100() +{ + QFETCH(QByteArray, dataToSend); + MiniHttpServer server(dataToSend); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), request.url()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); + QVERIFY(reply->rawHeader("bla").isNull()); +} + +void tst_QNetworkReply::ioGetFromHttpNoHeaders_data() +{ + QTest::addColumn<QByteArray>("dataToSend"); + QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n"); +} + +void tst_QNetworkReply::ioGetFromHttpNoHeaders() +{ + QFETCH(QByteArray, dataToSend); + MiniHttpServer server(dataToSend); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), request.url()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); +} + void tst_QNetworkReply::ioGetFromHttpWithCache_data() { qRegisterMetaType<MyMemoryCache::CachedContent>(); diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index fb0f3e0..d2d86fb 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -75,6 +75,8 @@ private slots: void loopCount(); void autoAdd(); void pauseResume(); + + void QTBUG8910_crashWhenRemovingUncontrolledAnimation(); }; tst_QParallelAnimationGroup::tst_QParallelAnimationGroup() @@ -999,9 +1001,22 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(spy.count(), 2); //this shouldn't have changed group.resume(); QCOMPARE(spy.count(), 2); //this shouldn't have changed +} - +void tst_QParallelAnimationGroup::QTBUG8910_crashWhenRemovingUncontrolledAnimation() +{ + QParallelAnimationGroup group; + TestAnimation *anim = new TestAnimation; + anim->setLoopCount(-1); + TestAnimation *anim2 = new TestAnimation; + anim2->setLoopCount(-1); + group.addAnimation(anim); + group.addAnimation(anim2); + group.start(); + delete anim; + // it would crash here because the internals of the group would still have a reference to anim + delete anim2; } diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index aca33ce..b4dbe73 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -98,7 +98,12 @@ public: NotCallable, CallableReturnsSum, CallableReturnsArgument, - CallableReturnsInvalidVariant + CallableReturnsInvalidVariant, + CallableReturnsGlobalObject, + CallableReturnsThisObject, + CallableReturnsCallee, + CallableReturnsArgumentsObject, + CallableInitializesThisObject }; TestClass(QScriptEngine *engine); @@ -348,7 +353,7 @@ QVariant TestClass::extension(Extension extension, qsreal sum = 0; for (int i = 0; i < ctx->argumentCount(); ++i) sum += ctx->argument(i).toNumber(); - QScriptValueIterator it(ctx->thisObject()); + QScriptValueIterator it(ctx->callee()); while (it.hasNext()) { it.next(); sum += it.value().toNumber(); @@ -358,6 +363,17 @@ QVariant TestClass::extension(Extension extension, return qVariantFromValue(ctx->argument(0)); } else if (m_callableMode == CallableReturnsInvalidVariant) { return QVariant(); + } else if (m_callableMode == CallableReturnsGlobalObject) { + return qVariantFromValue(engine()->globalObject()); + } else if (m_callableMode == CallableReturnsThisObject) { + return qVariantFromValue(ctx->thisObject()); + } else if (m_callableMode == CallableReturnsCallee) { + return qVariantFromValue(ctx->callee()); + } else if (m_callableMode == CallableReturnsArgumentsObject) { + return qVariantFromValue(ctx->argumentsObject()); + } else if (m_callableMode == CallableInitializesThisObject) { + engine()->newQObject(ctx->thisObject(), engine()); + return QVariant(); } } else if (extension == HasInstance) { Q_ASSERT(m_hasInstance); @@ -797,9 +813,11 @@ void tst_QScriptClass::extension() QVERIFY(cls.supportsExtension(QScriptClass::Callable)); QScriptValue obj = eng.newObject(&cls); + eng.globalObject().setProperty("obj", obj); obj.setProperty("one", QScriptValue(&eng, 1)); obj.setProperty("two", QScriptValue(&eng, 2)); obj.setProperty("three", QScriptValue(&eng, 3)); + // From C++ cls.clearReceivedArgs(); { QScriptValueList args; @@ -810,8 +828,18 @@ void tst_QScriptClass::extension() QVERIFY(ret.isNumber()); QCOMPARE(ret.toNumber(), qsreal(15)); } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("obj(4, 5)"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toNumber(), qsreal(15)); + } cls.setCallableMode(TestClass::CallableReturnsArgument); + // From C++ cls.clearReceivedArgs(); { QScriptValue ret = obj.call(obj, QScriptValueList() << 123); @@ -843,6 +871,13 @@ void tst_QScriptClass::extension() QScriptValue ret = obj.call(obj, QScriptValueList() << QScriptValue()); QVERIFY(ret.isUndefined()); } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("obj(123)"); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 123); + } cls.setCallableMode(TestClass::CallableReturnsInvalidVariant); { @@ -850,13 +885,92 @@ void tst_QScriptClass::extension() QVERIFY(ret.isUndefined()); } + cls.setCallableMode(TestClass::CallableReturnsThisObject); + // From C++ + { + QScriptValue ret = obj.call(obj); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj()"); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + + cls.setCallableMode(TestClass::CallableReturnsCallee); + // From C++ + { + QScriptValue ret = obj.call(); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj()"); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + + cls.setCallableMode(TestClass::CallableReturnsArgumentsObject); + // From C++ + { + QScriptValue ret = obj.call(obj, QScriptValueList() << 123); + QVERIFY(ret.isObject()); + QVERIFY(ret.property("length").isNumber()); + QCOMPARE(ret.property("length").toInt32(), 1); + QVERIFY(ret.property(0).isNumber()); + QCOMPARE(ret.property(0).toInt32(), 123); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj(123)"); + QVERIFY(ret.isObject()); + QVERIFY(ret.property("length").isNumber()); + QCOMPARE(ret.property("length").toInt32(), 1); + QVERIFY(ret.property(0).isNumber()); + QCOMPARE(ret.property(0).toInt32(), 123); + } + // construct() + // From C++ cls.clearReceivedArgs(); + cls.setCallableMode(TestClass::CallableReturnsGlobalObject); { QScriptValue ret = obj.construct(); QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("new obj()"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + // From C++ + cls.clearReceivedArgs(); + cls.setCallableMode(TestClass::CallableInitializesThisObject); + { + QScriptValue ret = obj.construct(); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject*)&eng); + } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("new obj()"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject*)&eng); } } // HasInstance diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index d9beb45..e71d7c3 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -150,6 +150,7 @@ private slots: void getSetAgent(); void reentrancy(); void incDecNonObjectProperty(); + void installTranslatorFunctions_data(); void installTranslatorFunctions(); void functionScopes(); void nativeFunctionScopes(); @@ -4119,22 +4120,46 @@ void tst_QScriptEngine:: incDecNonObjectProperty() } } +void tst_QScriptEngine::installTranslatorFunctions_data() +{ + QTest::addColumn<bool>("useCustomGlobalObject"); + + QTest::newRow("Default global object") << false; + QTest::newRow("Custom global object") << true; +} + void tst_QScriptEngine::installTranslatorFunctions() { + QFETCH(bool, useCustomGlobalObject); + QScriptEngine eng; - QScriptValue global = eng.globalObject(); + QScriptValue globalOrig = eng.globalObject(); + QScriptValue global; + if (useCustomGlobalObject) { + global = eng.newObject(); + eng.setGlobalObject(global); + } else { + global = globalOrig; + } QVERIFY(!global.property("qsTranslate").isValid()); QVERIFY(!global.property("QT_TRANSLATE_NOOP").isValid()); QVERIFY(!global.property("qsTr").isValid()); QVERIFY(!global.property("QT_TR_NOOP").isValid()); - QVERIFY(!global.property("String").property("prototype").property("arg").isValid()); + QVERIFY(!globalOrig.property("String").property("prototype").property("arg").isValid()); eng.installTranslatorFunctions(); QVERIFY(global.property("qsTranslate").isFunction()); QVERIFY(global.property("QT_TRANSLATE_NOOP").isFunction()); QVERIFY(global.property("qsTr").isFunction()); QVERIFY(global.property("QT_TR_NOOP").isFunction()); - QVERIFY(global.property("String").property("prototype").property("arg").isFunction()); + QVERIFY(globalOrig.property("String").property("prototype").property("arg").isFunction()); + + if (useCustomGlobalObject) { + QVERIFY(!globalOrig.property("qsTranslate").isValid()); + QVERIFY(!globalOrig.property("QT_TRANSLATE_NOOP").isValid()); + QVERIFY(!globalOrig.property("qsTr").isValid()); + QVERIFY(!globalOrig.property("QT_TR_NOOP").isValid()); + } { QScriptValue ret = eng.evaluate("qsTr('foo')"); diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 5b79340..dc369aa 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2573,6 +2573,10 @@ void tst_QScriptValue::call() // call with something else as arguments QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); + // call with a non-array object as arguments + QScriptValue ret6 = fun.call(QScriptValue(), eng.globalObject()); + QVERIFY(ret6.isError()); + QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array")); } // calling things that are not functions @@ -2705,6 +2709,10 @@ void tst_QScriptValue::construct() // construct with something else as arguments QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); + // construct with a non-array object as arguments + QScriptValue ret6 = fun.construct(eng.globalObject()); + QVERIFY(ret6.isError()); + QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array")); } // construct on things that are not functions 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<void> 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<int>); Q_DECLARE_METATYPE(QList<double>); Q_DECLARE_METATYPE(QList<QString>); -class tst_map: public QObject +class tst_QtConcurrentMap: public QObject { Q_OBJECT private slots: @@ -114,7 +114,7 @@ public: Q_DECLARE_METATYPE(QList<Number>); -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<int> list; list << 1 << 2 << 3; @@ -790,7 +790,7 @@ void tst_map::mapped() } } -void tst_map::blocking_mapped() +void tst_QtConcurrentMap::blocking_mapped() { QList<int> list; list << 1 << 2 << 3; @@ -1244,7 +1244,7 @@ public: } }; -void tst_map::mappedReduced() +void tst_QtConcurrentMap::mappedReduced() { QList<int> 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<int> 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<int> startList = QList<int>() << 0 << 1 << 2; QList<int> list = QtConcurrent::blockingMapped(startList, sleeper); @@ -2077,7 +2077,7 @@ public: Q_DECLARE_METATYPE(QVector<MemFnTester>); Q_DECLARE_METATYPE(QList<MemFnTester>); -void tst_map::functionOverloads() +void tst_QtConcurrentMap::functionOverloads() { QList<int> intList; const QList<int> 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<int> 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<int> l = QList<int>() << 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<void> future = run(F(light)); @@ -100,7 +100,7 @@ void TestRunFunction::runLightFunction() qDebug("done"); } -void TestRunFunction::runHeavyFunction() +void tst_QtConcurrentRun::runHeavyFunction() { qDebug("starting function"); QFuture<void> future = run(F(heavy)); @@ -141,7 +141,7 @@ public: int operator()(int in) const { return in; } }; -void TestRunFunction::returnValue() +void tst_QtConcurrentRun::returnValue() { QFuture<int> f; @@ -217,7 +217,7 @@ struct TestConstClass void fooInt(int) const { }; }; -void TestRunFunction::functionObject() +void tst_QtConcurrentRun::functionObject() { QFuture<void> 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<QString> 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<int> 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 <QtGui/qvector3d.h> #include <QtGui/qvector4d.h> -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<qreal>("x"); QTest::addColumn<qreal>("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<qreal>("x"); QTest::addColumn<qreal>("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<qreal>("x"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); // Point on plane QTest::addColumn<qreal>("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<qreal>("x1"); // Point on line QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<qreal>("x1"); QTest::addColumn<qreal>("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<QVector4D>() == 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 |