summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-03-08 12:01:25 +0100
committerJoão Abecasis <joao.abecasis@nokia.com>2012-03-08 12:02:41 +0100
commit79f2480c868523a7d8ffc9fb15055e8eab3237ba (patch)
tree8336143e8c09810dc97324970fed61af27e26a97 /tests
parent7e4f32993498db0e06346e32458a1ec7d0c7b3ec (diff)
parent12f221410fbe41d0b2efda4cd3289dfcf9044aa8 (diff)
Merge remote-tracking branch 'origin/api_changes' into containters
Conflicts: src/corelib/kernel/qmetaobject.cpp src/corelib/kernel/qvariant.cpp src/tools/moc/moc.h Change-Id: I2cd3d95b41d2636738c6b98064864941e3b0b4e6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp45
-rw-r--r--tests/auto/corelib/global/qflags/tst_qflags.cpp9
-rw-r--r--tests/auto/corelib/global/qlogging/test/test.pro3
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp9
-rw-r--r--tests/auto/corelib/io/qsettings/qsettings.pro2
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp20
-rw-r--r--tests/auto/corelib/json/test.bjsonbin60992 -> 60992 bytes
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp16
-rw-r--r--tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp2
-rw-r--r--tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp189
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp15
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro2
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp9
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro2
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp4
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro2
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp161
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h10
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp4
-rw-r--r--tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro3
-rw-r--r--tests/auto/corelib/tools/qlocale/test/test.pro4
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp4
-rw-r--r--tests/auto/corelib/tools/qpair/qpair.pro4
-rw-r--r--tests/auto/corelib/tools/qpair/tst_qpair.cpp105
-rw-r--r--tests/auto/corelib/tools/qregexp/tst_qregexp.cpp290
-rw-r--r--tests/auto/corelib/tools/qregularexpression/.gitignore2
-rw-r--r--tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro7
-rw-r--r--tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp64
-rw-r--r--tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro7
-rw-r--r--tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp52
-rw-r--r--tests/auto/corelib/tools/qregularexpression/qregularexpression.pro3
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp1198
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h77
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp11
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp3
-rw-r--r--tests/auto/corelib/tools/tools.pro2
-rw-r--r--tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp24
-rw-r--r--tests/auto/gui/image/image.pro1
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp4
-rw-r--r--tests/auto/gui/image/qpixmap/qpixmap.pro2
-rw-r--r--tests/auto/gui/image/qvolatileimage/qvolatileimage.pro6
-rw-r--r--tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp206
-rw-r--r--tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp77
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp13
-rw-r--r--tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp2
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp3
-rw-r--r--tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp12
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp58
-rw-r--r--tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp6
-rw-r--r--tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp2
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp40
-rw-r--r--tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp72
-rw-r--r--tests/auto/other/compiler/tst_compiler.cpp10
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp2
-rw-r--r--tests/auto/other/headersclean/headersclean.pri38
-rw-r--r--tests/auto/other/headersclean/headersclean.pro28
-rw-r--r--tests/auto/other/headersclean/qt_headersclean_headers.h70
-rw-r--r--tests/auto/other/headersclean/tst_headersclean.cpp36
-rw-r--r--tests/auto/other/headersclean/tst_headersclean.h61
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp2
-rw-r--r--tests/auto/other/other.pro3
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp1
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp118
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp11
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp87
-rw-r--r--tests/auto/testlib/selftests/alive/qtestalive.cpp2
-rw-r--r--tests/auto/testlib/selftests/counting/tst_counting.cpp1
-rw-r--r--tests/auto/testlib/selftests/expected_counting.lightxml32
-rw-r--r--tests/auto/testlib/selftests/expected_counting.txt32
-rw-r--r--tests/auto/testlib/selftests/expected_counting.xml32
-rw-r--r--tests/auto/testlib/selftests/expected_fatal.txt6
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.lightxml150
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.txt69
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.xml153
-rw-r--r--tests/auto/testlib/selftests/expected_verbose1.xunitxml64
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.lightxml222
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.txt105
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.xml225
-rw-r--r--tests/auto/testlib/selftests/expected_verbose2.xunitxml101
-rw-r--r--tests/auto/testlib/selftests/selftests.pri2
-rw-r--r--tests/auto/testlib/selftests/selftests.qrc17
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp10
-rw-r--r--tests/auto/testlib/selftests/verbose1/verbose1.pro10
-rw-r--r--tests/auto/testlib/selftests/verbose2/verbose2.pro10
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp152
-rw-r--r--tests/auto/tools/qmake/testcompiler.cpp25
-rw-r--r--tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri1
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro2
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp90
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp75
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp3
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp3
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp3
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp7
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp11
-rw-r--r--tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp13
-rw-r--r--tests/auto/widgets/widgets/qcalendarwidget/qcalendarwidget.pro3
-rw-r--r--tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp2
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp2
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp5
-rw-r--r--tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp6
-rw-r--r--tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp21
-rw-r--r--tests/benchmarks/corelib/tools/containers-associative/main.cpp8
-rw-r--r--tests/benchmarks/corelib/tools/containers-sequential/main.cpp16
-rw-r--r--tests/benchmarks/corelib/tools/qhash/main.cpp105
-rw-r--r--tests/benchmarks/corelib/tools/qhash/main.h8
-rw-r--r--tests/benchmarks/corelib/tools/qhash/outofline.cpp48
-rw-r--r--tests/benchmarks/dbus/qdbustype/main.cpp2
-rw-r--r--tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp2
-rw-r--r--tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h2
-rw-r--r--tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp6
-rw-r--r--tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp4
-rw-r--r--tests/manual/qcursor/allcursors/allcursors.pro2
-rw-r--r--tests/manual/qcursor/allcursors/main.cpp2
-rw-r--r--tests/manual/qcursor/allcursors/mainwindow.h2
-rw-r--r--tests/manual/qcursor/grab_override/grab_override.pro2
-rw-r--r--tests/manual/qcursor/grab_override/main.cpp2
-rw-r--r--tests/manual/qcursor/grab_override/mainwindow.h2
120 files changed, 4328 insertions, 896 deletions
diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
index 534dec8160..05d1569988 100644
--- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -123,6 +123,7 @@ private slots:
void deletedInUpdateCurrentTime();
void totalDuration();
void zeroLoopCount();
+ void recursiveAnimations();
};
void tst_QPropertyAnimation::initTestCase()
@@ -1237,5 +1238,49 @@ void tst_QPropertyAnimation::zeroLoopCount()
QCOMPARE(finishedSpy.count(), 0);
}
+
+class RecursiveObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal x READ x WRITE setX)
+ Q_PROPERTY(qreal y READ y WRITE setY)
+public:
+ RecursiveObject() : m_x(0), m_y(0) {
+ animation.setTargetObject(this);
+ animation.setPropertyName("y");
+ animation.setDuration(30);
+ }
+ qreal x() const { return m_x; }
+ void setX(qreal x) {
+ m_x = x;
+ animation.setEndValue(x);
+ animation.start();
+ }
+ qreal y() const { return m_y; }
+ void setY(qreal y) { m_y = y; }
+
+ qreal m_x;
+ qreal m_y;
+ QPropertyAnimation animation;
+};
+
+
+void tst_QPropertyAnimation::recursiveAnimations()
+{
+ RecursiveObject o;
+ QPropertyAnimation anim;
+ anim.setTargetObject(&o);
+ anim.setPropertyName("x");
+ anim.setDuration(30);
+
+ anim.setEndValue(4000);
+ anim.start();
+ QTest::qWait(anim.duration() + o.animation.duration());
+ QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped);
+ QTRY_COMPARE(o.animation.state(), QAbstractAnimation::Stopped);
+ QCOMPARE(o.y(), qreal(4000));
+}
+
+
QTEST_MAIN(tst_QPropertyAnimation)
#include "tst_qpropertyanimation.moc"
diff --git a/tests/auto/corelib/global/qflags/tst_qflags.cpp b/tests/auto/corelib/global/qflags/tst_qflags.cpp
index d466d7b8d8..2794c174ba 100644
--- a/tests/auto/corelib/global/qflags/tst_qflags.cpp
+++ b/tests/auto/corelib/global/qflags/tst_qflags.cpp
@@ -123,6 +123,15 @@ void tst_QFlags::constExpr()
#endif
}
+// (statically) check QTypeInfo for QFlags instantiations:
+enum MyEnum { Zero, One, Two, Four=4 };
+Q_DECLARE_FLAGS( MyFlags, MyEnum );
+Q_DECLARE_OPERATORS_FOR_FLAGS( MyFlags );
+
+Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isComplex );
+Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isStatic );
+Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isLarge );
+Q_STATIC_ASSERT( !QTypeInfo<MyFlags>::isPointer );
QTEST_MAIN(tst_QFlags)
#include "tst_qflags.moc"
diff --git a/tests/auto/corelib/global/qlogging/test/test.pro b/tests/auto/corelib/global/qlogging/test/test.pro
index 6e4939ffc9..6e9b86d753 100644
--- a/tests/auto/corelib/global/qlogging/test/test.pro
+++ b/tests/auto/corelib/global/qlogging/test/test.pro
@@ -2,3 +2,6 @@ CONFIG += testcase parallel_test
TARGET = ../tst_qlogging
QT = core testlib
SOURCES = ../tst_qlogging.cpp
+
+load(testcase) # for target.path and installTestHelperApp()
+installTestHelperApp("../app/app",app,app)
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 04967d8313..b7fc366a39 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1214,7 +1214,8 @@ void tst_QDir::remove()
f.close();
QDir dir;
QVERIFY(dir.remove("remove-test"));
- QVERIFY(!dir.remove("/remove-test"));
+ // Test that the file just removed is gone
+ QVERIFY(!dir.remove("remove-test"));
QTest::ignoreMessage(QtWarningMsg, "QDir::remove: Empty or null file name");
QVERIFY(!dir.remove(""));
}
@@ -1231,8 +1232,14 @@ void tst_QDir::rename()
QVERIFY(!dir.rename("rename-test", "/etc/rename-test-renamed"));
#elif !defined(Q_OS_WIN)
// on windows this is possible - maybe make the test a bit better
+#ifdef Q_OS_UNIX
+ // not valid if run as root so skip if needed
+ if (::getuid() != 0)
+ QVERIFY(!dir.rename("rename-test", "/rename-test-renamed"));
+#else
QVERIFY(!dir.rename("rename-test", "/rename-test-renamed"));
#endif
+#endif
QTest::ignoreMessage(QtWarningMsg, "QDir::rename: Empty or null file name(s)");
QVERIFY(!dir.rename("rename-test", ""));
QTest::ignoreMessage(QtWarningMsg, "QDir::rename: Empty or null file name(s)");
diff --git a/tests/auto/corelib/io/qsettings/qsettings.pro b/tests/auto/corelib/io/qsettings/qsettings.pro
index 9de476fe13..1772f4b65f 100644
--- a/tests/auto/corelib/io/qsettings/qsettings.pro
+++ b/tests/auto/corelib/io/qsettings/qsettings.pro
@@ -5,5 +5,3 @@ SOURCES = tst_qsettings.cpp
RESOURCES += qsettings.qrc
win32-msvc*:LIBS += advapi32.lib
-
-win32: CONFIG += insignificant_test # QTBUG-24145
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index a74d817b8a..3bff330db2 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -262,9 +262,16 @@ void tst_QUrl::hashInPath()
QCOMPARE(withHashInPath.path(), QString::fromLatin1("hi#mum.txt"));
QCOMPARE(withHashInPath.toEncoded(), QByteArray("hi%23mum.txt"));
QCOMPARE(withHashInPath.toString(), QString("hi%23mum.txt"));
+ QCOMPARE(withHashInPath.toDisplayString(QUrl::PreferLocalFile), QString("hi%23mum.txt"));
QUrl fromHashInPath = QUrl::fromEncoded(withHashInPath.toEncoded());
QVERIFY(withHashInPath == fromHashInPath);
+
+ const QUrl localWithHash = QUrl::fromLocalFile("/hi#mum.txt");
+ QCOMPARE(localWithHash.path(), QString::fromLatin1("/hi#mum.txt"));
+ QCOMPARE(localWithHash.toEncoded(), QByteArray("file:///hi%23mum.txt"));
+ QCOMPARE(localWithHash.toString(), QString("file:///hi%23mum.txt"));
+ QCOMPARE(localWithHash.toDisplayString(QUrl::PreferLocalFile), QString("/hi#mum.txt"));
}
void tst_QUrl::unc()
@@ -352,6 +359,7 @@ void tst_QUrl::setUrl()
QCOMPARE(url.port(), -1);
QCOMPARE(url.toString(), QString::fromLatin1("file:///"));
QCOMPARE(url.toDisplayString(), QString::fromLatin1("file:///"));
+ QCOMPARE(url.toDisplayString(QUrl::PreferLocalFile), QString::fromLatin1("/"));
}
{
@@ -367,6 +375,7 @@ void tst_QUrl::setUrl()
QCOMPARE(url.port(), 80);
QCOMPARE(url.toString(), QString::fromLatin1("http://www.foo.bar:80"));
QCOMPARE(url.toDisplayString(), QString::fromLatin1("http://www.foo.bar:80"));
+ QCOMPARE(url.toDisplayString(QUrl::PreferLocalFile), QString::fromLatin1("http://www.foo.bar:80"));
QUrl url2("//www1.foo.bar");
QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("http://www1.foo.bar"));
@@ -451,15 +460,7 @@ void tst_QUrl::setUrl()
QUrl url = u1;
QVERIFY(url.isValid());
QCOMPARE(url.toString(), QString::fromLatin1("file:///home/dfaure/my#myref"));
- QCOMPARE(url.fragment(), QString::fromLatin1("myref"));
- }
-
- {
- QString u1 = "file:/home/dfaure/my#myref";
- QUrl url = u1;
- QVERIFY(url.isValid());
-
- QCOMPARE(url.toString(), QString::fromLatin1("file:///home/dfaure/my#myref"));
+ QCOMPARE(url.toString(QUrl::PreferLocalFile), QString::fromLatin1("file:///home/dfaure/my#myref"));
QCOMPARE(url.fragment(), QString::fromLatin1("myref"));
}
@@ -1001,6 +1002,7 @@ void tst_QUrl::toLocalFile()
QUrl url(theUrl);
QCOMPARE(url.toLocalFile(), theFile);
+ QCOMPARE(url.isLocalFile(), !theFile.isEmpty());
}
void tst_QUrl::fromLocalFile_data()
diff --git a/tests/auto/corelib/json/test.bjson b/tests/auto/corelib/json/test.bjson
index aa412eec67..9a0515f3ef 100644
--- a/tests/auto/corelib/json/test.bjson
+++ b/tests/auto/corelib/json/test.bjson
Binary files differ
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index f5b4f17732..f35831c900 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -115,6 +115,8 @@ private Q_SLOTS:
void testCompaction();
void testDebugStream();
void testCompactionError();
+
+ void parseUnicodeEscapes();
private:
QString testDataDir;
};
@@ -1758,5 +1760,19 @@ void TestQtJson::testCompactionError()
}
}
+void TestQtJson::parseUnicodeEscapes()
+{
+ const QByteArray json = "[ \"A\\u00e4\\u00C4\" ]";
+
+ QJsonDocument doc = QJsonDocument::fromJson(json);
+ QJsonArray array = doc.array();
+
+ QString result = QLatin1String("A");
+ result += QChar(0xe4);
+ result += QChar(0xc4);
+
+ QCOMPARE(array.first().toString(), result);
+}
+
QTEST_MAIN(TestQtJson)
#include "tst_qtjson.moc"
diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
index e2144134d9..61484c1736 100644
--- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
+++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp
@@ -132,7 +132,7 @@ public:
class StartStopEvent: public QEvent
{
public:
- StartStopEvent(int type, QEventLoop *loop = 0)
+ explicit StartStopEvent(int type, QEventLoop *loop = 0)
: QEvent(Type(type)), el(loop)
{ }
diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
index 4f283cef90..84d28c7959 100644
--- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -100,12 +100,29 @@ private slots:
struct Foo { int i; };
+
+class CustomQObject : public QObject
+{
+ Q_OBJECT
+public:
+ CustomQObject(QObject *parent = 0)
+ : QObject(parent)
+ {
+ }
+};
+
+class CustomNonQObject {};
+
void tst_QMetaType::defined()
{
QCOMPARE(int(QMetaTypeId2<QString>::Defined), 1);
QCOMPARE(int(QMetaTypeId2<Foo>::Defined), 0);
QCOMPARE(int(QMetaTypeId2<void*>::Defined), 1);
QCOMPARE(int(QMetaTypeId2<int*>::Defined), 0);
+ QVERIFY(QMetaTypeId2<CustomQObject*>::Defined);
+ QVERIFY(!QMetaTypeId2<CustomQObject>::Defined);
+ QVERIFY(!QMetaTypeId2<CustomNonQObject>::Defined);
+ QVERIFY(!QMetaTypeId2<CustomNonQObject*>::Defined);
}
struct Bar
@@ -685,6 +702,36 @@ public:
};
Q_DECLARE_METATYPE(CustomMultiInheritanceObject*);
+class C { char _[4]; };
+class M { char _[4]; };
+class P { char _[4]; };
+
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(M, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(P, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
+
+// avoid the comma:
+typedef QPair<C,C> QPairCC;
+typedef QPair<C,M> QPairCM;
+typedef QPair<C,P> QPairCP;
+typedef QPair<M,C> QPairMC;
+typedef QPair<M,M> QPairMM;
+typedef QPair<M,P> QPairMP;
+typedef QPair<P,C> QPairPC;
+typedef QPair<P,M> QPairPM;
+typedef QPair<P,P> QPairPP;
+
+Q_DECLARE_METATYPE(QPairCC)
+Q_DECLARE_METATYPE(QPairCM)
+Q_DECLARE_METATYPE(QPairCP)
+Q_DECLARE_METATYPE(QPairMC)
+Q_DECLARE_METATYPE(QPairMM)
+Q_DECLARE_METATYPE(QPairMP)
+Q_DECLARE_METATYPE(QPairPC)
+Q_DECLARE_METATYPE(QPairPM)
+Q_DECLARE_METATYPE(QPairPP)
+
void tst_QMetaType::flags_data()
{
QTest::addColumn<int>("type");
@@ -703,6 +750,15 @@ QT_FOR_EACH_STATIC_CORE_POINTER(ADD_METATYPE_TEST_ROW)
QTest::newRow("CustomMovable") << ::qMetaTypeId<CustomMovable>() << true << true << false;
QTest::newRow("CustomObject*") << ::qMetaTypeId<CustomObject*>() << true << false << true;
QTest::newRow("CustomMultiInheritanceObject*") << ::qMetaTypeId<CustomMultiInheritanceObject*>() << true << false << true;
+ QTest::newRow("QPair<C,C>") << ::qMetaTypeId<QPair<C,C> >() << false << true << false;
+ QTest::newRow("QPair<C,M>") << ::qMetaTypeId<QPair<C,M> >() << false << true << false;
+ QTest::newRow("QPair<C,P>") << ::qMetaTypeId<QPair<C,P> >() << false << true << false;
+ QTest::newRow("QPair<M,C>") << ::qMetaTypeId<QPair<M,C> >() << false << true << false;
+ QTest::newRow("QPair<M,M>") << ::qMetaTypeId<QPair<M,M> >() << true << true << false;
+ QTest::newRow("QPair<M,P>") << ::qMetaTypeId<QPair<M,P> >() << true << true << false;
+ QTest::newRow("QPair<P,C>") << ::qMetaTypeId<QPair<P,C> >() << false << true << false;
+ QTest::newRow("QPair<P,M>") << ::qMetaTypeId<QPair<P,M> >() << true << true << false;
+ QTest::newRow("QPair<P,P>") << ::qMetaTypeId<QPair<P,P> >() << true << false << false;
}
void tst_QMetaType::flags()
@@ -1018,6 +1074,61 @@ void tst_QMetaType::registerStreamBuiltin()
Q_DECLARE_METATYPE(QSharedPointer<QObject>)
+typedef QHash<int, uint> IntUIntHash;
+Q_DECLARE_METATYPE(IntUIntHash)
+typedef QMap<int, uint> IntUIntMap;
+Q_DECLARE_METATYPE(IntUIntMap)
+typedef QPair<int, uint> IntUIntPair;
+Q_DECLARE_METATYPE(IntUIntPair)
+
+struct CustomComparable
+{
+ CustomComparable(int i_ = 0) :i(i_) { }
+ bool operator==(const CustomComparable &other) const
+ {
+ return i == other.i;
+ }
+ int i;
+};
+
+struct UnregisteredType {};
+
+typedef QHash<int, CustomComparable> IntComparableHash;
+Q_DECLARE_METATYPE(IntComparableHash)
+typedef QMap<int, CustomComparable> IntComparableMap;
+Q_DECLARE_METATYPE(IntComparableMap)
+typedef QPair<int, CustomComparable> IntComparablePair;
+Q_DECLARE_METATYPE(IntComparablePair)
+
+typedef QHash<int, int> IntIntHash;
+typedef int NaturalNumber;
+class AutoMetaTypeObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(IntIntHash someHash READ someHash CONSTANT)
+ Q_PROPERTY(NaturalNumber someInt READ someInt CONSTANT)
+public:
+ AutoMetaTypeObject(QObject *parent = 0)
+ : QObject(parent), m_int(42)
+ {
+ m_hash.insert(4, 2);
+ }
+
+ QHash<int,int> someHash() const
+ {
+ return m_hash;
+ }
+
+ int someInt() const
+ {
+ return m_int;
+ }
+
+private:
+ QHash<int,int> m_hash;
+ int m_int;
+};
+
void tst_QMetaType::automaticTemplateRegistration()
{
{
@@ -1059,6 +1170,84 @@ void tst_QMetaType::automaticTemplateRegistration()
vectorList << sharedPointerList;
QVERIFY(QVariant::fromValue(vectorList).value<QVector<QList<QSharedPointer<QObject> > > >().first().first() == testObject);
}
+ {
+ IntIntHash intIntHash;
+ intIntHash.insert(4, 2);
+ QCOMPARE(QVariant::fromValue(intIntHash).value<IntIntHash>().value(4), 2);
+
+ AutoMetaTypeObject amto;
+
+ qRegisterMetaType<QHash<int, int> >("IntIntHash");
+ QVariant hashVariant = amto.property("someHash");
+ QCOMPARE(hashVariant.value<IntIntHash>().value(4), 2);
+
+ qRegisterMetaType<int>("NaturalNumber");
+ QVariant intVariant = amto.property("someInt");
+ QCOMPARE(intVariant.value<NaturalNumber>(), 42);
+ }
+ {
+ IntUIntHash intUIntHash;
+ intUIntHash.insert(4, 2);
+ QCOMPARE(QVariant::fromValue(intUIntHash).value<IntUIntHash>().value(4), (uint)2);
+ }
+ {
+ IntComparableHash intComparableHash;
+ CustomComparable m;
+ intComparableHash.insert(4, m);
+ QCOMPARE(QVariant::fromValue(intComparableHash).value<IntComparableHash>().value(4), m);
+ }
+ {
+ QVariantHash variantHash;
+ variantHash.insert(QStringLiteral("4"), 2);
+ QCOMPARE(QVariant::fromValue(variantHash).value<QVariantHash>().value(QStringLiteral("4")), QVariant(2));
+ }
+ {
+ typedef QMap<int, int> IntIntMap;
+ IntIntMap intIntMap;
+ intIntMap.insert(4, 2);
+ QCOMPARE(QVariant::fromValue(intIntMap).value<IntIntMap>().value(4), 2);
+ }
+ {
+ IntUIntMap intUIntMap;
+ intUIntMap.insert(4, 2);
+ QCOMPARE(QVariant::fromValue(intUIntMap).value<IntUIntMap>().value(4), (uint)2);
+ }
+ {
+ IntComparableMap intComparableMap;
+ CustomComparable m;
+ intComparableMap.insert(4, m);
+ QCOMPARE(QVariant::fromValue(intComparableMap).value<IntComparableMap>().value(4), m);
+ }
+ {
+ QVariantMap variantMap;
+ variantMap.insert(QStringLiteral("4"), 2);
+ QCOMPARE(QVariant::fromValue(variantMap).value<QVariantMap>().value(QStringLiteral("4")), QVariant(2));
+ }
+ {
+ typedef QPair<int, int> IntIntPair;
+ IntIntPair intIntPair = qMakePair(4, 2);
+ QCOMPARE(QVariant::fromValue(intIntPair).value<IntIntPair>().first, 4);
+ QCOMPARE(QVariant::fromValue(intIntPair).value<IntIntPair>().second, 2);
+ }
+ {
+ IntUIntPair intUIntPair = qMakePair<int, uint>(4, 2);
+ QCOMPARE(QVariant::fromValue(intUIntPair).value<IntUIntPair>().first, 4);
+ QCOMPARE(QVariant::fromValue(intUIntPair).value<IntUIntPair>().second, (uint)2);
+ }
+ {
+ CustomComparable m;
+ IntComparablePair intComparablePair = qMakePair(4, m);
+ QCOMPARE(QVariant::fromValue(intComparablePair).value<IntComparablePair>().first, 4);
+ QCOMPARE(QVariant::fromValue(intComparablePair).value<IntComparablePair>().second, m);
+ }
+ {
+ typedef QHash<int, UnregisteredType> IntUnregisteredTypeHash;
+ QVERIFY(qRegisterMetaType<IntUnregisteredTypeHash>("IntUnregisteredTypeHash") > 0);
+ }
+ {
+ typedef QList<UnregisteredType> UnregisteredTypeList;
+ QVERIFY(qRegisterMetaType<UnregisteredTypeList>("UnregisteredTypeList") > 0);
+ }
}
// Compile-time test, it should be possible to register function pointer types
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index ffe1d2bec4..c48a384e58 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -2541,9 +2541,24 @@ public:
};
Q_DECLARE_METATYPE(CustomQObjectDerived*)
+class CustomQObjectDerivedNoMetaType : public CustomQObject {
+ Q_OBJECT
+public:
+ CustomQObjectDerivedNoMetaType(QObject *parent = 0) : CustomQObject(parent) {}
+};
+
void tst_QVariant::qvariant_cast_QObject_derived()
{
{
+ CustomQObjectDerivedNoMetaType *object = new CustomQObjectDerivedNoMetaType(this);
+ QVariant data = QVariant::fromValue(object);
+ QVERIFY(data.userType() == qMetaTypeId<CustomQObjectDerivedNoMetaType*>());
+ QCOMPARE(data.value<QObject *>(), object);
+ QCOMPARE(data.value<CustomQObjectDerivedNoMetaType *>(), object);
+ QCOMPARE(data.value<CustomQObject *>(), object);
+ QVERIFY(data.value<CustomQWidget*>() == 0);
+ }
+ {
CustomQObjectDerived *object = new CustomQObjectDerived(this);
QVariant data = QVariant::fromValue(object);
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
index 815401ce1e..ba68167a6f 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
@@ -7,6 +7,6 @@ QT = core testlib concurrent
SOURCES = tst_qmimedatabase-cache.cpp
HEADERS = ../tst_qmimedatabase.h
-DEFINES += SRCDIR='"\\"$$PWD/../\\""'
+DEFINES += CORE_SOURCES='"\\"$$QT.core.sources\\""'
*-g++*:QMAKE_CXXFLAGS += -W -Wall -Wextra -Werror -Wshadow -Wno-long-long -Wnon-virtual-dtor
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp
index 205331d4dd..5ef04dc01d 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/tst_qmimedatabase-cache.cpp
@@ -47,10 +47,9 @@
#include "../tst_qmimedatabase.cpp"
-tst_QMimeDatabase::tst_QMimeDatabase()
+void tst_QMimeDatabase::init()
{
- QDir here = QDir::currentPath();
- const QString tempMime = here.absolutePath() + QString::fromLatin1("/mime");
- runUpdateMimeDatabase(tempMime);
- QVERIFY(QFile::exists(tempMime + QString::fromLatin1("/mime.cache")));
+ const QString mimeDirName = m_globalXdgDir + QStringLiteral("/mime");
+ runUpdateMimeDatabase(mimeDirName);
+ QVERIFY(QFile::exists(mimeDirName + QStringLiteral("/mime.cache")));
}
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
index ac7515f781..4c00e84fc1 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
@@ -9,6 +9,6 @@ CONFIG += depend_includepath
SOURCES += tst_qmimedatabase-xml.cpp
HEADERS += ../tst_qmimedatabase.h
-DEFINES += SRCDIR='"\\"$$PWD/../\\""'
+DEFINES += CORE_SOURCES='"\\"$$QT.core.sources\\""'
*-g++*:QMAKE_CXXFLAGS += -W -Wall -Wextra -Werror -Wshadow -Wno-long-long -Wnon-virtual-dtor
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp
index 13ca372290..30c7677198 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/tst_qmimedatabase-xml.cpp
@@ -40,10 +40,8 @@
****************************************************************************/
#include "../tst_qmimedatabase.h"
-#include <QDebug>
-#include <QDir>
-tst_QMimeDatabase::tst_QMimeDatabase()
+void tst_QMimeDatabase::init()
{
qputenv("QT_NO_MIME_CACHE", "1");
}
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro
index 876b4377dd..1ff5546e5c 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = qmimedatabase-xml
-unix: SUBDIRS += qmimedatabase-cache
+unix:!mac: SUBDIRS += qmimedatabase-cache
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 858f977a72..9076f37c7c 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -44,49 +44,85 @@
#include "qstandardpaths.h"
#include <QtCore/QFile>
+#include <QtCore/QFileInfo>
+#include <QtCore/QTextStream>
#include <QtConcurrent/QtConcurrentRun>
#include <QtConcurrent/QFuture>
#include <QtTest/QtTest>
+static const char yastFileName[] ="yast2-metapackage-handler-mimetypes.xml";
+
void initializeLang()
{
qputenv("LC_ALL", "");
qputenv("LANG", "en_US");
+ QCoreApplication::setApplicationName("tst_qmimedatabase"); // temporary directory pattern
+}
+
+static inline QString testSuiteWarning()
+{
+
+ QString result;
+ QTextStream str(&result);
+ str << "\nCannot find the shared-mime-info test suite\nstarting from: "
+ << QDir::toNativeSeparators(QDir::currentPath()) << "\n"
+ "cd " << QDir::toNativeSeparators(QStringLiteral("tests/auto/corelib/mimetypes/qmimedatabase")) << "\n"
+ "wget http://cgit.freedesktop.org/xdg/shared-mime-info/snapshot/Release-1-0.zip\n"
+ "unzip Release-1-0.zip\n";
+#ifdef Q_OS_WIN
+ str << "mkdir testfiles\nxcopy /s Release-1-0\\tests testfiles\n";
+#else
+ str << "ln -s Release-1-0/tests testfiles\n";
+#endif
+ return result;
}
// Set LANG before QCoreApplication is created
Q_CONSTRUCTOR_FUNCTION(initializeLang)
+tst_QMimeDatabase::tst_QMimeDatabase()
+{
+}
+
void tst_QMimeDatabase::initTestCase()
{
+ QVERIFY(m_temporaryDir.isValid());
+
// Create a "global" and a "local" XDG data dir, right here.
// The local dir will be empty initially, while the global dir will contain a copy of freedesktop.org.xml
- QDir here = QDir::currentPath();
+ const QDir here = QDir(m_temporaryDir.path());
- qputenv("XDG_DATA_DIRS", QFile::encodeName(here.absolutePath()));
- QDir(here.absolutePath() + "/mime").removeRecursively();
- here.mkpath(QString::fromLatin1("mime/packages"));
+ m_globalXdgDir = m_temporaryDir.path() + QStringLiteral("/global");
+ m_localXdgDir = m_temporaryDir.path() + QStringLiteral("/local");
- QFile xml(QFile::decodeName(SRCDIR "../../../src/mimetypes/mime/packages/freedesktop.org.xml"));
- const QString mimeDir = here.absolutePath() + QLatin1String("/mime");
- xml.copy(mimeDir + QLatin1String("/packages/freedesktop.org.xml"));
+ const QString globalPackageDir = m_globalXdgDir + QStringLiteral("/mime/packages");
+ QVERIFY(here.mkpath(globalPackageDir) && here.mkpath(m_localXdgDir));
- m_dataHome = here.absolutePath() + QLatin1String("/../datahome");
- qputenv("XDG_DATA_HOME", QFile::encodeName(m_dataHome));
- //qDebug() << "XDG_DATA_HOME=" << m_dataHome;
+ qputenv("XDG_DATA_DIRS", QFile::encodeName(m_globalXdgDir));
+ qputenv("XDG_DATA_HOME", QFile::encodeName(m_localXdgDir));
+ qDebug() << "\nLocal XDG_DATA_HOME: " << m_localXdgDir
+ << "\nGlobal XDG_DATA_DIRS: " << m_globalXdgDir;
- // Make sure we start clean
- cleanupTestCase();
-}
+ const QString freeDesktopXml = QStringLiteral("freedesktop.org.xml");
+ const QString xmlFileName = QLatin1String(CORE_SOURCES)
+ + QStringLiteral("/mimetypes/mime/packages/")
+ + freeDesktopXml;
+ QVERIFY2(QFileInfo(xmlFileName).exists(), qPrintable(xmlFileName + QStringLiteral(" does not exist")));
+ QFile xml(xmlFileName);
+ QVERIFY(xml.copy(globalPackageDir + '/' + freeDesktopXml));
-void tst_QMimeDatabase::cleanupTestCase()
-{
- QDir here = QDir::currentPath();
- here.remove(QString::fromLatin1("mime/packages/yast2-metapackage-handler-mimetypes.xml"));
+ m_testSuite = QFINDTESTDATA("testfiles");
+ if (m_testSuite.isEmpty())
+ qWarning("%s", qPrintable(testSuiteWarning()));
+
+ m_yastMimeTypes = QFINDTESTDATA(yastFileName);
+ QVERIFY2(!m_yastMimeTypes.isEmpty(),
+ qPrintable(QString::fromLatin1("Cannot find '%1' starting from '%2'").
+ arg(yastFileName, QDir::currentPath())));
- QDir(m_dataHome).removeRecursively();
+ init();
}
void tst_QMimeDatabase::mimeTypeForName()
@@ -171,6 +207,20 @@ void tst_QMimeDatabase::mimeTypeForFileName_data()
QTest::newRow("directory") << "/" << "inode/directory";
QTest::newRow("doesn't exist, no extension") << "IDontExist" << "application/octet-stream";
QTest::newRow("doesn't exist but has known extension") << "IDontExist.txt" << "text/plain";
+ QTest::newRow("empty") << "" << "application/octet-stream";
+}
+
+static inline QByteArray msgMimeTypeForFileNameFailed(const QList<QMimeType> &actual,
+ const QString &expected)
+{
+ QByteArray result = "Actual (";
+ foreach (const QMimeType &m, actual) {
+ result += m.name().toLocal8Bit();
+ result += ' ';
+ }
+ result += ") , expected: ";
+ result += expected.toLocal8Bit();
+ return result;
}
void tst_QMimeDatabase::mimeTypeForFileName()
@@ -186,8 +236,8 @@ void tst_QMimeDatabase::mimeTypeForFileName()
if (expectedMimeType == "application/octet-stream") {
QVERIFY(mimes.isEmpty());
} else {
- QVERIFY(!mimes.isEmpty());
- QCOMPARE(mimes.count(), 1);
+ QVERIFY2(!mimes.isEmpty(), msgMimeTypeForFileNameFailed(mimes, expectedMimeType).constData());
+ QVERIFY2(mimes.count() == 1, msgMimeTypeForFileNameFailed(mimes, expectedMimeType).constData());
QCOMPARE(mimes.first().name(), expectedMimeType);
}
}
@@ -549,20 +599,14 @@ void tst_QMimeDatabase::findByFileName_data()
QTest::addColumn<QString>("mimeTypeName");
QTest::addColumn<QString>("xFail");
- QString prefix = QLatin1String(SRCDIR "testfiles/");
-
- QFile f(prefix + QLatin1String("list"));
- if (!f.open(QIODevice::ReadOnly)) {
- const QString warning = QString::fromLatin1(
- "Please download the shared-mime-info test suite:\n"
- "cd tests/auto/corelib/mimetypes/qmimedatabase\n"
- "wget http://cgit.freedesktop.org/xdg/shared-mime-info/snapshot/Release-1-0.zip\n"
- "unzip Release-1-0.zip\n"
- "ln -s Release-1-0/tests testfiles\n"
- );
- qWarning() << warning;
+ if (m_testSuite.isEmpty())
QSKIP("shared-mime-info test suite not available.");
- }
+
+ const QString prefix = m_testSuite + QLatin1Char('/');
+ const QString fileName = prefix + QLatin1String("list");
+ QFile f(fileName);
+ QVERIFY2(f.open(QIODevice::ReadOnly|QIODevice::Text),
+ qPrintable(QString::fromLatin1("Cannot open %1: %2").arg(fileName, f.errorString())));
QByteArray line(1024, Qt::Uninitialized);
@@ -582,7 +626,9 @@ void tst_QMimeDatabase::findByFileName_data()
if (list.size() >= 3)
xFail = list.at(2);
- QTest::newRow(filePath.toLatin1().constData()) << QString(prefix + filePath) << mimeTypeType << xFail;
+ QTest::newRow(filePath.toLatin1().constData())
+ << QString(prefix + filePath)
+ << mimeTypeType << xFail;
}
}
@@ -676,6 +722,9 @@ void tst_QMimeDatabase::findByFile_data()
findByFileName_data();
}
+// Note: this test fails on "testcompress.z" when using a shared-mime-info older than 1.0.
+// This because of commit 0f9a506069c in shared-mime-info, which fixed the writing of
+// case-insensitive patterns into mime.cache.
void tst_QMimeDatabase::findByFile()
{
QFETCH(QString, filePath);
@@ -717,13 +766,21 @@ void tst_QMimeDatabase::fromThreads()
static bool runUpdateMimeDatabase(const QString &path) // TODO make it a QMimeDatabase method?
{
- const QString umd = QStandardPaths::findExecutable(QString::fromLatin1("update-mime-database"));
- if (umd.isEmpty())
+ const QString umdCommand = QString::fromLatin1("update-mime-database");
+ const QString umd = QStandardPaths::findExecutable(umdCommand);
+ if (umd.isEmpty()) {
+ qWarning("%s does not exist.", qPrintable(umdCommand));
return false;
+ }
QProcess proc;
proc.setProcessChannelMode(QProcess::MergedChannels); // silence output
- proc.start(umd, QStringList() << path);
+ proc.start(umd, QStringList(path));
+ if (!proc.waitForStarted()) {
+ qWarning("Cannot start %s: %s",
+ qPrintable(umd), qPrintable(proc.errorString()));
+ return false;
+ }
proc.waitForFinished();
//qDebug() << "runUpdateMimeDatabase" << path;
return true;
@@ -733,7 +790,7 @@ static bool waitAndRunUpdateMimeDatabase(const QString &path)
{
QFileInfo mimeCacheInfo(path + QString::fromLatin1("/mime.cache"));
if (mimeCacheInfo.exists()) {
- // Wait until the begining of the next second
+ // Wait until the beginning of the next second
while (mimeCacheInfo.lastModified().secsTo(QDateTime::currentDateTime()) == 0) {
QTest::qSleep(200);
}
@@ -767,16 +824,15 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
QMimeDatabase db;
QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
- const QString fileName = QLatin1String("yast2-metapackage-handler-mimetypes.xml");
- const QString srcFile = QFile::decodeName(SRCDIR) + fileName;
-
- QDir here = QDir::currentPath();
- const QString mimeDir = here.absolutePath() + QLatin1String("/mime");
+ const QString mimeDir = m_globalXdgDir + QLatin1String("/mime");
const QString destDir = mimeDir + QLatin1String("/packages/");
- const QString destFile = destDir + fileName;
+ const QString destFile = destDir + QLatin1String(yastFileName);
QFile::remove(destFile);
//qDebug() << destFile;
- QVERIFY(QFile::copy(srcFile, destFile));
+
+ if (!QFileInfo(destDir).isDir())
+ QVERIFY(QDir(m_globalXdgDir).mkpath(destDir));
+ QVERIFY(QFile::copy(m_yastMimeTypes, destFile));
if (!waitAndRunUpdateMimeDatabase(mimeDir))
QSKIP("shared-mime-info not found, skipping mime.cache test");
@@ -801,16 +857,17 @@ void tst_QMimeDatabase::installNewLocalMimeType()
QMimeDatabase db;
QVERIFY(!db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid());
- const QString fileName = QLatin1String("yast2-metapackage-handler-mimetypes.xml");
- const QString srcFile = QFile::decodeName(SRCDIR) + fileName;
- const QString mimeDir = m_dataHome + QLatin1String("/mime");
+ const QString mimeDir = m_localXdgDir + QLatin1String("/mime");
const QString destDir = mimeDir + QLatin1String("/packages/");
QDir().mkpath(destDir);
- const QString destFile = destDir + fileName;
+ const QString destFile = destDir + QLatin1String(yastFileName);
QFile::remove(destFile);
- QVERIFY(QFile::copy(srcFile, destFile));
- if (!runUpdateMimeDatabase(mimeDir))
- QSKIP("shared-mime-info not found, skipping mime.cache test");;
+ QVERIFY(QFile::copy(m_yastMimeTypes, destFile));
+ if (!runUpdateMimeDatabase(mimeDir)) {
+ const QString skipWarning = QStringLiteral("shared-mime-info not found, skipping mime.cache test (")
+ + QDir::toNativeSeparators(mimeDir) + QLatin1Char(')');
+ QSKIP(qPrintable(skipWarning));
+ }
QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(),
QString::fromLatin1("text/x-suse-ymu"));
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
index 869990401c..94baf77ee9 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.h
@@ -43,6 +43,7 @@
#define TST_QMIMEDATABASE_H
#include <QtCore/QObject>
+#include <QtCore/QTemporaryDir>
class tst_QMimeDatabase : public QObject
{
@@ -53,7 +54,6 @@ public:
private slots:
void initTestCase();
- void cleanupTestCase();
void mimeTypeForName();
void mimeTypeForFileName_data();
@@ -93,7 +93,13 @@ private slots:
void installNewLocalMimeType();
private:
- QString m_dataHome;
+ void init(); // test-specific
+
+ QString m_globalXdgDir;
+ QString m_localXdgDir;
+ QString m_yastMimeTypes;
+ QTemporaryDir m_temporaryDir;
+ QString m_testSuite;
};
#endif // TST_QMIMEDATABASE_H
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index 1732f628ea..e72af11fbb 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -580,7 +580,9 @@ void tst_QChar::normalization_data()
int linenum = 0;
int part = 0;
- QFile f(QFINDTESTDATA("NormalizationTest.txt"));
+ QString testFile = QFINDTESTDATA("NormalizationTest.txt");
+ QVERIFY2(!testFile.isEmpty(), "NormalizationTest.txt not found!");
+ QFile f(testFile);
QVERIFY(f.exists());
f.open(QIODevice::ReadOnly);
diff --git a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
index a97350ca3f..b61f51d53a 100644
--- a/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
+++ b/tests/auto/corelib/tools/qlocale/syslocaleapp/syslocaleapp.pro
@@ -6,6 +6,3 @@ CONFIG -= app_bundle
QT = core
-# This app is testdata for tst_qlocale
-target.path = $$[QT_INSTALL_TESTS]/tst_qlocale/$$TARGET
-INSTALLS += target
diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro
index eafd8c1699..24dcc0638a 100644
--- a/tests/auto/corelib/tools/qlocale/test/test.pro
+++ b/tests/auto/corelib/tools/qlocale/test/test.pro
@@ -12,6 +12,8 @@ win32 {
TARGET = ../../release/tst_qlocale
}
}
-TESTDATA += syslocaleapp
+
+load(testcase) # for target.path and installTestHelperApp()
+installTestHelperApp("../syslocaleapp/syslocaleapp",syslocaleapp,syslocaleapp)
mac: CONFIG += insignificant_test # QTBUG-22769
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
index 02acb00548..b3b573c64b 100644
--- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
+++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp
@@ -809,11 +809,7 @@ void tst_QLocale::negativeZero()
{
double negativeZero( 0.0 ); // Initialise to zero.
uchar *ptr = (uchar *)&negativeZero;
-#ifdef QT_ARMFPA
- ptr[3] = 0x80;
-#else
ptr[QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 7] = 0x80;
-#endif
QString s = QString::number(negativeZero);
QCOMPARE(s, QString("0"));
}
diff --git a/tests/auto/corelib/tools/qpair/qpair.pro b/tests/auto/corelib/tools/qpair/qpair.pro
new file mode 100644
index 0000000000..9c7752327e
--- /dev/null
+++ b/tests/auto/corelib/tools/qpair/qpair.pro
@@ -0,0 +1,4 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qpair
+QT = core testlib
+SOURCES = tst_qpair.cpp
diff --git a/tests/auto/corelib/tools/qpair/tst_qpair.cpp b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
new file mode 100644
index 0000000000..5de1e8f8bb
--- /dev/null
+++ b/tests/auto/corelib/tools/qpair/tst_qpair.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include <QPair>
+
+class tst_QPair : public QObject
+{
+ Q_OBJECT
+private Q_SLOTS:
+ void dummy() {}
+};
+
+class C { char _[4]; };
+class M { char _[4]; };
+class P { char _[4]; };
+
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(M, Q_MOVABLE_TYPE);
+Q_DECLARE_TYPEINFO(P, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
+
+// avoid the comma:
+typedef QPair<C,C> QPairCC;
+typedef QPair<C,M> QPairCM;
+typedef QPair<C,P> QPairCP;
+typedef QPair<M,C> QPairMC;
+typedef QPair<M,M> QPairMM;
+typedef QPair<M,P> QPairMP;
+typedef QPair<P,C> QPairPC;
+typedef QPair<P,M> QPairPM;
+typedef QPair<P,P> QPairPP;
+
+Q_STATIC_ASSERT( QTypeInfo<QPairCC>::isComplex);
+Q_STATIC_ASSERT( QTypeInfo<QPairCC>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairCM>::isComplex);
+Q_STATIC_ASSERT( QTypeInfo<QPairCM>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairCP>::isComplex);
+Q_STATIC_ASSERT( QTypeInfo<QPairCP>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairMC>::isComplex);
+Q_STATIC_ASSERT( QTypeInfo<QPairMC>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairMM>::isComplex);
+Q_STATIC_ASSERT(!QTypeInfo<QPairMM>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairMP>::isComplex);
+Q_STATIC_ASSERT(!QTypeInfo<QPairMP>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairPC>::isComplex);
+Q_STATIC_ASSERT( QTypeInfo<QPairPC>::isStatic );
+
+Q_STATIC_ASSERT( QTypeInfo<QPairPM>::isComplex);
+Q_STATIC_ASSERT(!QTypeInfo<QPairPM>::isStatic );
+
+Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isComplex);
+Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isStatic );
+
+Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isDummy );
+Q_STATIC_ASSERT(!QTypeInfo<QPairPP>::isPointer);
+
+
+QTEST_APPLESS_MAIN(tst_QPair)
+#include "tst_qpair.moc"
diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
index a697e23270..5470de76ee 100644
--- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
+++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp
@@ -81,6 +81,7 @@ private slots:
void interval();
void validityCheck_data();
void validityCheck();
+ void escapeSequences();
};
// Testing get/set functions
@@ -118,43 +119,43 @@ void tst_QRegExp::indexIn_data()
stri.setNum(i);
// anchors
- QTest::newRow( stri + "anc00" ) << QString("a(?=)z") << QString("az") << 0 << 2 << QStringList();
- QTest::newRow( stri + "anc01" ) << QString("a(?!)z") << QString("az") << -1 << -1 << QStringList();
- QTest::newRow( stri + "anc02" ) << QString("a(?:(?=)|(?=))z") << QString("az") << 0 << 2
+ QTest::newRow(qPrintable(stri + "anc00")) << QString("a(?=)z") << QString("az") << 0 << 2 << QStringList();
+ QTest::newRow(qPrintable(stri + "anc01")) << QString("a(?!)z") << QString("az") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "anc02")) << QString("a(?:(?=)|(?=))z") << QString("az") << 0 << 2
<< QStringList();
- QTest::newRow( stri + "anc03" ) << QString("a(?:(?=)|(?!))z") << QString("az") << 0 << 2
+ QTest::newRow(qPrintable(stri + "anc03")) << QString("a(?:(?=)|(?!))z") << QString("az") << 0 << 2
<< QStringList();
- QTest::newRow( stri + "anc04" ) << QString("a(?:(?!)|(?=))z") << QString("az") << 0 << 2
+ QTest::newRow(qPrintable(stri + "anc04")) << QString("a(?:(?!)|(?=))z") << QString("az") << 0 << 2
<< QStringList();
- QTest::newRow( stri + "anc05" ) << QString("a(?:(?!)|(?!))z") << QString("az") << -1 << -1
+ QTest::newRow(qPrintable(stri + "anc05")) << QString("a(?:(?!)|(?!))z") << QString("az") << -1 << -1
<< QStringList();
- QTest::newRow( stri + "anc06" ) << QString("a(?:(?=)|b)z") << QString("az") << 0 << 2
+ QTest::newRow(qPrintable(stri + "anc06")) << QString("a(?:(?=)|b)z") << QString("az") << 0 << 2
<< QStringList();
- QTest::newRow( stri + "anc07" ) << QString("a(?:(?=)|b)z") << QString("abz") << 0 << 3
+ QTest::newRow(qPrintable(stri + "anc07")) << QString("a(?:(?=)|b)z") << QString("abz") << 0 << 3
<< QStringList();
- QTest::newRow( stri + "anc08" ) << QString("a(?:(?!)|b)z") << QString("az") << -1 << -1
+ QTest::newRow(qPrintable(stri + "anc08")) << QString("a(?:(?!)|b)z") << QString("az") << -1 << -1
<< QStringList();
- QTest::newRow( stri + "anc09" ) << QString("a(?:(?!)|b)z") << QString("abz") << 0 << 3
+ QTest::newRow(qPrintable(stri + "anc09")) << QString("a(?:(?!)|b)z") << QString("abz") << 0 << 3
<< QStringList();
#if 0
- QTest::newRow( stri + "anc10" ) << QString("a?(?=^b$)") << QString("ab") << 0 << 1
+ QTest::newRow(qPrintable(stri + "anc10")) << QString("a?(?=^b$)") << QString("ab") << 0 << 1
<< QStringList();
- QTest::newRow( stri + "anc11" ) << QString("a?(?=^b$)") << QString("b") << 0 << 0
+ QTest::newRow(qPrintable(stri + "anc11")) << QString("a?(?=^b$)") << QString("b") << 0 << 0
<< QStringList();
#endif
// back-references
- QTest::newRow( stri + "bref00" ) << QString("(a*)(\\1)") << QString("aaaaa") << 0 << 4
+ QTest::newRow(qPrintable(stri + "bref00")) << QString("(a*)(\\1)") << QString("aaaaa") << 0 << 4
<< QStringList( QStringList() << "aa" << "aa" );
- QTest::newRow( stri + "bref01" ) << QString("<(\\w*)>.+</\\1>") << QString("<b>blabla</b>bla</>")
+ QTest::newRow(qPrintable(stri + "bref01")) << QString("<(\\w*)>.+</\\1>") << QString("<b>blabla</b>bla</>")
<< 0 << 13 << QStringList( QStringList() << "b" );
- QTest::newRow( stri + "bref02" ) << QString("<(\\w*)>.+</\\1>") << QString("<>blabla</b>bla</>")
+ QTest::newRow(qPrintable(stri + "bref02")) << QString("<(\\w*)>.+</\\1>") << QString("<>blabla</b>bla</>")
<< 0 << 18 << QStringList( QStringList() << "" );
- QTest::newRow( stri + "bref03" ) << QString("((a*\\2)\\2)") << QString("aaaa") << 0 << 4
+ QTest::newRow(qPrintable(stri + "bref03")) << QString("((a*\\2)\\2)") << QString("aaaa") << 0 << 4
<< QStringList( QStringList() << QString("aaaa") << "aa" );
- QTest::newRow( stri + "bref04" ) << QString("^(aa+)\\1+$") << QString("aaaaaa") << 0 << 6
+ QTest::newRow(qPrintable(stri + "bref04")) << QString("^(aa+)\\1+$") << QString("aaaaaa") << 0 << 6
<< QStringList( QStringList() << QString("aa") );
- QTest::newRow( stri + "bref05" ) << QString("^(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)"
+ QTest::newRow(qPrintable(stri + "bref05")) << QString("^(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11)(12)(13)(14)"
"\\14\\13\\12\\11\\10\\9\\8\\7\\6\\5\\4\\3\\2\\1")
<< QString("12345678910111213141413121110987654321") << 0 << 38
<< QStringList( QStringList() << "1" << "2" << "3" << "4" << "5" << "6"
@@ -162,49 +163,49 @@ void tst_QRegExp::indexIn_data()
<< "12" << "13" << "14");
// captures
- QTest::newRow( stri + "cap00" ) << QString("(a*)") << QString("") << 0 << 0
+ QTest::newRow(qPrintable(stri + "cap00")) << QString("(a*)") << QString("") << 0 << 0
<< QStringList( QStringList() << QString("") );
- QTest::newRow( stri + "cap01" ) << QString("(a*)") << QString("aaa") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cap01")) << QString("(a*)") << QString("aaa") << 0 << 3
<< QStringList( QStringList() << "aaa" );
- QTest::newRow( stri + "cap02" ) << QString("(a*)") << QString("baaa") << 0 << 0
+ QTest::newRow(qPrintable(stri + "cap02")) << QString("(a*)") << QString("baaa") << 0 << 0
<< QStringList( QStringList() << QString("") );
- QTest::newRow( stri + "cap03" ) << QString("(a*)(a*)") << QString("aaa") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cap03")) << QString("(a*)(a*)") << QString("aaa") << 0 << 3
<< QStringList( QStringList() << QString("aaa") << QString("") );
- QTest::newRow( stri + "cap04" ) << QString("(a*)(b*)") << QString("aaabbb") << 0 << 6
+ QTest::newRow(qPrintable(stri + "cap04")) << QString("(a*)(b*)") << QString("aaabbb") << 0 << 6
<< QStringList( QStringList() << QString("aaa") << QString("bbb") );
- QTest::newRow( stri + "cap06" ) << QString("(a*)a*") << QString("aaa") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cap06")) << QString("(a*)a*") << QString("aaa") << 0 << 3
<< QStringList( QStringList() << QString("aaa") );
- QTest::newRow( stri + "cap07" ) << QString("((a*a*)*)") << QString("aaa") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cap07")) << QString("((a*a*)*)") << QString("aaa") << 0 << 3
<< QStringList( QStringList() << "aaa" << QString("aaa") );
- QTest::newRow( stri + "cap08" ) << QString("(((a)*(b)*)*)") << QString("ababa") << 0 << 5
+ QTest::newRow(qPrintable(stri + "cap08")) << QString("(((a)*(b)*)*)") << QString("ababa") << 0 << 5
<< QStringList( QStringList() << QString("ababa") << QString("a") << QString("a")
<< "" );
- QTest::newRow( stri + "cap09" ) << QString("(((a)*(b)*)c)*") << QString("") << 0 << 0
+ QTest::newRow(qPrintable(stri + "cap09")) << QString("(((a)*(b)*)c)*") << QString("") << 0 << 0
<< QStringList( QStringList() << QString("") << QString("") << QString("") << QString("") );
- QTest::newRow( stri + "cap10" ) << QString("(((a)*(b)*)c)*") << QString("abc") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cap10")) << QString("(((a)*(b)*)c)*") << QString("abc") << 0 << 3
<< QStringList( QStringList() << "abc" << "ab" << "a"
<< "b" );
- QTest::newRow( stri + "cap11" ) << QString("(((a)*(b)*)c)*") << QString("abcc") << 0 << 4
+ QTest::newRow(qPrintable(stri + "cap11")) << QString("(((a)*(b)*)c)*") << QString("abcc") << 0 << 4
<< QStringList( QStringList() << "c" << "" << "" << "" );
- QTest::newRow( stri + "cap12" ) << QString("(((a)*(b)*)c)*") << QString("abcac") << 0 << 5
+ QTest::newRow(qPrintable(stri + "cap12")) << QString("(((a)*(b)*)c)*") << QString("abcac") << 0 << 5
<< QStringList( QStringList() << "ac" << "a" << "a" << "" );
- QTest::newRow( stri + "cap13" ) << QString("(to|top)?(o|polo)?(gical|o?logical)")
+ QTest::newRow(qPrintable(stri + "cap13")) << QString("(to|top)?(o|polo)?(gical|o?logical)")
<< QString("topological") << 0 << 11
<< QStringList( QStringList() << "top" << "o"
<< "logical" );
- QTest::newRow( stri + "cap14" ) << QString("(a)+") << QString("aaaa") << 0 << 4
+ QTest::newRow(qPrintable(stri + "cap14")) << QString("(a)+") << QString("aaaa") << 0 << 4
<< QStringList( QStringList() << "a" );
// concatenation
- QTest::newRow( stri + "cat00" ) << QString("") << QString("") << 0 << 0 << QStringList();
- QTest::newRow( stri + "cat01" ) << QString("") << QString("a") << 0 << 0 << QStringList();
- QTest::newRow( stri + "cat02" ) << QString("a") << QString("") << -1 << -1 << QStringList();
- QTest::newRow( stri + "cat03" ) << QString("a") << QString("a") << 0 << 1 << QStringList();
- QTest::newRow( stri + "cat04" ) << QString("a") << QString("b") << -1 << -1 << QStringList();
- QTest::newRow( stri + "cat05" ) << QString("b") << QString("a") << -1 << -1 << QStringList();
- QTest::newRow( stri + "cat06" ) << QString("ab") << QString("ab") << 0 << 2 << QStringList();
- QTest::newRow( stri + "cat07" ) << QString("ab") << QString("ba") << -1 << -1 << QStringList();
- QTest::newRow( stri + "cat08" ) << QString("abab") << QString("abbaababab") << 4 << 4 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat00")) << QString("") << QString("") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat01")) << QString("") << QString("a") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat02")) << QString("a") << QString("") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat03")) << QString("a") << QString("a") << 0 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat04")) << QString("a") << QString("b") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat05")) << QString("b") << QString("a") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat06")) << QString("ab") << QString("ab") << 0 << 2 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat07")) << QString("ab") << QString("ba") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "cat08")) << QString("abab") << QString("abbaababab") << 4 << 4 << QStringList();
indexIn_addMoreRows(stri);
}
@@ -213,96 +214,96 @@ void tst_QRegExp::indexIn_data()
void tst_QRegExp::indexIn_addMoreRows(const QByteArray &stri)
{
// from Perl Cookbook
- QTest::newRow( stri + "cook00" ) << QString("^(m*)(d?c{0,3}|c[dm])(1?x{0,3}|x[lc])(v?i{0,3}|i[vx])$")
+ QTest::newRow(qPrintable(stri + "cook00")) << QString("^(m*)(d?c{0,3}|c[dm])(1?x{0,3}|x[lc])(v?i{0,3}|i[vx])$")
<< QString("mmxl") << 0 << 4
<< QStringList( QStringList() << "mm" << "" << "xl"
<< "" );
- QTest::newRow( stri + "cook01" ) << QString("(\\S+)(\\s+)(\\S+)") << QString(" a b") << 1 << 5
+ QTest::newRow(qPrintable(stri + "cook01")) << QString("(\\S+)(\\s+)(\\S+)") << QString(" a b") << 1 << 5
<< QStringList( QStringList() << "a" << " " << "b" );
- QTest::newRow( stri + "cook02" ) << QString("(\\w+)\\s*=\\s*(.*)\\s*$") << QString(" PATH=. ") << 1
+ QTest::newRow(qPrintable(stri + "cook02")) << QString("(\\w+)\\s*=\\s*(.*)\\s*$") << QString(" PATH=. ") << 1
<< 7 << QStringList( QStringList() << "PATH" << ". " );
- QTest::newRow( stri + "cook03" ) << QString(".{80,}")
+ QTest::newRow(qPrintable(stri + "cook03")) << QString(".{80,}")
<< QString("0000000011111111222222223333333344444444555"
"5555566666666777777778888888899999999000000"
"00aaaaaaaa")
<< 0 << 96 << QStringList();
- QTest::newRow( stri + "cook04" ) << QString("(\\d+)/(\\d+)/(\\d+) (\\d+):(\\d+):(\\d+)")
+ QTest::newRow(qPrintable(stri + "cook04")) << QString("(\\d+)/(\\d+)/(\\d+) (\\d+):(\\d+):(\\d+)")
<< QString("1978/05/24 07:30:00") << 0 << 19
<< QStringList( QStringList() << "1978" << "05" << "24"
<< "07" << "30" << "00" );
- QTest::newRow( stri + "cook05" ) << QString("/usr/bin") << QString("/usr/local/bin:/usr/bin")
+ QTest::newRow(qPrintable(stri + "cook05")) << QString("/usr/bin") << QString("/usr/local/bin:/usr/bin")
<< 15 << 8 << QStringList();
- QTest::newRow( stri + "cook06" ) << QString("%([0-9A-Fa-f]{2})") << QString("http://%7f") << 7 << 3
+ QTest::newRow(qPrintable(stri + "cook06")) << QString("%([0-9A-Fa-f]{2})") << QString("http://%7f") << 7 << 3
<< QStringList( QStringList() << "7f" );
- QTest::newRow( stri + "cook07" ) << QString("/\\*.*\\*/") << QString("i++; /* increment i */") << 5
+ QTest::newRow(qPrintable(stri + "cook07")) << QString("/\\*.*\\*/") << QString("i++; /* increment i */") << 5
<< 17 << QStringList();
- QTest::newRow( stri + "cook08" ) << QString("^\\s+") << QString(" aaa ") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cook08")) << QString("^\\s+") << QString(" aaa ") << 0 << 3
<< QStringList();
- QTest::newRow( stri + "cook09" ) << QString("\\s+$") << QString(" aaa ") << 6 << 3
+ QTest::newRow(qPrintable(stri + "cook09")) << QString("\\s+$") << QString(" aaa ") << 6 << 3
<< QStringList();
- QTest::newRow( stri + "cook10" ) << QString("^.*::") << QString("Box::cat") << 0 << 5
+ QTest::newRow(qPrintable(stri + "cook10")) << QString("^.*::") << QString("Box::cat") << 0 << 5
<< QStringList();
- QTest::newRow( stri + "cook11" ) << QString("^([01]?\\d\\d|2[0-4]\\d|25[0-5])\\.([01]?\\"
+ QTest::newRow(qPrintable(stri + "cook11")) << QString("^([01]?\\d\\d|2[0-4]\\d|25[0-5])\\.([01]?\\"
"d\\d|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d|2[0-"
"4]\\d|25[0-5])\\.([01]?\\d\\d|2[0-4]\\d|25["
"0-5])$")
<< QString("255.00.40.30") << 0 << 12
<< QStringList( QStringList() << "255" << "00" << "40"
<< "30" );
- QTest::newRow( stri + "cook12" ) << QString("^.*/") << QString(" /usr/local/bin/moc") << 0 << 16
+ QTest::newRow(qPrintable(stri + "cook12")) << QString("^.*/") << QString(" /usr/local/bin/moc") << 0 << 16
<< QStringList();
- QTest::newRow( stri + "cook13" ) << QString(":co#(\\d+):") << QString("bla:co#55:") << 3 << 7
+ QTest::newRow(qPrintable(stri + "cook13")) << QString(":co#(\\d+):") << QString("bla:co#55:") << 3 << 7
<< QStringList( QStringList() << "55" );
- QTest::newRow( stri + "cook14" ) << QString("linux") << QString("alphalinuxinunix") << 5 << 5
+ QTest::newRow(qPrintable(stri + "cook14")) << QString("linux") << QString("alphalinuxinunix") << 5 << 5
<< QStringList();
- QTest::newRow( stri + "cook15" ) << QString("(\\d+\\.?\\d*|\\.\\d+)") << QString("0.0.5") << 0 << 3
+ QTest::newRow(qPrintable(stri + "cook15")) << QString("(\\d+\\.?\\d*|\\.\\d+)") << QString("0.0.5") << 0 << 3
<< QStringList( QStringList() << "0.0" );
// mathematical trivia
- QTest::newRow( stri + "math00" ) << QString("^(a\\1*)$") << QString("a") << 0 << 1
+ QTest::newRow(qPrintable(stri + "math00")) << QString("^(a\\1*)$") << QString("a") << 0 << 1
<< QStringList( QStringList() << "a" );
- QTest::newRow( stri + "math01" ) << QString("^(a\\1*)$") << QString("aa") << 0 << 2
+ QTest::newRow(qPrintable(stri + "math01")) << QString("^(a\\1*)$") << QString("aa") << 0 << 2
<< QStringList( QStringList() << "aa" );
- QTest::newRow( stri + "math02" ) << QString("^(a\\1*)$") << QString("aaa") << -1 << -1
+ QTest::newRow(qPrintable(stri + "math02")) << QString("^(a\\1*)$") << QString("aaa") << -1 << -1
<< QStringList( QStringList() << QString() );
- QTest::newRow( stri + "math03" ) << QString("^(a\\1*)$") << QString("aaaa") << 0 << 4
+ QTest::newRow(qPrintable(stri + "math03")) << QString("^(a\\1*)$") << QString("aaaa") << 0 << 4
<< QStringList( QStringList() << "aaaa" );
- QTest::newRow( stri + "math04" ) << QString("^(a\\1*)$") << QString("aaaaa") << -1 << -1
+ QTest::newRow(qPrintable(stri + "math04")) << QString("^(a\\1*)$") << QString("aaaaa") << -1 << -1
<< QStringList( QStringList() << QString() );
- QTest::newRow( stri + "math05" ) << QString("^(a\\1*)$") << QString("aaaaaa") << -1 << -1
+ QTest::newRow(qPrintable(stri + "math05")) << QString("^(a\\1*)$") << QString("aaaaaa") << -1 << -1
<< QStringList( QStringList() << QString() );
- QTest::newRow( stri + "math06" ) << QString("^(a\\1*)$") << QString("aaaaaaa") << -1 << -1
+ QTest::newRow(qPrintable(stri + "math06")) << QString("^(a\\1*)$") << QString("aaaaaaa") << -1 << -1
<< QStringList( QStringList() << QString() );
- QTest::newRow( stri + "math07" ) << QString("^(a\\1*)$") << QString("aaaaaaaa") << 0 << 8
+ QTest::newRow(qPrintable(stri + "math07")) << QString("^(a\\1*)$") << QString("aaaaaaaa") << 0 << 8
<< QStringList( QStringList() << "aaaaaaaa" );
- QTest::newRow( stri + "math08" ) << QString("^(a\\1*)$") << QString("aaaaaaaaa") << -1 << -1
+ QTest::newRow(qPrintable(stri + "math08")) << QString("^(a\\1*)$") << QString("aaaaaaaaa") << -1 << -1
<< QStringList( QStringList() << QString() );
- QTest::newRow( stri + "math09" ) << QString("^a(?:a(\\1a))*$") << QString("a") << 0 << 1
+ QTest::newRow(qPrintable(stri + "math09")) << QString("^a(?:a(\\1a))*$") << QString("a") << 0 << 1
<< QStringList( QStringList() << "" );
- QTest::newRow( stri + "math10" ) << QString("^a(?:a(\\1a))*$") << QString("aaa") << 0 << 3
+ QTest::newRow(qPrintable(stri + "math10")) << QString("^a(?:a(\\1a))*$") << QString("aaa") << 0 << 3
<< QStringList( QStringList() << "a" );
- QTest::newRow( stri + "math13" ) << QString("^(?:((?:^a)?\\2\\3)(\\3\\1|(?=a$))(\\1\\2|("
+ QTest::newRow(qPrintable(stri + "math13")) << QString("^(?:((?:^a)?\\2\\3)(\\3\\1|(?=a$))(\\1\\2|("
"?=a$)))*a$")
<< QString("aaa") << 0 << 3
<< QStringList( QStringList() << "a" << "a" << "" );
- QTest::newRow( stri + "math14" ) << QString("^(?:((?:^a)?\\2\\3)(\\3\\1|(?=a$))(\\1\\2|("
+ QTest::newRow(qPrintable(stri + "math14")) << QString("^(?:((?:^a)?\\2\\3)(\\3\\1|(?=a$))(\\1\\2|("
"?=a$)))*a$")
<< QString("aaaaa") << 0 << 5
<< QStringList( QStringList() << "a" << "a" << "aa" );
- QTest::newRow( stri + "math17" ) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
+ QTest::newRow(qPrintable(stri + "math17")) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
":(\\4(?:^a)?\\6)(\\4\\5))*(?:\\4\\6)?))$")
<< QString("aaa") << 0 << 3
<< QStringList( QStringList() << "" << "" << "" << "aaa" << "a" << "aa" );
- QTest::newRow( stri + "math18" ) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
+ QTest::newRow(qPrintable(stri + "math18")) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
":(\\4(?:^a)?\\6)(\\4\\5))*(?:\\4\\6)?))$")
<< QString("aaaaa") << 0 << 5
<< QStringList( QStringList() << "aaaaa" << "a" << "aaa" << "" << "" << "" );
- QTest::newRow( stri + "math19" ) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
+ QTest::newRow(qPrintable(stri + "math19")) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
":(\\4(?:^a)?\\6)(\\4\\5))*(?:\\4\\6)?))$")
<< QString("aaaaaaaa") << 0 << 8
<< QStringList( QStringList() << "" << "" << "" << "aaaaaaaa" << "a" << "aa" );
- QTest::newRow( stri + "math20" ) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
+ QTest::newRow(qPrintable(stri + "math20")) << QString("^(?:(a(?:(\\1\\3)(\\1\\2))*(?:\\1\\3)?)|((?"
":(\\4(?:^a)?\\6)(\\4\\5))*(?:\\4\\6)?))$")
<< QString("aaaaaaaaa") << -1 << -1
<< QStringList( QStringList() << QString()
@@ -311,7 +312,7 @@ void tst_QRegExp::indexIn_addMoreRows(const QByteArray &stri)
<< QString()
<< QString()
<< QString() );
- QTest::newRow( stri + "math21" ) << QString("^(aa+)\\1+$") << QString("aaaaaaaaaaaa") << 0 << 12
+ QTest::newRow(qPrintable(stri + "math21")) << QString("^(aa+)\\1+$") << QString("aaaaaaaaaaaa") << 0 << 12
<< QStringList( QStringList() << "aa" );
static const char * const squareRegExp[] = {
@@ -349,129 +350,129 @@ void tst_QRegExp::indexIn_addMoreRows(const QByteArray &stri)
}
// miscellaneous
- QTest::newRow( stri + "misc00" ) << QString(email)
+ QTest::newRow(qPrintable(stri + "misc00")) << QString(email)
<< QString("email123@example.com") << 0 << 20
<< QStringList();
- QTest::newRow( stri + "misc01" ) << QString("[0-9]*\\.[0-9]+") << QString("pi = 3.14") << 5 << 4
+ QTest::newRow(qPrintable(stri + "misc01")) << QString("[0-9]*\\.[0-9]+") << QString("pi = 3.14") << 5 << 4
<< QStringList();
// or operator
- QTest::newRow( stri + "or00" ) << QString("(?:|b)") << QString("xxx") << 0 << 0 << QStringList();
- QTest::newRow( stri + "or01" ) << QString("(?:|b)") << QString("b") << 0 << 1 << QStringList();
- QTest::newRow( stri + "or02" ) << QString("(?:b|)") << QString("") << 0 << 0 << QStringList();
- QTest::newRow( stri + "or03" ) << QString("(?:b|)") << QString("b") << 0 << 1 << QStringList();
- QTest::newRow( stri + "or04" ) << QString("(?:||b||)") << QString("") << 0 << 0 << QStringList();
- QTest::newRow( stri + "or05" ) << QString("(?:||b||)") << QString("b") << 0 << 1 << QStringList();
- QTest::newRow( stri + "or06" ) << QString("(?:a|b)") << QString("") << -1 << -1 << QStringList();
- QTest::newRow( stri + "or07" ) << QString("(?:a|b)") << QString("cc") << -1 << -1 << QStringList();
- QTest::newRow( stri + "or08" ) << QString("(?:a|b)") << QString("abc") << 0 << 1 << QStringList();
- QTest::newRow( stri + "or09" ) << QString("(?:a|b)") << QString("cba") << 1 << 1 << QStringList();
- QTest::newRow( stri + "or10" ) << QString("(?:ab|ba)") << QString("aba") << 0 << 2
+ QTest::newRow(qPrintable(stri + "or00")) << QString("(?:|b)") << QString("xxx") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "or01")) << QString("(?:|b)") << QString("b") << 0 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or02")) << QString("(?:b|)") << QString("") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "or03")) << QString("(?:b|)") << QString("b") << 0 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or04")) << QString("(?:||b||)") << QString("") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "or05")) << QString("(?:||b||)") << QString("b") << 0 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or06")) << QString("(?:a|b)") << QString("") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or07")) << QString("(?:a|b)") << QString("cc") << -1 << -1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or08")) << QString("(?:a|b)") << QString("abc") << 0 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or09")) << QString("(?:a|b)") << QString("cba") << 1 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "or10")) << QString("(?:ab|ba)") << QString("aba") << 0 << 2
<< QStringList();
- QTest::newRow( stri + "or11" ) << QString("(?:ab|ba)") << QString("bab") << 0 << 2
+ QTest::newRow(qPrintable(stri + "or11")) << QString("(?:ab|ba)") << QString("bab") << 0 << 2
<< QStringList();
- QTest::newRow( stri + "or12" ) << QString("(?:ab|ba)") << QString("caba") << 1 << 2
+ QTest::newRow(qPrintable(stri + "or12")) << QString("(?:ab|ba)") << QString("caba") << 1 << 2
<< QStringList();
- QTest::newRow( stri + "or13" ) << QString("(?:ab|ba)") << QString("cbab") << 1 << 2
+ QTest::newRow(qPrintable(stri + "or13")) << QString("(?:ab|ba)") << QString("cbab") << 1 << 2
<< QStringList();
// quantifiers
- QTest::newRow( stri + "qua00" ) << QString("((([a-j])){0,0})") << QString("") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua00")) << QString("((([a-j])){0,0})") << QString("") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua01" ) << QString("((([a-j])){0,0})") << QString("a") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua01")) << QString("((([a-j])){0,0})") << QString("a") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua02" ) << QString("((([a-j])){0,0})") << QString("xyz") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua02")) << QString("((([a-j])){0,0})") << QString("xyz") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua03" ) << QString("((([a-j]))?)") << QString("") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua03")) << QString("((([a-j]))?)") << QString("") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua04" ) << QString("((([a-j]))?)") << QString("a") << 0 << 1
+ QTest::newRow(qPrintable(stri + "qua04")) << QString("((([a-j]))?)") << QString("a") << 0 << 1
<< QStringList( QStringList() << "a" << "a" << "a" );
- QTest::newRow( stri + "qua05" ) << QString("((([a-j]))?)") << QString("x") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua05")) << QString("((([a-j]))?)") << QString("x") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua06" ) << QString("((([a-j]))?)") << QString("ab") << 0 << 1
+ QTest::newRow(qPrintable(stri + "qua06")) << QString("((([a-j]))?)") << QString("ab") << 0 << 1
<< QStringList( QStringList() << "a" << "a" << "a" );
- QTest::newRow( stri + "qua07" ) << QString("((([a-j]))?)") << QString("xa") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua07")) << QString("((([a-j]))?)") << QString("xa") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua08" ) << QString("((([a-j])){0,3})") << QString("") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua08")) << QString("((([a-j])){0,3})") << QString("") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua09" ) << QString("((([a-j])){0,3})") << QString("a") << 0 << 1
+ QTest::newRow(qPrintable(stri + "qua09")) << QString("((([a-j])){0,3})") << QString("a") << 0 << 1
<< QStringList( QStringList() << "a" << "a" << "a" );
- QTest::newRow( stri + "qua10" ) << QString("((([a-j])){0,3})") << QString("abcd") << 0 << 3
+ QTest::newRow(qPrintable(stri + "qua10")) << QString("((([a-j])){0,3})") << QString("abcd") << 0 << 3
<< QStringList( QStringList() << "abc" << "c" << "c" );
- QTest::newRow( stri + "qua11" ) << QString("((([a-j])){0,3})") << QString("abcde") << 0 << 3
+ QTest::newRow(qPrintable(stri + "qua11")) << QString("((([a-j])){0,3})") << QString("abcde") << 0 << 3
<< QStringList( QStringList() << "abc" << "c" << "c" );
- QTest::newRow( stri + "qua12" ) << QString("((([a-j])){2,4})") << QString("a") << -1 << -1
+ QTest::newRow(qPrintable(stri + "qua12")) << QString("((([a-j])){2,4})") << QString("a") << -1 << -1
<< QStringList( QStringList() << QString()
<< QString()
<< QString() );
- QTest::newRow( stri + "qua13" ) << QString("((([a-j])){2,4})") << QString("ab") << 0 << 2
+ QTest::newRow(qPrintable(stri + "qua13")) << QString("((([a-j])){2,4})") << QString("ab") << 0 << 2
<< QStringList( QStringList() << "ab" << "b" << "b" );
- QTest::newRow( stri + "qua14" ) << QString("((([a-j])){2,4})") << QString("abcd") << 0 << 4
+ QTest::newRow(qPrintable(stri + "qua14")) << QString("((([a-j])){2,4})") << QString("abcd") << 0 << 4
<< QStringList( QStringList() << "abcd" << "d" << "d" );
- QTest::newRow( stri + "qua15" ) << QString("((([a-j])){2,4})") << QString("abcdef") << 0 << 4
+ QTest::newRow(qPrintable(stri + "qua15")) << QString("((([a-j])){2,4})") << QString("abcdef") << 0 << 4
<< QStringList( QStringList() << "abcd" << "d" << "d" );
- QTest::newRow( stri + "qua16" ) << QString("((([a-j])){2,4})") << QString("xaybcd") << 3 << 3
+ QTest::newRow(qPrintable(stri + "qua16")) << QString("((([a-j])){2,4})") << QString("xaybcd") << 3 << 3
<< QStringList( QStringList() << "bcd" << "d" << "d" );
- QTest::newRow( stri + "qua17" ) << QString("((([a-j])){0,})") << QString("abcdefgh") << 0 << 8
+ QTest::newRow(qPrintable(stri + "qua17")) << QString("((([a-j])){0,})") << QString("abcdefgh") << 0 << 8
<< QStringList( QStringList() << "abcdefgh" << "h" << "h" );
- QTest::newRow( stri + "qua18" ) << QString("((([a-j])){,0})") << QString("abcdefgh") << 0 << 0
+ QTest::newRow(qPrintable(stri + "qua18")) << QString("((([a-j])){,0})") << QString("abcdefgh") << 0 << 0
<< QStringList( QStringList() << "" << "" << "" );
- QTest::newRow( stri + "qua19" ) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("123332333") << 0
+ QTest::newRow(qPrintable(stri + "qua19")) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("123332333") << 0
<< 9
<< QStringList( QStringList() << "123332333" << "2333"
<< "3" );
- QTest::newRow( stri + "qua20" ) << QString("(1(2(3){3,4}){2,3}){1,2}")
+ QTest::newRow(qPrintable(stri + "qua20")) << QString("(1(2(3){3,4}){2,3}){1,2}")
<< QString("12333323333233331233332333323333") << 0 << 32
<< QStringList( QStringList() << "1233332333323333"
<< "23333" << "3" );
- QTest::newRow( stri + "qua21" ) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("") << -1 << -1
+ QTest::newRow(qPrintable(stri + "qua21")) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("") << -1 << -1
<< QStringList( QStringList() << QString()
<< QString()
<< QString() );
- QTest::newRow( stri + "qua22" ) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("12333") << -1
+ QTest::newRow(qPrintable(stri + "qua22")) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("12333") << -1
<< -1
<< QStringList( QStringList() << QString()
<< QString()
<< QString() );
- QTest::newRow( stri + "qua23" ) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("12333233") << -1
+ QTest::newRow(qPrintable(stri + "qua23")) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("12333233") << -1
<< -1
<< QStringList( QStringList() << QString()
<< QString()
<< QString() );
- QTest::newRow( stri + "qua24" ) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("122333") << -1
+ QTest::newRow(qPrintable(stri + "qua24")) << QString("(1(2(3){3,4}){2,3}){1,2}") << QString("122333") << -1
<< -1
<< QStringList( QStringList() << QString()
<< QString()
<< QString() );
// star operator
- QTest::newRow( stri + "star00" ) << QString("(?:)*") << QString("") << 0 << 0 << QStringList();
- QTest::newRow( stri + "star01" ) << QString("(?:)*") << QString("abc") << 0 << 0 << QStringList();
- QTest::newRow( stri + "star02" ) << QString("(?:a)*") << QString("") << 0 << 0 << QStringList();
- QTest::newRow( stri + "star03" ) << QString("(?:a)*") << QString("a") << 0 << 1 << QStringList();
- QTest::newRow( stri + "star04" ) << QString("(?:a)*") << QString("aaa") << 0 << 3 << QStringList();
- QTest::newRow( stri + "star05" ) << QString("(?:a)*") << QString("bbbbaaa") << 0 << 0
+ QTest::newRow(qPrintable(stri + "star00")) << QString("(?:)*") << QString("") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "star01")) << QString("(?:)*") << QString("abc") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "star02")) << QString("(?:a)*") << QString("") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "star03")) << QString("(?:a)*") << QString("a") << 0 << 1 << QStringList();
+ QTest::newRow(qPrintable(stri + "star04")) << QString("(?:a)*") << QString("aaa") << 0 << 3 << QStringList();
+ QTest::newRow(qPrintable(stri + "star05")) << QString("(?:a)*") << QString("bbbbaaa") << 0 << 0
<< QStringList();
- QTest::newRow( stri + "star06" ) << QString("(?:a)*") << QString("bbbbaaabbaaaaa") << 0 << 0
+ QTest::newRow(qPrintable(stri + "star06")) << QString("(?:a)*") << QString("bbbbaaabbaaaaa") << 0 << 0
<< QStringList();
- QTest::newRow( stri + "star07" ) << QString("(?:b)*(?:a)*") << QString("") << 0 << 0
+ QTest::newRow(qPrintable(stri + "star07")) << QString("(?:b)*(?:a)*") << QString("") << 0 << 0
<< QStringList();
- QTest::newRow( stri + "star08" ) << QString("(?:b)*(?:a)*") << QString("a") << 0 << 1
+ QTest::newRow(qPrintable(stri + "star08")) << QString("(?:b)*(?:a)*") << QString("a") << 0 << 1
<< QStringList();
- QTest::newRow( stri + "star09" ) << QString("(?:b)*(?:a)*") << QString("aaa") << 0 << 3
+ QTest::newRow(qPrintable(stri + "star09")) << QString("(?:b)*(?:a)*") << QString("aaa") << 0 << 3
<< QStringList();
- QTest::newRow( stri + "star10" ) << QString("(?:b)*(?:a)*") << QString("bbbbaaa") << 0 << 7
+ QTest::newRow(qPrintable(stri + "star10")) << QString("(?:b)*(?:a)*") << QString("bbbbaaa") << 0 << 7
<< QStringList();
- QTest::newRow( stri + "star11" ) << QString("(?:b)*(?:a)*") << QString("bbbbaaabbaaaaa") << 0 << 7
+ QTest::newRow(qPrintable(stri + "star11")) << QString("(?:b)*(?:a)*") << QString("bbbbaaabbaaaaa") << 0 << 7
<< QStringList();
- QTest::newRow( stri + "star12" ) << QString("(?:a|b)*") << QString("c") << 0 << 0 << QStringList();
- QTest::newRow( stri + "star13" ) << QString("(?:a|b)*") << QString("abac") << 0 << 3
+ QTest::newRow(qPrintable(stri + "star12")) << QString("(?:a|b)*") << QString("c") << 0 << 0 << QStringList();
+ QTest::newRow(qPrintable(stri + "star13")) << QString("(?:a|b)*") << QString("abac") << 0 << 3
<< QStringList();
- QTest::newRow( stri + "star14" ) << QString("(?:a|b|)*") << QString("c") << 0 << 0
+ QTest::newRow(qPrintable(stri + "star14")) << QString("(?:a|b|)*") << QString("c") << 0 << 0
<< QStringList();
- QTest::newRow( stri + "star15" ) << QString("(?:a|b|)*") << QString("abac") << 0 << 3
+ QTest::newRow(qPrintable(stri + "star15")) << QString("(?:a|b|)*") << QString("abac") << 0 << 3
<< QStringList();
- QTest::newRow( stri + "star16" ) << QString("(?:ab|ba|b)*") << QString("abbbababbbaaab") << 0 << 11
+ QTest::newRow(qPrintable(stri + "star16")) << QString("(?:ab|ba|b)*") << QString("abbbababbbaaab") << 0 << 11
<< QStringList();
}
@@ -1373,6 +1374,29 @@ void tst_QRegExp::validityCheck()
QCOMPARE(rx2.cap(), QString(""));
}
+void tst_QRegExp::escapeSequences()
+{
+ QString perlSyntaxSpecialChars("0123456789afnrtvbBdDwWsSx\\|[]{}()^$?+*");
+ QString w3cXmlSchema11SyntaxSpecialChars("cCiIpP"); // as well as the perl ones
+ for (int i = ' '; i <= 127; ++i) {
+ QLatin1Char c(i);
+ if (perlSyntaxSpecialChars.indexOf(c) == -1) {
+ QRegExp rx(QString("\\%1").arg(c), Qt::CaseSensitive, QRegExp::RegExp);
+ // we'll never have c == 'a' since it's a special character
+ QString s = QString("aaa%1aaa").arg(c);
+ QCOMPARE(rx.indexIn(s), 3);
+
+ rx.setPatternSyntax(QRegExp::RegExp2);
+ QCOMPARE(rx.indexIn(s), 3);
+
+ if (w3cXmlSchema11SyntaxSpecialChars.indexOf(c) == -1) {
+ rx.setPatternSyntax(QRegExp::W3CXmlSchema11);
+ QCOMPARE(rx.indexIn(s), 3);
+ }
+ }
+ }
+}
+
QTEST_APPLESS_MAIN(tst_QRegExp)
#include "tst_qregexp.moc"
diff --git a/tests/auto/corelib/tools/qregularexpression/.gitignore b/tests/auto/corelib/tools/qregularexpression/.gitignore
new file mode 100644
index 0000000000..c9249e090e
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/.gitignore
@@ -0,0 +1,2 @@
+tst_qregularexpression_alwaysoptimize
+tst_qregularexpression_defaultoptimize
diff --git a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro
new file mode 100644
index 0000000000..f48b1ee96a
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/alwaysoptimize.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qregularexpression_alwaysoptimize
+QT = core testlib
+HEADERS = ../tst_qregularexpression.h
+SOURCES = \
+ tst_qregularexpression_alwaysoptimize.cpp \
+ ../tst_qregularexpression.cpp
diff --git a/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp
new file mode 100644
index 0000000000..9190f183a1
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/alwaysoptimize/tst_qregularexpression_alwaysoptimize.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../tst_qregularexpression.h"
+
+class tst_QRegularExpression_AlwaysOptimize : public tst_QRegularExpression
+{
+ Q_OBJECT
+
+private slots:
+ void initTestCase();
+};
+
+QT_BEGIN_NAMESPACE
+extern Q_CORE_EXPORT unsigned int qt_qregularexpression_optimize_after_use_count; // from qregularexpression.cpp
+QT_END_NAMESPACE
+
+void tst_QRegularExpression_AlwaysOptimize::initTestCase()
+{
+ qt_qregularexpression_optimize_after_use_count = 1;
+}
+
+QTEST_APPLESS_MAIN(tst_QRegularExpression_AlwaysOptimize)
+
+#include "tst_qregularexpression_alwaysoptimize.moc"
diff --git a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro
new file mode 100644
index 0000000000..dd1a90cfbc
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/defaultoptimize.pro
@@ -0,0 +1,7 @@
+CONFIG += testcase parallel_test
+TARGET = tst_qregularexpression_defaultoptimize
+QT = core testlib
+HEADERS = ../tst_qregularexpression.h
+SOURCES = \
+ tst_qregularexpression_defaultoptimize.cpp \
+ ../tst_qregularexpression.cpp
diff --git a/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp
new file mode 100644
index 0000000000..d0b5bee4b7
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/defaultoptimize/tst_qregularexpression_defaultoptimize.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include "../tst_qregularexpression.h"
+
+class tst_QRegularExpression_DefaultOptimize : public tst_QRegularExpression
+{
+ Q_OBJECT
+};
+
+QTEST_APPLESS_MAIN(tst_QRegularExpression_DefaultOptimize)
+
+#include "tst_qregularexpression_defaultoptimize.moc"
diff --git a/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
new file mode 100644
index 0000000000..0cae10112f
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/qregularexpression.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS = defaultoptimize
+contains(QT_CONFIG,private_tests):SUBDIRS += alwaysoptimize
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
new file mode 100644
index 0000000000..72157c0536
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
@@ -0,0 +1,1198 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <qstring.h>
+#include <qlist.h>
+#include <qstringlist.h>
+#include <qhash.h>
+
+#include "tst_qregularexpression.h"
+
+struct Match
+{
+ Match()
+ {
+ clear();
+ }
+
+ void clear()
+ {
+ isValid = false;
+ hasMatch = false;
+ hasPartialMatch = false;
+ captured.clear();
+ namedCaptured.clear();
+ }
+
+ bool isValid;
+ bool hasMatch;
+ bool hasPartialMatch;
+ QStringList captured;
+ QHash<QString, QString> namedCaptured;
+};
+
+Q_DECLARE_METATYPE(Match)
+Q_DECLARE_METATYPE(QList<Match>)
+
+bool operator==(const QRegularExpressionMatch &rem, const Match &m)
+{
+ if (rem.isValid() != m.isValid)
+ return false;
+ if (!rem.isValid())
+ return true;
+ if ((rem.hasMatch() != m.hasMatch) || (rem.hasPartialMatch() != m.hasPartialMatch))
+ return false;
+ if (rem.hasMatch() || rem.hasPartialMatch()) {
+ if (rem.lastCapturedIndex() != (m.captured.size() - 1))
+ return false;
+ for (int i = 0; i <= rem.lastCapturedIndex(); ++i) {
+ QString remCaptured = rem.captured(i);
+ QString mCaptured = m.captured.at(i);
+ if (remCaptured != mCaptured
+ || remCaptured.isNull() != mCaptured.isNull()
+ || remCaptured.isEmpty() != mCaptured.isEmpty()) {
+ return false;
+ }
+ }
+
+ Q_FOREACH (const QString &name, m.namedCaptured.keys()) {
+ if (rem.captured(name) != m.namedCaptured.value(name))
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool operator==(const Match &m, const QRegularExpressionMatch &rem)
+{
+ return operator==(rem, m);
+}
+
+bool operator!=(const QRegularExpressionMatch &rem, const Match &m)
+{
+ return !operator==(rem, m);
+}
+
+bool operator!=(const Match &m, const QRegularExpressionMatch &rem)
+{
+ return !operator==(m, rem);
+}
+
+
+bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+{
+ QRegularExpressionMatchIterator i = iterator;
+ if (i.isValid() != (!expectedMatchList.isEmpty()))
+ return false;
+
+ foreach (const Match &expectedMatch, expectedMatchList)
+ {
+ if (!i.hasNext())
+ return false;
+
+ QRegularExpressionMatch match = i.next();
+ if (match != expectedMatch)
+ return false;
+ }
+
+ if (i.hasNext())
+ return false;
+
+ return true;
+}
+
+bool operator==(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+{
+ return operator==(iterator, expectedMatchList);
+}
+
+bool operator!=(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+{
+ return !operator==(iterator, expectedMatchList);
+}
+
+bool operator!=(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+{
+ return !operator==(expectedMatchList, iterator);
+}
+
+void consistencyCheck(const QRegularExpressionMatch &match)
+{
+ if (match.isValid()) {
+ QVERIFY(match.regularExpression().isValid());
+ QVERIFY(!(match.hasMatch() && match.hasPartialMatch()));
+
+ if (match.hasMatch() || match.hasPartialMatch()) {
+ QVERIFY(match.lastCapturedIndex() >= 0);
+ if (match.hasPartialMatch())
+ QVERIFY(match.lastCapturedIndex() == 0);
+
+ for (int i = 0; i <= match.lastCapturedIndex(); ++i) {
+ int startPos = match.capturedStart(i);
+ int endPos = match.capturedEnd(i);
+ int length = match.capturedLength(i);
+ QString captured = match.captured(i);
+ QStringRef capturedRef = match.capturedRef(i);
+
+ if (!captured.isNull()) {
+ QVERIFY(startPos >= 0);
+ QVERIFY(endPos >= 0);
+ QVERIFY(length >= 0);
+ QVERIFY(endPos >= startPos);
+ QVERIFY((endPos - startPos) == length);
+ QVERIFY(captured == capturedRef);
+ } else {
+ QVERIFY(startPos == -1);
+ QVERIFY(endPos == -1);
+ QVERIFY((endPos - startPos) == length);
+ QVERIFY(capturedRef.isNull());
+ }
+ }
+ }
+ } else {
+ QVERIFY(!match.hasMatch());
+ QVERIFY(!match.hasPartialMatch());
+ QVERIFY(match.captured(0).isNull());
+ QVERIFY(match.capturedStart(0) == -1);
+ QVERIFY(match.capturedEnd(0) == -1);
+ QVERIFY(match.capturedLength(0) == 0);
+ }
+}
+
+void consistencyCheck(const QRegularExpressionMatchIterator &iterator)
+{
+ QRegularExpressionMatchIterator i(iterator); // make a copy, we modify it
+ if (i.isValid()) {
+ while (i.hasNext()) {
+ QRegularExpressionMatch peeked = i.peekNext();
+ QRegularExpressionMatch match = i.next();
+ consistencyCheck(peeked);
+ consistencyCheck(match);
+ QVERIFY(match.isValid());
+ QVERIFY(match.hasMatch() || match.hasPartialMatch());
+ QCOMPARE(i.regularExpression(), match.regularExpression());
+ QCOMPARE(i.matchOptions(), match.matchOptions());
+ QCOMPARE(i.matchType(), match.matchType());
+
+ QVERIFY(peeked.isValid() == match.isValid());
+ QVERIFY(peeked.hasMatch() == match.hasMatch());
+ QVERIFY(peeked.hasPartialMatch() == match.hasPartialMatch());
+ QVERIFY(peeked.lastCapturedIndex() == match.lastCapturedIndex());
+ for (int i = 0; i <= peeked.lastCapturedIndex(); ++i) {
+ QVERIFY(peeked.captured(i) == match.captured(i));
+ QVERIFY(peeked.capturedStart(i) == match.capturedStart(i));
+ QVERIFY(peeked.capturedEnd(i) == match.capturedEnd(i));
+ }
+ }
+ } else {
+ QVERIFY(!i.hasNext());
+ QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionMatchIterator::peekNext() called on an iterator already at end");
+ QRegularExpressionMatch peeked = i.peekNext();
+ QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionMatchIterator::next() called on an iterator already at end");
+ QRegularExpressionMatch match = i.next();
+ consistencyCheck(peeked);
+ consistencyCheck(match);
+ QVERIFY(!match.isValid());
+ QVERIFY(!peeked.isValid());
+ }
+
+}
+
+void tst_QRegularExpression::provideRegularExpressions()
+{
+ QTest::addColumn<QString>("pattern");
+ QTest::addColumn<QRegularExpression::PatternOptions>("patternOptions");
+
+ QTest::newRow("emptynull01") << QString()
+ << QRegularExpression::PatternOptions(0);
+ QTest::newRow("emptynull02") << QString()
+ << QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
+ | QRegularExpression::DotMatchesEverythingOption
+ | QRegularExpression::MultilineOption);
+ QTest::newRow("emptynull03") << ""
+ << QRegularExpression::PatternOptions(0);
+ QTest::newRow("emptynull04") << ""
+ << QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
+ | QRegularExpression::DotMatchesEverythingOption
+ | QRegularExpression::MultilineOption);
+
+ QTest::newRow("regexp01") << "a pattern"
+ << QRegularExpression::PatternOptions(0);
+ QTest::newRow("regexp02") << "^a (.*) more complicated(?<P>pattern)$"
+ << QRegularExpression::PatternOptions(0);
+ QTest::newRow("regexp03") << "(?:a) pAttErN"
+ << QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption);
+ QTest::newRow("regexp04") << "a\nmultiline\npattern"
+ << QRegularExpression::PatternOptions(QRegularExpression::MultilineOption);
+ QTest::newRow("regexp05") << "an extended # IGNOREME\npattern"
+ << QRegularExpression::PatternOptions(QRegularExpression::ExtendedPatternSyntaxOption);
+ QTest::newRow("regexp06") << "a [sS]ingleline .* match"
+ << QRegularExpression::PatternOptions(QRegularExpression::DotMatchesEverythingOption);
+ QTest::newRow("regexp07") << "multiple.*options"
+ << QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
+ | QRegularExpression::DotMatchesEverythingOption
+ | QRegularExpression::MultilineOption
+ | QRegularExpression::DontCaptureOption
+ | QRegularExpression::InvertedGreedinessOption);
+
+ QTest::newRow("unicode01") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
+ << QRegularExpression::PatternOptions(0);
+ QTest::newRow("unicode02") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
+ << QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
+ | QRegularExpression::DotMatchesEverythingOption
+ | QRegularExpression::InvertedGreedinessOption);
+ QTest::newRow("unicode03") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
+ << QRegularExpression::PatternOptions(0);
+ QTest::newRow("unicode04") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
+ << QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
+ | QRegularExpression::DotMatchesEverythingOption
+ | QRegularExpression::InvertedGreedinessOption);
+}
+
+void tst_QRegularExpression::gettersSetters_data()
+{
+ provideRegularExpressions();
+}
+
+void tst_QRegularExpression::gettersSetters()
+{
+ QFETCH(QString, pattern);
+ QFETCH(QRegularExpression::PatternOptions, patternOptions);
+ {
+ QRegularExpression re;
+ re.setPattern(pattern);
+ QCOMPARE(re.pattern(), pattern);
+ QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption);
+ }
+ {
+ QRegularExpression re;
+ re.setPatternOptions(patternOptions);
+ QCOMPARE(re.pattern(), QString());
+ QCOMPARE(re.patternOptions(), patternOptions);
+ }
+ {
+ QRegularExpression re(pattern);
+ QCOMPARE(re.pattern(), pattern);
+ QCOMPARE(re.patternOptions(), QRegularExpression::NoPatternOption);
+ }
+ {
+ QRegularExpression re(pattern, patternOptions);
+ QCOMPARE(re.pattern(), pattern);
+ QCOMPARE(re.patternOptions(), patternOptions);
+ }
+}
+
+void tst_QRegularExpression::escape_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QString>("escaped");
+ QTest::newRow("escape01") << "a normal pattern"
+ << "a\\ normal\\ pattern";
+
+ QTest::newRow("escape02") << "abcdefghijklmnopqrstuvzABCDEFGHIJKLMNOPQRSTUVZ1234567890_"
+ << "abcdefghijklmnopqrstuvzABCDEFGHIJKLMNOPQRSTUVZ1234567890_";
+
+ QTest::newRow("escape03") << "^\\ba\\b.*(?<NAME>reg|exp)$"
+ << "\\^\\\\ba\\\\b\\.\\*\\(\\?\\<NAME\\>reg\\|exp\\)\\$";
+
+ QString nulString("abcXabcXXabc");
+ nulString[3] = nulString[7] = nulString[8] = QChar(0, 0);
+ QTest::newRow("NUL") << nulString
+ << "abc\\0abc\\0\\0abc";
+
+ QTest::newRow("unicode01") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
+ << QString::fromUtf8("\\^s\\[ome\\]\\ latin\\-1\\ \\\xc3\x80\\\xc3\x88\\\xc3\x8c\\\xc3\x92\\\xc3\x99\\ chars\\$");
+ QTest::newRow("unicode02") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
+ << QString::fromUtf8("Unicode\\ \\\xf0\x9d\x85\x9d\\ \\\xf0\x9d\x85\x9e\\\xf0\x9d\x85\x9f");
+
+ QString unicodeAndNulString = QString::fromUtf8("^\xc3\x80\xc3\x88\xc3\x8cN\xc3\x92NN\xc3\x99 chars$");
+ unicodeAndNulString[4] = unicodeAndNulString[6] = unicodeAndNulString[7] = QChar(0, 0);
+ QTest::newRow("unicode03") << unicodeAndNulString
+ << QString::fromUtf8("\\^\\\xc3\x80\\\xc3\x88\\\xc3\x8c\\0\\\xc3\x92\\0\\0\\\xc3\x99\\ chars\\$");
+}
+
+void tst_QRegularExpression::escape()
+{
+ QFETCH(QString, string);
+ QFETCH(QString, escaped);
+ QCOMPARE(QRegularExpression::escape(string), escaped);
+ QRegularExpression re(escaped);
+ QCOMPARE(re.isValid(), true);
+}
+
+void tst_QRegularExpression::validity_data()
+{
+ QTest::addColumn<QString>("pattern");
+ QTest::addColumn<bool>("validity");
+
+ QTest::newRow("valid01") << "a pattern" << true;
+ QTest::newRow("valid02") << "(a|pattern)" << true;
+ QTest::newRow("valid03") << "a [pP]attern" << true;
+ QTest::newRow("valid04") << "^(?<article>a).*(?<noun>pattern)$" << true;
+ QTest::newRow("valid05") << "a \\P{Ll}attern" << true;
+
+ QTest::newRow("invalid01") << "a pattern\\" << false;
+ QTest::newRow("invalid02") << "(a|pattern" << false;
+ QTest::newRow("invalid03") << "a \\P{BLAH}attern" << false;
+
+ QString pattern;
+ // 0xD800 (high surrogate) not followed by a low surrogate
+ pattern = "abcdef";
+ pattern[3] = QChar(0x00, 0xD8);
+ QTest::newRow("invalidUnicode01") << pattern << false;
+}
+
+void tst_QRegularExpression::validity()
+{
+ QFETCH(QString, pattern);
+ QFETCH(bool, validity);
+ QRegularExpression re(pattern);
+ QCOMPARE(re.isValid(), validity);
+ if (!validity)
+ QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object");
+ QRegularExpressionMatch match = re.match("a pattern");
+ QCOMPARE(match.isValid(), validity);
+ consistencyCheck(match);
+
+ if (!validity)
+ QTest::ignoreMessage(QtWarningMsg, "QRegularExpressionPrivate::doMatch(): called on an invalid QRegularExpression object");
+ QRegularExpressionMatchIterator iterator = re.globalMatch("a pattern");
+ QCOMPARE(iterator.isValid(), validity);
+}
+
+void tst_QRegularExpression::patternOptions_data()
+{
+ QTest::addColumn<QRegularExpression>("regexp");
+ QTest::addColumn<QString>("subject");
+ QTest::addColumn<Match>("match");
+
+ // none of these would successfully match if the respective
+ // pattern option is not set
+
+ Match m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << QString::fromUtf8("AbC\xc3\xa0");
+ QTest::newRow("/i") << QRegularExpression(QString::fromUtf8("abc\xc3\x80"), QRegularExpression::CaseInsensitiveOption)
+ << QString::fromUtf8("AbC\xc3\xa0")
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "abc123\n678def";
+ QTest::newRow("/s") << QRegularExpression("\\Aabc.*def\\z", QRegularExpression::DotMatchesEverythingOption)
+ << "abc123\n678def"
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "jumped over";
+ QTest::newRow("/m") << QRegularExpression("^\\w+ \\w+$", QRegularExpression::MultilineOption)
+ << "the quick fox\njumped over\nthe lazy\ndog"
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "abc 123456";
+ QTest::newRow("/x") << QRegularExpression("\\w+ # a word\n"
+ "\\ # a space\n"
+ "\\w+ # another word",
+ QRegularExpression::ExtendedPatternSyntaxOption)
+ << "abc 123456 def"
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "the quick fox" << "the" << "quick fox";
+ QTest::newRow("/U") << QRegularExpression("(.+) (.+?)", QRegularExpression::InvertedGreedinessOption)
+ << "the quick fox"
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "the quick fox" << "quick";
+ m.namedCaptured["named"] = "quick";
+ QTest::newRow("no cap") << QRegularExpression("(\\w+) (?<named>\\w+) (\\w+)", QRegularExpression::DontCaptureOption)
+ << "the quick fox"
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << QString::fromUtf8("abc\xc3\x80\xc3\xa0 12\xdb\xb1\xdb\xb2\xf0\x9d\x9f\x98")
+ << QString::fromUtf8("abc\xc3\x80\xc3\xa0")
+ << QString::fromUtf8("12\xdb\xb1\xdb\xb2\xf0\x9d\x9f\x98");
+ QTest::newRow("unicode properties") << QRegularExpression("(\\w+) (\\d+)", QRegularExpression::UseUnicodePropertiesOption)
+ << QString::fromUtf8("abc\xc3\x80\xc3\xa0 12\xdb\xb1\xdb\xb2\xf0\x9d\x9f\x98")
+ << m;
+}
+
+void tst_QRegularExpression::patternOptions()
+{
+ QFETCH(QRegularExpression, regexp);
+ QFETCH(QString, subject);
+ QFETCH(Match, match);
+
+ QRegularExpressionMatch m = regexp.match(subject);
+ consistencyCheck(m);
+ QVERIFY(m == match);
+}
+
+void tst_QRegularExpression::normalMatch_data()
+{
+ QTest::addColumn<QRegularExpression>("regexp");
+ QTest::addColumn<QString>("subject");
+ QTest::addColumn<int>("offset");
+ QTest::addColumn<QRegularExpression::MatchOptions>("matchOptions");
+ QTest::addColumn<Match>("match");
+
+ Match m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "string" << "string";
+ QTest::newRow("match01") << QRegularExpression("(\\bstring\\b)")
+ << "a string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "a string" << "a" << "string";
+ QTest::newRow("match02") << QRegularExpression("(\\w+) (\\w+)")
+ << "a string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "a string" << "a" << "string";
+ m.namedCaptured["article"] = "a";
+ m.namedCaptured["noun"] = "string";
+ QTest::newRow("match03") << QRegularExpression("(?<article>\\w+) (?<noun>\\w+)")
+ << "a string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << " string" << QString() << "string";
+ QTest::newRow("match04") << QRegularExpression("(\\w+)? (\\w+)")
+ << " string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << " string" << QString("") << "string";
+ QTest::newRow("match05") << QRegularExpression("(\\w*) (\\w+)")
+ << " string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "c123def" << "c12" << "3" << "def";
+ QTest::newRow("match06") << QRegularExpression("(\\w*)(\\d+)(\\w*)")
+ << "abc123def"
+ << 2
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << QString("");
+ QTest::newRow("match07") << QRegularExpression("\\w*")
+ << "abc123def"
+ << 9
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << QString("a string") << QString("a string") << QString("");
+ QTest::newRow("match08") << QRegularExpression("(.*)(.*)")
+ << "a string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << QString("a string") << QString("") << QString("a string");
+ QTest::newRow("match09") << QRegularExpression("(.*?)(.*)")
+ << "a string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ // ***
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch01") << QRegularExpression("\\d+")
+ << "a string"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch02") << QRegularExpression("(\\w+) (\\w+)")
+ << "a string"
+ << 1
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch03") << QRegularExpression("\\w+")
+ << "abc123def"
+ << 9
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ // ***
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("anchoredmatch01") << QRegularExpression("\\d+")
+ << "abc123def"
+ << 0
+ << QRegularExpression::MatchOptions(QRegularExpression::AnchoredMatchOption)
+ << m;
+}
+
+
+void tst_QRegularExpression::normalMatch()
+{
+ QFETCH(QRegularExpression, regexp);
+ QFETCH(QString, subject);
+ QFETCH(int, offset);
+ QFETCH(QRegularExpression::MatchOptions, matchOptions);
+ QFETCH(Match, match);
+
+ QRegularExpressionMatch m = regexp.match(subject, offset, QRegularExpression::NormalMatch, matchOptions);
+ consistencyCheck(m);
+ QVERIFY(m == match);
+}
+
+
+void tst_QRegularExpression::partialMatch_data()
+{
+ QTest::addColumn<QRegularExpression>("regexp");
+ QTest::addColumn<QString>("subject");
+ QTest::addColumn<int>("offset");
+ QTest::addColumn<QRegularExpression::MatchType>("matchType");
+ QTest::addColumn<QRegularExpression::MatchOptions>("matchOptions");
+ QTest::addColumn<Match>("match");
+
+ Match m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "str";
+ QTest::newRow("softmatch01") << QRegularExpression("string")
+ << "a str"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << " str";
+ QTest::newRow("softmatch02") << QRegularExpression("\\bstring\\b")
+ << "a str"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << " str";
+ QTest::newRow("softmatch03") << QRegularExpression("(\\bstring\\b)")
+ << "a str"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "8 Dec 19";
+ QTest::newRow("softmatch04") << QRegularExpression("^(\\d{1,2}) (\\w{3}) (\\d{4})$")
+ << "8 Dec 19"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "8 Dec 1985" << "8" << "Dec" << "1985";
+ QTest::newRow("softmatch05") << QRegularExpression("^(\\d{1,2}) (\\w{3}) (\\d{4})$")
+ << "8 Dec 1985"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured << "def";
+ QTest::newRow("softmatch06") << QRegularExpression("abc\\w+X|def")
+ << "abcdef"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "abcdef";
+ QTest::newRow("softmatch07") << QRegularExpression("abc\\w+X|defY")
+ << "abcdef"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "def";
+ QTest::newRow("softmatch08") << QRegularExpression("abc\\w+X|defY")
+ << "abcdef"
+ << 1
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ // ***
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "str";
+ QTest::newRow("hardmatch01") << QRegularExpression("string")
+ << "a str"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << " str";
+ QTest::newRow("hardmatch02") << QRegularExpression("\\bstring\\b")
+ << "a str"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << " str";
+ QTest::newRow("hardmatch03") << QRegularExpression("(\\bstring\\b)")
+ << "a str"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "8 Dec 19";
+ QTest::newRow("hardmatch04") << QRegularExpression("^(\\d{1,2}) (\\w{3}) (\\d{4})$")
+ << "8 Dec 19"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "8 Dec 1985";
+ QTest::newRow("hardmatch05") << QRegularExpression("^(\\d{1,2}) (\\w{3}) (\\d{4})$")
+ << "8 Dec 1985"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "abcdef";
+ QTest::newRow("hardmatch06") << QRegularExpression("abc\\w+X|def")
+ << "abcdef"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "abcdef";
+ QTest::newRow("hardmatch07") << QRegularExpression("abc\\w+X|defY")
+ << "abcdef"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "def";
+ QTest::newRow("hardmatch08") << QRegularExpression("abc\\w+X|defY")
+ << "abcdef"
+ << 1
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "ab";
+ QTest::newRow("hardmatch09") << QRegularExpression("abc|ab")
+ << "ab"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "abc";
+ QTest::newRow("hardmatch10") << QRegularExpression("abc(def)?")
+ << "abc"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true; m.hasPartialMatch = true;
+ m.captured << "abc";
+ QTest::newRow("hardmatch11") << QRegularExpression("(abc)*")
+ << "abc"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+
+ // ***
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch01") << QRegularExpression("abc\\w+X|defY")
+ << "123456"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch02") << QRegularExpression("abc\\w+X|defY")
+ << "123456"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch03") << QRegularExpression("abc\\w+X|defY")
+ << "ab123"
+ << 0
+ << QRegularExpression::PartialPreferCompleteMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+ m.clear();
+ m.isValid = true;
+ QTest::newRow("nomatch04") << QRegularExpression("abc\\w+X|defY")
+ << "ab123"
+ << 0
+ << QRegularExpression::PartialPreferFirstMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << m;
+
+}
+
+void tst_QRegularExpression::partialMatch()
+{
+ QFETCH(QRegularExpression, regexp);
+ QFETCH(QString, subject);
+ QFETCH(int, offset);
+ QFETCH(QRegularExpression::MatchType, matchType);
+ QFETCH(QRegularExpression::MatchOptions, matchOptions);
+ QFETCH(Match, match);
+
+ QRegularExpressionMatch m = regexp.match(subject, offset, matchType, matchOptions);
+ consistencyCheck(m);
+ QVERIFY(m == match);
+}
+
+void tst_QRegularExpression::globalMatch_data()
+{
+ QTest::addColumn<QRegularExpression>("regexp");
+ QTest::addColumn<QString>("subject");
+ QTest::addColumn<int>("offset");
+ QTest::addColumn<QRegularExpression::MatchType>("matchType");
+ QTest::addColumn<QRegularExpression::MatchOptions>("matchOptions");
+ QTest::addColumn<QList<Match> >("matchList");
+
+ QList<Match> matchList;
+ Match m;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the";
+ matchList << m;
+ m.captured = QStringList() << "quick";
+ matchList << m;
+ m.captured = QStringList() << "fox";
+ matchList << m;
+ QTest::newRow("globalmatch01") << QRegularExpression("\\w+")
+ << "the quick fox"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the" << "t" << "he";
+ matchList << m;
+ m.captured = QStringList() << "quick" << "q" << "uick";
+ matchList << m;
+ m.captured = QStringList() << "fox" << "f" << "ox";
+ matchList << m;
+ QTest::newRow("globalmatch02") << QRegularExpression("(\\w+?)(\\w+)")
+ << "the quick fox"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "c";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "c";
+ matchList << m;
+ m.captured = QStringList() << "aabb";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+
+ QTest::newRow("globalmatch_emptycaptures01") << QRegularExpression("a*b*|c")
+ << "ccaabbd"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "quick";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "fox";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+
+ QTest::newRow("globalmatch_emptycaptures02") << QRegularExpression(".*")
+ << "the\nquick\nfox"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "quick";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "fox";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+
+ QTest::newRow("globalmatch_emptycaptures03") << QRegularExpression(".*")
+ << "the\nquick\nfox\n"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "quick";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "fox";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+
+ QTest::newRow("globalmatch_emptycaptures04") << QRegularExpression("(*CRLF).*")
+ << "the\r\nquick\r\nfox"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "quick";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "fox";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+
+ QTest::newRow("globalmatch_emptycaptures05") << QRegularExpression("(*CRLF).*")
+ << "the\r\nquick\r\nfox\r\n"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+
+ matchList.clear();
+ m.clear();
+ m.isValid = true; m.hasMatch = true;
+ m.captured = QStringList() << "the";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "quick";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "fox";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+ m.captured = QStringList() << "jumped";
+ matchList << m;
+ m.captured = QStringList() << "";
+ matchList << m;
+
+ QTest::newRow("globalmatch_emptycaptures06") << QRegularExpression("(*ANYCRLF).*")
+ << "the\r\nquick\nfox\rjumped"
+ << 0
+ << QRegularExpression::NormalMatch
+ << QRegularExpression::MatchOptions(QRegularExpression::NoMatchOption)
+ << matchList;
+}
+
+void tst_QRegularExpression::globalMatch()
+{
+ QFETCH(QRegularExpression, regexp);
+ QFETCH(QString, subject);
+ QFETCH(int, offset);
+ QFETCH(QRegularExpression::MatchType, matchType);
+ QFETCH(QRegularExpression::MatchOptions, matchOptions);
+ QFETCH(QList<Match>, matchList);
+
+ QRegularExpressionMatchIterator iterator = regexp.globalMatch(subject, offset, matchType, matchOptions);
+ consistencyCheck(iterator);
+ QVERIFY(iterator == matchList);
+}
+
+void tst_QRegularExpression::serialize_data()
+{
+ provideRegularExpressions();
+}
+
+void tst_QRegularExpression::serialize()
+{
+ QFETCH(QString, pattern);
+ QFETCH(QRegularExpression::PatternOptions, patternOptions);
+ QRegularExpression outRe(pattern, patternOptions);
+ QByteArray buffer;
+ {
+ QDataStream out(&buffer, QIODevice::WriteOnly);
+ out << outRe;
+ }
+ QRegularExpression inRe;
+ {
+ QDataStream in(&buffer, QIODevice::ReadOnly);
+ in >> inRe;
+ }
+ QCOMPARE(inRe, outRe);
+}
+
+static void verifyEquality(const QRegularExpression &re1, const QRegularExpression &re2)
+{
+ QVERIFY(re1 == re2);
+ QVERIFY(re2 == re1);
+ QVERIFY(!(re1 != re2));
+ QVERIFY(!(re2 != re1));
+
+ QRegularExpression re3(re1);
+
+ QVERIFY(re1 == re3);
+ QVERIFY(re3 == re1);
+ QVERIFY(!(re1 != re3));
+ QVERIFY(!(re3 != re1));
+
+ QVERIFY(re2 == re3);
+ QVERIFY(re3 == re2);
+ QVERIFY(!(re2 != re3));
+ QVERIFY(!(re3 != re2));
+
+ re3 = re2;
+ QVERIFY(re1 == re3);
+ QVERIFY(re3 == re1);
+ QVERIFY(!(re1 != re3));
+ QVERIFY(!(re3 != re1));
+
+ QVERIFY(re2 == re3);
+ QVERIFY(re3 == re2);
+ QVERIFY(!(re2 != re3));
+ QVERIFY(!(re3 != re2));
+}
+
+void tst_QRegularExpression::operatoreq_data()
+{
+ provideRegularExpressions();
+}
+
+void tst_QRegularExpression::operatoreq()
+{
+ QFETCH(QString, pattern);
+ QFETCH(QRegularExpression::PatternOptions, patternOptions);
+ {
+ QRegularExpression re1(pattern);
+ QRegularExpression re2(pattern);
+ verifyEquality(re1, re2);
+ }
+ {
+ QRegularExpression re1(QString(), patternOptions);
+ QRegularExpression re2(QString(), patternOptions);
+ verifyEquality(re1, re2);
+ }
+ {
+ QRegularExpression re1(pattern, patternOptions);
+ QRegularExpression re2(pattern, patternOptions);
+ verifyEquality(re1, re2);
+ }
+}
+
+void tst_QRegularExpression::captureCount_data()
+{
+ QTest::addColumn<QString>("pattern");
+ QTest::addColumn<int>("captureCount");
+ QTest::newRow("captureCount01") << "a pattern" << 0;
+ QTest::newRow("captureCount02") << "a.*pattern" << 0;
+ QTest::newRow("captureCount03") << "(a) pattern" << 1;
+ QTest::newRow("captureCount04") << "(a).*(pattern)" << 2;
+ QTest::newRow("captureCount05") << "^(?<article>\\w+) (?<noun>\\w+)$" << 2;
+ QTest::newRow("captureCount06") << "^(\\w+) (?<word>\\w+) (.)$" << 3;
+ QTest::newRow("captureCount07") << "(?:non capturing) (capturing) (?<n>named) (?:non (capturing))" << 3;
+ QTest::newRow("captureCount08") << "(?|(a)(b)|(c)(d))" << 2;
+ QTest::newRow("captureCount09") << "(?|(a)(b)|(c)(d)(?:e))" << 2;
+ QTest::newRow("captureCount10") << "(?|(a)(b)|(c)(d)(e)) (f)(g)" << 5;
+ QTest::newRow("captureCount11") << "(?|(a)(b)|(c)(d)(e)) (f)(?:g)" << 4;
+ QTest::newRow("captureCount_invalid01") << "(.*" << -1;
+ QTest::newRow("captureCount_invalid02") << "\\" << -1;
+ QTest::newRow("captureCount_invalid03") << "(?<noun)" << -1;
+}
+
+void tst_QRegularExpression::captureCount()
+{
+ QFETCH(QString, pattern);
+ QRegularExpression re(pattern);
+ QTEST(re.captureCount(), "captureCount");
+ if (!re.isValid())
+ QCOMPARE(re.captureCount(), -1);
+}
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h
new file mode 100644
index 0000000000..1a703a8f92
--- /dev/null
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qobject.h>
+#include <qregularexpression.h>
+
+Q_DECLARE_METATYPE(QRegularExpression::PatternOptions)
+Q_DECLARE_METATYPE(QRegularExpression::MatchType)
+Q_DECLARE_METATYPE(QRegularExpression::MatchOptions)
+
+class tst_QRegularExpression : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void gettersSetters_data();
+ void gettersSetters();
+ void escape_data();
+ void escape();
+ void validity_data();
+ void validity();
+ void patternOptions_data();
+ void patternOptions();
+ void normalMatch_data();
+ void normalMatch();
+ void partialMatch_data();
+ void partialMatch();
+ void globalMatch_data();
+ void globalMatch();
+ void serialize_data();
+ void serialize();
+ void operatoreq_data();
+ void operatoreq();
+ void captureCount_data();
+ void captureCount();
+
+private:
+ void provideRegularExpressions();
+};
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 88c5e5b595..a8f706ff80 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -4217,16 +4217,7 @@ void tst_QString::tortureSprintfDouble()
# error "Q_BYTE_ORDER not defined"
# endif
-# ifdef QT_ARMFPA
- buff[0] = data->bytes[4];
- buff[1] = data->bytes[5];
- buff[2] = data->bytes[6];
- buff[3] = data->bytes[7];
- buff[4] = data->bytes[0];
- buff[5] = data->bytes[1];
- buff[6] = data->bytes[2];
- buff[7] = data->bytes[3];
-# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+# if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
for (uint i = 0; i < 8; ++i)
buff[i] = data->bytes[i];
# else
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index afc16078b8..556b9ac16a 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -73,6 +73,7 @@ void runScenario()
QString string(l1string);
QStringRef stringref(&string, 2, 10);
QLatin1Char achar('c');
+ QChar::SpecialCharacter special(QChar::Nbsp);
QString r2(QLatin1String(LITERAL LITERAL));
QString r3 = QString::fromUtf8(UTF8_LITERAL UTF8_LITERAL);
QString r;
@@ -97,6 +98,8 @@ void runScenario()
QCOMPARE(r, QString(string P achar));
r = achar + string;
QCOMPARE(r, QString(achar P string));
+ r = special + string;
+ QCOMPARE(r, QString(special P string));
#ifdef Q_COMPILER_UNICODE_STRINGS
r = QStringLiteral(UNICODE_LITERAL);
diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro
index e2002a98b6..38225e12f7 100644
--- a/tests/auto/corelib/tools/tools.pro
+++ b/tests/auto/corelib/tools/tools.pro
@@ -21,10 +21,12 @@ SUBDIRS=\
qlocale \
qmap \
qmargins \
+ qpair \
qpoint \
qqueue \
qrect \
qregexp \
+ qregularexpression \
qringbuffer \
qscopedpointer \
qscopedvaluerollback \
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
index e1d128dac7..65b68b7f34 100644
--- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
@@ -829,16 +829,8 @@ bool tst_QDBusConnection::callMethod(const QDBusConnection &conn, const QString
QDBusMessage reply = conn.call(msg, QDBus::Block/*WithGui*/);
if (reply.type() != QDBusMessage::ReplyMessage)
return false;
- if (MyObject::path == path) {
- QTest::compare_helper(true, "COMPARE()", __FILE__, __LINE__);
- } else {
- QTest::compare_helper(false, "Compared values are not the same",
- QTest::toString(MyObject::path), QTest::toString(path),
- "MyObject::path", "path", __FILE__, __LINE__);
- return false;
- }
-
- return true;
+ QTest::qCompare(MyObject::path, path, "MyObject::path", "path", __FILE__, __LINE__);
+ return (MyObject::path == path);
}
bool tst_QDBusConnection::callMethodPeer(const QDBusConnection &conn, const QString &path)
@@ -848,16 +840,8 @@ bool tst_QDBusConnection::callMethodPeer(const QDBusConnection &conn, const QStr
if (reply.type() != QDBusMessage::ReplyMessage)
return false;
- if (MyObject::path == path) {
- QTest::compare_helper(true, "COMPARE()", __FILE__, __LINE__);
- } else {
- QTest::compare_helper(false, "Compared values are not the same",
- QTest::toString(MyObject::path), QTest::toString(path),
- "MyObject::path", "path", __FILE__, __LINE__);
- return false;
- }
-
- return true;
+ QTest::qCompare(MyObject::path, path, "MyObject::path", "path", __FILE__, __LINE__);
+ return (MyObject::path == path);
}
class TestObject : public QObject
diff --git a/tests/auto/gui/image/image.pro b/tests/auto/gui/image/image.pro
index fe089f5e75..fa8f8df29d 100644
--- a/tests/auto/gui/image/image.pro
+++ b/tests/auto/gui/image/image.pro
@@ -9,7 +9,6 @@ SUBDIRS=\
qimageiohandler \
qimagewriter \
qmovie \
- qvolatileimage \
qicon \
qpicture \
diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
index 96171740e2..6f6662a80f 100644
--- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp
@@ -772,7 +772,7 @@ void tst_QImageReader::animatedGif()
}
}
-// http://bugreports.qt.nokia.com/browse/QTBUG-6696
+// http://bugreports.qt-project.org/browse/QTBUG-6696
// Check the count of images in various call orders...
void tst_QImageReader::gifImageCount()
{
@@ -1368,7 +1368,7 @@ void tst_QImageReader::readFromResources()
SKIP_IF_UNSUPPORTED(format);
for (int i = 0; i < 2; ++i) {
- QString file = i ? (":/images/" + fileName) : (prefix + fileName);
+ QString file = i ? QString(QStringLiteral(":/images/") + fileName) : QString(prefix + fileName);
{
// suppress warnings if we expect them
if (!message.isEmpty()) {
diff --git a/tests/auto/gui/image/qpixmap/qpixmap.pro b/tests/auto/gui/image/qpixmap/qpixmap.pro
index 91d93a781d..15098770c6 100644
--- a/tests/auto/gui/image/qpixmap/qpixmap.pro
+++ b/tests/auto/gui/image/qpixmap/qpixmap.pro
@@ -10,5 +10,3 @@ SOURCES += tst_qpixmap.cpp
RESOURCES += qpixmap.qrc
TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/*
-
-win32:CONFIG += insignificant_test # QTBUG-24183
diff --git a/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro b/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro
deleted file mode 100644
index 3d982d7951..0000000000
--- a/tests/auto/gui/image/qvolatileimage/qvolatileimage.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-CONFIG += testcase
-TARGET = tst_qvolatileimage
-
-QT += gui-private widgets testlib
-
-SOURCES += tst_qvolatileimage.cpp
diff --git a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp
deleted file mode 100644
index f203cfec0f..0000000000
--- a/tests/auto/gui/image/qvolatileimage/tst_qvolatileimage.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <QtTest/QtTest>
-#include <QtGui/qpainter.h>
-#include <QtGui/qpaintengine.h>
-#include <QtGui/private/qvolatileimage_p.h>
-
-class tst_QVolatileImage : public QObject
-{
- Q_OBJECT
-
-public:
- tst_QVolatileImage() { }
-
-private slots:
- void create();
- void ensureFormat();
- void dataAccess();
- void sharing();
- void fill();
- void copy();
-};
-
-void tst_QVolatileImage::create()
-{
- QVolatileImage nullImg;
- QVERIFY(nullImg.isNull());
-
- QVolatileImage img(100, 200, QImage::Format_ARGB32);
- QVERIFY(!img.isNull());
- QCOMPARE(img.width(), 100);
- QCOMPARE(img.height(), 200);
- QCOMPARE(img.format(), QImage::Format_ARGB32);
- QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height());
- QCOMPARE(img.hasAlphaChannel(), true);
- QCOMPARE(img.depth(), 32);
-
- QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
- img = QVolatileImage(source);
- QVERIFY(!img.isNull());
- QCOMPARE(img.width(), 12);
- QCOMPARE(img.height(), 23);
- QCOMPARE(img.format(), source.format());
- QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height());
- QVERIFY(img.imageRef() == source);
- QVERIFY(img.toImage() == source);
- QCOMPARE(img.hasAlphaChannel(), true);
- QCOMPARE(img.hasAlphaChannel(), img.imageRef().hasAlphaChannel());
- QCOMPARE(img.hasAlphaChannel(), img.toImage().hasAlphaChannel());
- QCOMPARE(img.depth(), 32);
-}
-
-void tst_QVolatileImage::ensureFormat()
-{
- QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
- QVolatileImage img(source);
- QVERIFY(!img.isNull());
- QVERIFY(img.imageRef() == source);
- QVERIFY(img.toImage() == source);
-
- QVERIFY(img.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op
- QVERIFY(img.imageRef() == source);
- QVERIFY(img.toImage() == source);
- QVERIFY(img.format() == QImage::Format_ARGB32_Premultiplied);
-
- QVERIFY(img.ensureFormat(QImage::Format_RGB32)); // new data under-the-hood
- QVERIFY(img.imageRef() != source);
- QVERIFY(img.toImage() != source);
- QVERIFY(img.format() == QImage::Format_RGB32);
-}
-
-void tst_QVolatileImage::dataAccess()
-{
- QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
- QVolatileImage img(source);
- QVERIFY(!img.isNull());
- img.beginDataAccess();
- QVERIFY(img.constBits());
- QVERIFY(img.imageRef().constBits());
- QVERIFY(img.bits());
- QVERIFY(img.imageRef().bits());
- img.endDataAccess();
-
- img = QVolatileImage(12, 23, QImage::Format_ARGB32);
- img.beginDataAccess();
- QVERIFY(img.constBits() && img.bits());
- img.endDataAccess();
-}
-
-void tst_QVolatileImage::sharing()
-{
- QVolatileImage img1(100, 100, QImage::Format_ARGB32);
- QVolatileImage img2 = img1;
- img1.beginDataAccess();
- img2.beginDataAccess();
- QVERIFY(img1.constBits() == img2.constBits());
- img2.endDataAccess();
- img1.endDataAccess();
- img1.imageRef(); // non-const call, should detach
- img1.beginDataAccess();
- img2.beginDataAccess();
- QVERIFY(img1.constBits() != img2.constBits());
- img2.endDataAccess();
- img1.endDataAccess();
-
- // toImage() should return a copy of the internal QImage.
- // imageRef() is a reference to the internal QImage.
- QVERIFY(img1.imageRef().constBits() != img1.toImage().constBits());
-}
-
-bool fuzzyCompareImages(const QImage &image1, const QImage &image2, int tolerance)
-{
- if (image1.bytesPerLine() != image2.bytesPerLine()
- || image1.width() != image2.width()
- || image1.height() != image2.height()) {
- return false;
- }
- for (int i = 0; i < image1.height(); i++) {
- const uchar *line1 = image1.scanLine(i);
- const uchar *line2 = image2.scanLine(i);
- int bytes = image1.bytesPerLine();
- for (int j = 0; j < bytes; j++) {
- int delta = line1[j] - line2[j];
- if (qAbs(delta) > tolerance)
- return false;
- }
- }
- return true;
-}
-
-void tst_QVolatileImage::fill()
-{
- QVolatileImage img(100, 100, QImage::Format_ARGB32_Premultiplied);
- QColor col = QColor(10, 20, 30);
- img.fill(col.rgba());
- QVERIFY(img.imageRef().pixel(1, 1) == col.rgba());
- QVERIFY(img.toImage().pixel(1, 1) == col.rgba());
-}
-
-void tst_QVolatileImage::copy()
-{
- QVolatileImage img(100, 100, QImage::Format_RGB32);
- img.beginDataAccess();
- img.imageRef().fill(QColor(Qt::green).rgba());
- QPainter p(&img.imageRef());
- p.drawRect(10, 10, 50, 50);
- p.end();
- img.endDataAccess();
-
- QVolatileImage img2(100, 100, QImage::Format_RGB32);
- img2.copyFrom(&img, QRect());
- QImage imgA = img.toImage();
- QImage imgB = img2.toImage();
- QCOMPARE(imgA.size(), imgB.size());
- QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
-
- img2 = QVolatileImage(20, 20, QImage::Format_RGB32);
- img2.copyFrom(&img, QRect(5, 5, 20, 20));
- imgA = img.toImage().copy(5, 5, 20, 20);
- imgB = img2.toImage();
- QCOMPARE(imgA.size(), imgB.size());
- QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
-}
-
-QTEST_MAIN(tst_QVolatileImage)
-#include "tst_qvolatileimage.moc"
diff --git a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
index 97c749e5ba..61efb6e3f3 100644
--- a/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/gui/kernel/qshortcut/tst_qshortcut.cpp
@@ -151,14 +151,9 @@ protected:
Result ambigResult;
};
-QT_BEGIN_NAMESPACE
-template<> struct QMetaTypeId<tst_QShortcut::Widget> : public QMetaTypeId<int>
-{ static inline int qt_metatype_id() { return QMetaType::Int; } };
-template<> struct QMetaTypeId<tst_QShortcut::Result> : public QMetaTypeId<int>
-{ static inline int qt_metatype_id() { return QMetaType::Int; } };
-template<> struct QMetaTypeId<tst_QShortcut::Action> : public QMetaTypeId<int>
-{ static inline int qt_metatype_id() { return QMetaType::Int; } };
-QT_END_NAMESPACE
+Q_DECLARE_METATYPE(tst_QShortcut::Widget);
+Q_DECLARE_METATYPE(tst_QShortcut::Result);
+Q_DECLARE_METATYPE(tst_QShortcut::Action);
class TestEdit : public QTextEdit
{
@@ -221,9 +216,7 @@ void tst_QShortcut::initTestCase()
mainW->setFixedSize( 100, 100 );
mainW->setCentralWidget( edit );
mainW->show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(mainW);
-#endif
+ QTest::qWaitForWindowShown(mainW);
mainW->activateWindow();
QTest::qWait(100);
connect( mainW->statusBar(), SIGNAL(messageChanged(const QString&)),
@@ -251,8 +244,8 @@ Qt::KeyboardModifiers tst_QShortcut::toButtons( int key )
void tst_QShortcut::defElements()
{
- QTest::addColumn<int>("action");
- QTest::addColumn<int>("testWidget");
+ QTest::addColumn<tst_QShortcut::Action>("action");
+ QTest::addColumn<tst_QShortcut::Widget>("testWidget");
QTest::addColumn<QString>("txt");
QTest::addColumn<int>("k1");
QTest::addColumn<int>("c1");
@@ -262,7 +255,7 @@ void tst_QShortcut::defElements()
QTest::addColumn<int>("c3");
QTest::addColumn<int>("k4");
QTest::addColumn<int>("c4");
- QTest::addColumn<int>("result");
+ QTest::addColumn<tst_QShortcut::Result>("result");
}
void tst_QShortcut::number()
@@ -287,7 +280,7 @@ void tst_QShortcut::number_data()
defElements();
// Clear all
- QTest::newRow("N00 - clear") << ClearAll <<0<<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<0;
+ QTest::newRow("N00 - clear") << ClearAll << NoWidget <<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<NoResult;
//===========================================
// [Shift + key] on non-shift shortcuts testing
@@ -307,7 +300,7 @@ void tst_QShortcut::number_data()
//commented out because the behaviour changed, those tests should be updated
//QTest::newRow("N001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("N001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N001 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_M on Shift + Qt::Key_M
@@ -321,7 +314,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N002 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("N002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N002 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Qt::Key_F1
@@ -331,7 +324,7 @@ void tst_QShortcut::number_data()
//commented out because the behaviour changed, those tests should be updated
//QTest::newRow("N003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N003 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Shift + Qt::Key_F1
Qt::Key_F1 on Shift + Qt::Key_F1
@@ -340,7 +333,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N004 - slot1") << SetupAccel << TriggerSlot1 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N004:Shift+F1 - [Shift+F1]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N004 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Qt::Key_Tab
@@ -355,7 +348,7 @@ void tst_QShortcut::number_data()
// (Shift+)BackTab != Tab, but Shift+BackTab == Shift+Tab
QTest::newRow("N005a:Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N005a:Shift+Backtab - [Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("N005a - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N005a - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Shift + Qt::Key_Tab
@@ -368,7 +361,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N005b:Shift+Tab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N005b:BackTab - [Shift+Tab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N005b:Shift+BackTab - [Shift+Tab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N005b - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N005b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Qt::Key_Backtab
@@ -384,7 +377,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N006a:BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
//commented out because the behaviour changed, those tests should be updated
//QTest::newRow("N006a:Shift+BackTab - [BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N006a - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N006a - clear") << ClearAll << NoWidget<< QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_Tab on Shift + Qt::Key_Backtab
@@ -397,7 +390,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N006b:Shift+Tab - [Shift+BackTab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Tab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N006b:BackTab - [Shift+BackTab]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N006b:Shift+BackTab - [Shift+BackTab]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Backtab) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered; //XFAIL
- QTest::newRow("N006b - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N006b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
//===========================================
// [Shift + key] and [key] on shortcuts with
@@ -412,7 +405,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N007 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("N007 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_M
@@ -434,7 +427,7 @@ void tst_QShortcut::number_data()
*/
QTest::newRow("N05 - slot2") << SetupAccel << TriggerSlot2 << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("N:Qt::Key_M on slot") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous;
- QTest::newRow("N05 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N05 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Specialkeys
Qt::Key_aring
@@ -450,7 +443,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("N:Qt::UNICODE_ACCEL + Qt::Key_K") << TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N09 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Multiple Sequences
Qt::Key_M
@@ -464,7 +457,7 @@ void tst_QShortcut::number_data()
QTest::newRow("N:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("N:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("N:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("N13 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("N13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
}
// ------------------------------------------------------------------
@@ -474,7 +467,7 @@ void tst_QShortcut::text_data()
{
defElements();
// Clear all
- QTest::newRow("T00 - clear") << ClearAll <<0<<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<<0;
+ QTest::newRow("T00 - clear") << ClearAll << NoWidget <<QString("")<<0<<0<<0<<0<<0<<0<<0<<0<< NoResult;
//===========================================
// [Shift + key] on non-shift shortcuts testing
@@ -494,7 +487,7 @@ void tst_QShortcut::text_data()
//commented out because the behaviour changed, those tests should be updated
//QTest::newRow("T001:Shift++ [+]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("T001:+ [+]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T001 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T001 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_M on Shift + Qt::Key_M
@@ -510,7 +503,7 @@ void tst_QShortcut::text_data()
QTest::newRow("T002 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift++") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T002:Shift++ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("T002:+ [Shift++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T002 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T002 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Ctrl + Qt::Key_Plus on Ctrl + Qt::Key_Plus
@@ -522,7 +515,7 @@ void tst_QShortcut::text_data()
//QTest::newRow("T002b:Shift+Ctrl++ [Ctrl++]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T002b:Ctrl++ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::CTRL + Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T002b:+ [Ctrl++]") << TestAccel << NoWidget << QString("") << int(Qt::Key_Plus) << int('+') << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T002b - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T002b - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Qt::Key_F1
@@ -532,7 +525,7 @@ void tst_QShortcut::text_data()
//commented out because the behaviour changed, those tests should be updated
//QTest::newRow("T003:Shift+F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T003:F1 - [F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T003 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T003 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Shift + Qt::Key_F1 on Shift + Qt::Key_F1
@@ -541,7 +534,7 @@ void tst_QShortcut::text_data()
QTest::newRow("T004 - slot1") << SetupAccel << TriggerSlot1 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T004:Shift+F1 - [Shift+F1]")<< TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T004:F1 - [Shift+F1]") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
- QTest::newRow("T004 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T004 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
//===========================================
// [Shift + key] and [key] on shortcuts with
@@ -556,7 +549,7 @@ void tst_QShortcut::text_data()
QTest::newRow("T007 - slot2") << SetupAccel << TriggerSlot2 << QString("Shift+F1") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T007:F1") << TestAccel << NoWidget << QString("") << int(Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T007:Shift + F1") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_F1) << 0 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
- QTest::newRow("T007 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T007 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Sequences
Qt::Key_M
@@ -579,7 +572,7 @@ void tst_QShortcut::text_data()
*/
QTest::newRow("T05 - slot2") << SetupAccel << TriggerSlot2 << QString("M") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult;
QTest::newRow("T:Qt::Key_M on TriggerSlot2") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Ambiguous;
- QTest::newRow("T06 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T06 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Single Specialkeys
Qt::Key_aring
@@ -595,7 +588,7 @@ void tst_QShortcut::text_data()
QTest::newRow("T:Qt::Key_aring - Text Form") << TestAccel << NoWidget << QString("") << 0 << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T:Qt::Key_Aring - Text Form") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT+0) << 0xC5 << 0 << 0 << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("T:Qt::UNICODE_ACCEL + Qt::Key_K") << TestAccel << NoWidget << QString("") << int(Qt::UNICODE_ACCEL + Qt::Key_K) << int('k') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T09 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T09 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
/* Testing Multiple Sequences
Qt::Key_M
@@ -608,7 +601,7 @@ void tst_QShortcut::text_data()
QTest::newRow("T:Qt::Key_M (2)") << TestAccel << NoWidget << QString("") << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << 0 << 0 << Slot1Triggered;
QTest::newRow("T:Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::Key_I) << int('i') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot2Triggered;
QTest::newRow("T:Shift+Qt::Key_I, Qt::Key_M") << TestAccel << NoWidget << QString("") << int(Qt::SHIFT + Qt::Key_I) << int('I') << int(Qt::Key_M) << int('m') << 0 << 0 << 0 << 0 << Slot1Triggered;
- QTest::newRow("T13 - clear") << ClearAll << 0 << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0; // Clear all
+ QTest::newRow("T13 - clear") << ClearAll << NoWidget << QString("") << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0 << NoResult; // Clear all
}
// ------------------------------------------------------------------
@@ -1239,8 +1232,8 @@ void tst_QShortcut::sendKeyEvents(QWidget *w, int k1, QChar c1, int k2, QChar c2
void tst_QShortcut::testElement()
{
currentResult = NoResult;
- QFETCH(int, action);
- QFETCH(int, testWidget);
+ QFETCH(tst_QShortcut::Action, action);
+ QFETCH(tst_QShortcut::Widget, testWidget);
QFETCH(QString, txt);
QFETCH(int, k1);
QFETCH(int, c1);
@@ -1250,15 +1243,15 @@ void tst_QShortcut::testElement()
QFETCH(int, c3);
QFETCH(int, k4);
QFETCH(int, c4);
- QFETCH(int, result);
+ QFETCH(tst_QShortcut::Result, result);
if (action == ClearAll) {
clearAllShortcuts();
} else if (action == SetupAccel) {
setupShortcut(testWidget, txt, k1, k2, k3, k4);
} else {
- sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4);
- QCOMPARE(int(currentResult), result);
+ sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4);
+ QCOMPARE(currentResult, result);
}
}
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 90c96b4030..f4556f7e32 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -64,6 +64,8 @@ private slots:
void touchCancelWithTouchToMouse();
void orientation();
void close();
+ void activateAndClose();
+
void initTestCase()
{
touchDevice = new QTouchDevice;
@@ -632,5 +634,16 @@ void tst_QWindow::close()
QVERIFY(b.close());
}
+void tst_QWindow::activateAndClose()
+{
+ for (int i = 0; i < 10; ++i) {
+ QWindow window;
+ window.show();
+ QTest::qWaitForWindowShown(&window);
+ window.requestActivateWindow();
+ QTRY_COMPARE(qGuiApp->focusWindow(), &window);
+ }
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow);
diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
index 50ae22c530..7ca4fc981b 100644
--- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
+++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
@@ -2938,7 +2938,7 @@ void tst_QTextDocumentFragment::backgroundImage()
doc.setHtml("<p style=\"background-image: url(testPixmap)\">Hello</p>");
QBrush bg = doc.begin().blockFormat().background();
QVERIFY(bg.style() == Qt::TexturePattern);
- QVERIFY(bg.texture().serialNumber() == doc.testPixmap.serialNumber());
+ QCOMPARE(bg.texture().cacheKey(), doc.testPixmap.cacheKey());
}
void tst_QTextDocumentFragment::dontMergePreAndNonPre()
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index 7c9a83eaa4..a88e93c93e 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -1283,6 +1283,9 @@ void tst_QTextScriptEngine::thaiIsolatedSaraAm()
void tst_QTextScriptEngine::thaiWithZWJ()
{
+#ifdef Q_OS_WIN
+ QSKIP("This test currently fails on Windows - QTBUG-24565");
+#endif
QString s(QString::fromUtf8("ร‍ร‌.ร.“ร…ร”ร\xA0ร本ร") + QChar(0x0363)/*superscript 'a', for testing Inherited class*/);
QTextLayout layout(s);
layout.beginLayout();
diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index 0e046ad6f9..5dffe68386 100644
--- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -278,6 +278,8 @@ void tst_QNetworkCookieJar::cookiesForUrl_data()
QTest::newRow("no-match-5") << allCookies << "http://qt.nokia.com" << result;
QTest::newRow("no-match-6") << allCookies << "http://nokia.com/webinar" << result;
QTest::newRow("no-match-7") << allCookies << "http://qt.nokia.com/webinar" << result;
+ QTest::newRow("no-match-8") << allCookies << "http://qt.nokia.com./web" << result;
+ QTest::newRow("no-match-9") << allCookies << "http://nokia.com./web" << result;
result = allCookies;
QTest::newRow("match-1") << allCookies << "http://nokia.com/web" << result;
@@ -350,6 +352,16 @@ void tst_QNetworkCookieJar::cookiesForUrl_data()
QTest::newRow("match-secure-1") << allCookies << "https://nokia.com/web" << result;
QTest::newRow("match-secure-2") << allCookies << "https://qt.nokia.com/web" << result;
+ // domain ending in .
+ allCookies.clear();
+ result.clear();
+ QNetworkCookie cookieDot;
+ cookieDot.setDomain(".example.com.");
+ cookieDot.setName("a");
+ allCookies += cookieDot;
+ QTest::newRow("no-match-domain-dot") << allCookies << "http://example.com" << result;
+ result += cookieDot;
+ QTest::newRow("match-domain-dot") << allCookies << "http://example.com." << result;
}
void tst_QNetworkCookieJar::cookiesForUrl()
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 5b34fa7c29..8685546a5f 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -3385,6 +3385,7 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data()
<< QNetworkCacheMetaData::RawHeader("Cache-control", "max-age=0"); // isn't used in cache loading
content.first.setRawHeaders(rawHeaders);
content.first.setLastModified(past);
+ content.first.setExpirationDate(past);
QTest::newRow("expired,200,prefer-network")
<< reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true;
@@ -6334,29 +6335,52 @@ void tst_QNetworkReply::qtbug13431replyThrottling()
void tst_QNetworkReply::httpWithNoCredentialUsage()
{
- QNetworkRequest request(QUrl("http://httptest:httptest@" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"));
- // Do not use credentials
- request.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual);
QNetworkAccessManager manager;
- QNetworkReplyPtr reply = manager.get(request);
- qRegisterMetaType<QNetworkReply*>("QNetworkReply*");
- qRegisterMetaType<QAuthenticator*>("QAuthenticator*");
QSignalSpy authSpy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
QSignalSpy finishedSpy(&manager, SIGNAL(finished(QNetworkReply*)));
- qRegisterMetaType<QNetworkReply::NetworkError>("QNetworkReply::NetworkError");
- QSignalSpy errorSpy(reply, SIGNAL(error(QNetworkReply::NetworkError)));
- connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
- QTestEventLoop::instance().enterLoop(10);
- QVERIFY(!QTestEventLoop::instance().timeout());
+ // Get with credentials, to preload authentication cache
+ {
+ QNetworkRequest request(QUrl("http://httptest:httptest@" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"));
+ QNetworkReplyPtr reply = manager.get(request);
+ QVERIFY(waitForFinish(reply) == Success);
+ // credentials in URL, so don't expect authentication signal
+ QCOMPARE(authSpy.count(), 0);
+ QCOMPARE(finishedSpy.count(), 1);
+ finishedSpy.clear();
+ }
- // We check if authenticationRequired was emitted, however we do not anything in it so it should be 401
- QCOMPARE(authSpy.count(), 1);
- QCOMPARE(finishedSpy.count(), 1);
- QCOMPARE(errorSpy.count(), 1);
+ // Get with cached credentials (normal usage)
+ {
+ QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"));
+ QNetworkReplyPtr reply = manager.get(request);
+ QVERIFY(waitForFinish(reply) == Success);
+ // credentials in cache, so don't expect authentication signal
+ QCOMPARE(authSpy.count(), 0);
+ QCOMPARE(finishedSpy.count(), 1);
+ finishedSpy.clear();
+ }
- QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError);
+ // Do not use cached credentials (webkit cross origin usage)
+ {
+ QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"));
+ request.setAttribute(QNetworkRequest::AuthenticationReuseAttribute, QNetworkRequest::Manual);
+ QNetworkReplyPtr reply = manager.get(request);
+
+ QSignalSpy errorSpy(reply, SIGNAL(error(QNetworkReply::NetworkError)));
+
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ // We check if authenticationRequired was emitted, however we do not anything in it so it should be 401
+ QCOMPARE(authSpy.count(), 1);
+ QCOMPARE(finishedSpy.count(), 1);
+ QCOMPARE(errorSpy.count(), 1);
+
+ QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError);
+ }
}
void tst_QNetworkReply::qtbug15311doubleContentLength()
@@ -6474,7 +6498,7 @@ void tst_QNetworkReply::synchronousRequest()
// workaround for HTTPS requests: add self-signed server cert to list of CA certs,
// since we cannot react to the sslErrors() signal
// to fix this properly we would need to have an ignoreSslErrors() method in the
- // QNetworkRequest, see http://bugreports.qt.nokia.com/browse/QTBUG-14774
+ // QNetworkRequest, see http://bugreports.qt-project.org/browse/QTBUG-14774
if (url.scheme() == "https") {
QSslConfiguration sslConf;
QList<QSslCertificate> certs = QSslCertificate::fromPath(testDataDir + "/certs/qt-test-server-cacert.pem");
diff --git a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
index 9c1b8c32f6..7cb5dfd5cd 100644
--- a/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
+++ b/tests/auto/network/kernel/qauthenticator/tst_qauthenticator.cpp
@@ -93,7 +93,7 @@ void tst_QAuthenticator::basicAuth()
QVERIFY(priv->phase == QAuthenticatorPrivate::Start);
QList<QPair<QByteArray, QByteArray> > headers;
- headers << qMakePair(QByteArray("WWW-Authenticate"), "Basic " + data.toUtf8());
+ headers << qMakePair<QByteArray, QByteArray>(QByteArray("WWW-Authenticate"), "Basic " + data.toUtf8());
priv->parseHttpResponse(headers, /*isProxy = */ false);
QCOMPARE(auth.realm(), realm);
@@ -104,7 +104,7 @@ void tst_QAuthenticator::basicAuth()
QVERIFY(priv->phase == QAuthenticatorPrivate::Start);
- QCOMPARE(priv->calculateResponse("GET", "/").constData(), ("Basic " + expectedReply).constData());
+ QCOMPARE(priv->calculateResponse("GET", "/").constData(), QByteArray("Basic " + expectedReply).constData());
}
void tst_QAuthenticator::ntlmAuth_data()
@@ -138,7 +138,7 @@ void tst_QAuthenticator::ntlmAuth()
// NTLM phase 2: challenge
headers.clear();
- headers << qMakePair(QByteArray("WWW-Authenticate"), "NTLM " + data.toUtf8());
+ headers << qMakePair<QByteArray, QByteArray>(QByteArray("WWW-Authenticate"), "NTLM " + data.toUtf8());
priv->parseHttpResponse(headers, /*isProxy = */ false);
QEXPECT_FAIL("with-realm", "NTLM authentication code doesn't extract the realm", Continue);
diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
index 3baca3c50b..249ccd3d75 100644
--- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
+++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp
@@ -139,7 +139,7 @@ void tst_QDnsLookup::lookup()
lookup.lookup();
QVERIFY(waitForDone(&lookup));
QVERIFY(lookup.isFinished());
- QCOMPARE(int(lookup.error()), error);
+ QVERIFY2(int(lookup.error()) == error, qPrintable(lookup.errorString()));
if (error == QDnsLookup::NoError)
QVERIFY(lookup.errorString().isEmpty());
QCOMPARE(int(lookup.type()), type);
diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
index 2c2b551257..5395c7c28b 100644
--- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
@@ -201,6 +201,8 @@ private slots:
void qtbug14268_peek();
+ void setSocketOption();
+
protected slots:
void nonBlockingIMAP_hostFound();
@@ -2240,7 +2242,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
QString::fromLatin1("Could not start %1: %2").arg(processExe, serverProcess.errorString())));
while (!serverProcess.canReadLine())
QVERIFY(serverProcess.waitForReadyRead(10000));
- QCOMPARE(serverProcess.readLine().data(), (server.toLatin1() + "\n").data());
+ QCOMPARE(serverProcess.readLine().data(), QByteArray(server.toLatin1() + "\n").data());
// Start client
QProcess clientProcess;
@@ -2250,7 +2252,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect()
QString::fromLatin1("Could not start %1: %2").arg(processExe, clientProcess.errorString())));
while (!clientProcess.canReadLine())
QVERIFY(clientProcess.waitForReadyRead(10000));
- QCOMPARE(clientProcess.readLine().data(), (client.toLatin1() + "\n").data());
+ QCOMPARE(clientProcess.readLine().data(), QByteArray(client.toLatin1() + "\n").data());
// Let them play for a while
qDebug("Running stress test for 5 seconds");
@@ -2699,7 +2701,41 @@ void tst_QTcpSocket::qtbug14268_peek()
QVERIFY(incoming->read(128*1024) == QByteArray("abc\ndef\nghi\n"));
}
+void tst_QTcpSocket::setSocketOption()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ SocketPair socketPair;
+ QVERIFY(socketPair.create());
+ QTcpSocket *outgoing = socketPair.endPoints[0];
+ QTcpSocket *incoming = socketPair.endPoints[1];
+
+ QVERIFY(incoming->state() == QTcpSocket::ConnectedState);
+ QVERIFY(outgoing->state() == QTcpSocket::ConnectedState);
+
+ outgoing->setSocketOption(QAbstractSocket::LowDelayOption, true);
+ QVariant v = outgoing->socketOption(QAbstractSocket::LowDelayOption);
+ QVERIFY(v.isValid() && v.toBool());
+ outgoing->setSocketOption(QAbstractSocket::KeepAliveOption, true);
+ v = outgoing->socketOption(QAbstractSocket::KeepAliveOption);
+ QVERIFY(v.isValid() && v.toBool());
+ outgoing->setSocketOption(QAbstractSocket::LowDelayOption, false);
+ v = outgoing->socketOption(QAbstractSocket::LowDelayOption);
+ QVERIFY(v.isValid() && !v.toBool());
+ outgoing->setSocketOption(QAbstractSocket::KeepAliveOption, false);
+ v = outgoing->socketOption(QAbstractSocket::KeepAliveOption);
+ QVERIFY(v.isValid() && !v.toBool());
+
+#ifdef Q_OS_WIN
+ QEXPECT_FAIL("", "QTBUG-23323", Abort);
+#endif
+ outgoing->setSocketOption(QAbstractSocket::TypeOfServiceOption, 32); //high priority
+ v = outgoing->socketOption(QAbstractSocket::TypeOfServiceOption);
+ QVERIFY(v.isValid() && v.toInt() == 32);
+}
QTEST_MAIN(tst_QTcpSocket)
#include "tst_qtcpsocket.moc"
diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
index 5da9ff0476..93299c26c6 100644
--- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
@@ -109,6 +109,7 @@ private slots:
void subjectAndIssuerAttributes();
void verify();
void extensions();
+ void threadSafeConstMethods();
// helper for verbose test failure messages
QString toString(const QList<QSslError>&);
@@ -1059,6 +1060,77 @@ void tst_QSslCertificate::extensions()
}
+class TestThread : public QThread
+{
+public:
+ void run()
+ {
+ effectiveDate = cert.effectiveDate();
+ expiryDate = cert.expiryDate();
+ extensions = cert.extensions();
+ isBlacklisted = cert.isBlacklisted();
+ issuerInfo = cert.issuerInfo(QSslCertificate::CommonName);
+ issuerInfoAttributes = cert.issuerInfoAttributes();
+ publicKey = cert.publicKey();
+ serialNumber = cert.serialNumber();
+ subjectInfo = cert.subjectInfo(QSslCertificate::CommonName);
+ subjectInfoAttributes = cert.subjectInfoAttributes();
+ toDer = cert.toDer();
+ toPem = cert.toPem();
+ toText = cert.toText();
+ version = cert.version();
+ }
+ QSslCertificate cert;
+ QDateTime effectiveDate;
+ QDateTime expiryDate;
+ QList<QSslCertificateExtension> extensions;
+ bool isBlacklisted;
+ QStringList issuerInfo;
+ QList<QByteArray> issuerInfoAttributes;
+ QSslKey publicKey;
+ QByteArray serialNumber;
+ QStringList subjectInfo;
+ QList<QByteArray> subjectInfoAttributes;
+ QByteArray toDer;
+ QByteArray toPem;
+ QByteArray toText;
+ QByteArray version;
+};
+
+void tst_QSslCertificate::threadSafeConstMethods()
+{
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ QByteArray encoded = readFile(testDataDir + "/certificates/cert.pem");
+ QSslCertificate certificate(encoded);
+ QVERIFY(!certificate.isNull());
+
+ TestThread t1;
+ t1.cert = certificate; //shallow copy
+ TestThread t2;
+ t2.cert = certificate; //shallow copy
+ t1.start();
+ t2.start();
+ QVERIFY(t1.wait(5000));
+ QVERIFY(t2.wait(5000));
+ QVERIFY(t1.cert == t2.cert);
+ QVERIFY(t1.effectiveDate == t2.effectiveDate);
+ QVERIFY(t1.expiryDate == t2.expiryDate);
+ //QVERIFY(t1.extensions == t2.extensions); // no equality operator, so not tested
+ QVERIFY(t1.isBlacklisted == t2.isBlacklisted);
+ QVERIFY(t1.issuerInfo == t2.issuerInfo);
+ QVERIFY(t1.issuerInfoAttributes == t2.issuerInfoAttributes);
+ QVERIFY(t1.publicKey == t2.publicKey);
+ QVERIFY(t1.serialNumber == t2.serialNumber);
+ QVERIFY(t1.subjectInfo == t2.subjectInfo);
+ QVERIFY(t1.subjectInfoAttributes == t2.subjectInfoAttributes);
+ QVERIFY(t1.toDer == t2.toDer);
+ QVERIFY(t1.toPem == t2.toPem);
+ QVERIFY(t1.toText == t2.toText);
+ QVERIFY(t1.version == t2.version);
+
+}
#endif // QT_NO_SSL
diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp
index d72a04c8aa..1f461ba10b 100644
--- a/tests/auto/other/compiler/tst_compiler.cpp
+++ b/tests/auto/other/compiler/tst_compiler.cpp
@@ -525,33 +525,23 @@ void tst_Compiler::privateStaticTemplateMember() const
// the second member of the union
static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
-static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } };
static inline double qt_inf()
{
-#ifdef QT_ARMFPA
- return qt_armfpa_inf_bytes.d;
-#else
return (QSysInfo::ByteOrder == QSysInfo::BigEndian
? qt_be_inf_bytes.d
: qt_le_inf_bytes.d);
-#endif
}
#else
static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
-static const unsigned char qt_armfpa_inf_bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 };
static inline double qt_inf()
{
const uchar *bytes;
-#ifdef QT_ARMFPA
- bytes = qt_armfpa_inf_bytes;
-#else
bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian
? qt_be_inf_bytes
: qt_le_inf_bytes);
-#endif
union { uchar c[8]; double d; } returnValue;
memcpy(returnValue.c, bytes, sizeof(returnValue.c));
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index 01e26b6608..81881fc700 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -87,7 +87,7 @@ class CustomEvent : public QEvent
public:
static int EventType;
- CustomEvent(int serial_ = 0)
+ explicit CustomEvent(int serial_ = 0)
: QEvent(QEvent::Type(CustomEvent::EventType)),
serial(serial_), hasHotSpot(false)
{
diff --git a/tests/auto/other/headersclean/headersclean.pri b/tests/auto/other/headersclean/headersclean.pri
new file mode 100644
index 0000000000..163ef6d409
--- /dev/null
+++ b/tests/auto/other/headersclean/headersclean.pri
@@ -0,0 +1,38 @@
+# The headersclean test attempts to ensure all public Qt headers
+# abide by various rules.
+#
+# To reuse this test outside of the qtbase module,
+# include this .pri and create a qt_headersclean_headers.h which includes
+# the headers you'd like to test.
+
+*-g++*: QMAKE_CXXFLAGS += -W -Wall -Wextra -Werror
+
+# The flags here come from http://wiki.qt-project.org/Coding_Conventions#Conventions_for_public_header_files
+# -Wold-style-cast cannot be used, /usr/include/bits/byteswap.h defines the macro bswap_16 using C style casts :(
+# -Wfloat-equal cannot be used, qrect.h and qvector2d.h do exact comparisons in isNull and operator==. Would need #pragmas.
+*-g++*: QMAKE_CXXFLAGS += -Woverloaded-virtual -Wshadow -Wundef
+
+# Other nice flags
+*-g++*: QMAKE_CXXFLAGS += -Wnon-virtual-dtor -ansi -Wcast-align -Wchar-subscripts -Wpointer-arith -Wformat-security
+
+# Enable pedantic mode, but accept variadic macros and 'long long' usage.
+*-g++*: QMAKE_CXXFLAGS += -Wno-long-long -Wno-variadic-macros -pedantic-errors
+
+# There are outstanding alignment issues on ARM in some container classes.
+contains(QT_ARCH,arm):*-g++*:QMAKE_CXXFLAGS -= -Wcast-align
+
+QMAKE_CXXFLAGS += -DQT_NO_CAST_TO_ASCII \
+ -DQT_NO_CAST_FROM_ASCII \
+ -DQT_STRICT_ITERATORS \
+ -DQT_NO_URL_CAST_FROM_STRING \
+ -DQT_NO_CAST_FROM_BYTEARRAY \
+ -DQT_NO_KEYWORDS \
+ -DQT_USE_FAST_CONCATENATION \
+ -DQT_USE_FAST_OPERATOR_PLUS
+
+TARGET = tst_headersclean
+SOURCES += $$PWD/tst_headersclean.cpp
+HEADERS += $$PWD/tst_headersclean.h
+
+# qt_headersclean_headers.h should be alongside the .pro file
+INCLUDEPATH += $$_PRO_FILE_PWD_
diff --git a/tests/auto/other/headersclean/headersclean.pro b/tests/auto/other/headersclean/headersclean.pro
index 5444bebfb9..9bfadca08c 100644
--- a/tests/auto/other/headersclean/headersclean.pro
+++ b/tests/auto/other/headersclean/headersclean.pro
@@ -1,28 +1,2 @@
-CONFIG += testcase
-TARGET = tst_headersclean
-SOURCES += tst_headersclean.cpp
-
-# No need to link to all modules, only those actually used
QT = core testlib gui widgets
-
-*-g++*: QMAKE_CXXFLAGS += -W -Wall -Wextra -Werror
-
-# The flags here come from http://wiki.qt-project.org/Coding_Conventions#Conventions_for_public_header_files
-# -Wold-style-cast cannot be used, /usr/include/bits/byteswap.h defines the macro bswap_16 using C style casts :(
-# -Wfloat-equal cannot be used, qrect.h and qvector2d.h do exact comparisons in isNull and operator==. Would need #pragmas.
-*-g++*: QMAKE_CXXFLAGS += -Woverloaded-virtual -Wshadow -Wundef
-
-# Other nice flags
-*-g++*: QMAKE_CXXFLAGS += -Wnon-virtual-dtor -ansi -Wcast-align -Wchar-subscripts -Wpointer-arith -Wformat-security
-
-# Enable pedantic mode, but accept variadic macros and 'long long' usage.
-*-g++*: QMAKE_CXXFLAGS += -Wno-long-long -Wno-variadic-macros -pedantic-errors
-
-QMAKE_CXXFLAGS += -DQT_NO_CAST_TO_ASCII \
- -DQT_NO_CAST_FROM_ASCII \
- -DQT_STRICT_ITERATORS \
- -DQT_NO_URL_CAST_FROM_STRING \
- -DQT_NO_CAST_FROM_BYTEARRAY \
- -DQT_NO_KEYWORDS \
- -DQT_USE_FAST_CONCATENATION \
- -DQT_USE_FAST_OPERATOR_PLUS
+include(headersclean.pri)
diff --git a/tests/auto/other/headersclean/qt_headersclean_headers.h b/tests/auto/other/headersclean/qt_headersclean_headers.h
new file mode 100644
index 0000000000..c9b4e3f399
--- /dev/null
+++ b/tests/auto/other/headersclean/qt_headersclean_headers.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_HEADERSCLEAN_HEADERS
+#define QT_HEADERSCLEAN_HEADERS
+
+/*
+ This file should include all the headers to be tested by the headersclean
+ test. It may be copied and customized for each module.
+*/
+
+#include <QtCore/QtCore>
+#include <QtConcurrent/QtConcurrent>
+#include <QtTest/QtTest>
+
+#include <QtNetwork/QtNetwork>
+#include <QtXml/QtXml>
+#include <QtSql/QtSql>
+#include <QtGui/QtGui>
+#include <QtWidgets/QtWidgets>
+#include <QtPrintSupport/QtPrintSupport>
+#include <QtPlatformSupport/QtPlatformSupport>
+
+#ifndef QT_NO_OPENGL
+#include <QtOpenGL/QtOpenGL>
+#endif
+
+#if !defined(QT_NO_DBUS) && defined(Q_OS_UNIX)
+#include <QtDBus/QtDBus>
+#endif
+
+#endif
diff --git a/tests/auto/other/headersclean/tst_headersclean.cpp b/tests/auto/other/headersclean/tst_headersclean.cpp
index 81d0aa3a4a..d442ad39d3 100644
--- a/tests/auto/other/headersclean/tst_headersclean.cpp
+++ b/tests/auto/other/headersclean/tst_headersclean.cpp
@@ -39,38 +39,12 @@
**
****************************************************************************/
-#define signals int
-#define slots int
-#define emit public:;
-#define foreach public:;
-#define forever public:;
+#include "tst_headersclean.h"
+#include <QTest>
-#include <QtCore/QtCore>
-#include <QtConcurrent/QtConcurrent>
-#include <QtTest/QtTest>
-
-#include <QtNetwork/QtNetwork>
-#include <QtXml/QtXml>
-#include <QtSql/QtSql>
-#include <QtGui/QtGui>
-#include <QtWidgets/QtWidgets>
-#include <QtPrintSupport/QtPrintSupport>
-#include <QtPlatformSupport/QtPlatformSupport>
-
-#ifndef QT_NO_OPENGL
-#include <QtOpenGL/QtOpenGL>
-#endif
-
-#if !defined(QT_NO_DBUS) && defined(Q_OS_UNIX)
-#include <QtDBus/QtDBus>
-#endif
-
-class tst_HeadersClean: public QObject
+void tst_HeadersClean::initTestCase()
{
- Q_OBJECT
-public:
- tst_HeadersClean() {}
-};
+ QWARN("This is a compile test only");
+}
QTEST_MAIN(tst_HeadersClean)
-#include "tst_headersclean.moc"
diff --git a/tests/auto/other/headersclean/tst_headersclean.h b/tests/auto/other/headersclean/tst_headersclean.h
new file mode 100644
index 0000000000..7479e061dc
--- /dev/null
+++ b/tests/auto/other/headersclean/tst_headersclean.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TST_HEADERSCLEAN_H
+#define TST_HEADERSCLEAN_H
+
+#define signals int
+#define slots int
+#define emit public:;
+#define foreach public:;
+#define forever public:;
+
+#include <qt_headersclean_headers.h>
+#include <QObject>
+
+class tst_HeadersClean: public QObject
+{
+ Q_OBJECT
+private Q_SLOTS:
+ void initTestCase();
+};
+
+#endif
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 841df6e1f0..ebb8443748 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -938,7 +938,7 @@ void tst_NetworkSelfTest::socks5ProxyAuth()
void tst_NetworkSelfTest::supportsSsl()
{
#ifdef QT_NO_SSL
- QFAIL("SSL not compiled in");
+ QSKIP("SSL not compiled in");
#else
QVERIFY2(QSslSocket::supportsSsl(), "Could not load SSL libraries");
#endif
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index 9ec5ea8e34..6c708baa6b 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -30,8 +30,7 @@ testcocoon: SUBDIRS -= headersclean
cross_compile: SUBDIRS -= \
atwrapper \
- compiler \
- headersclean \
+ compiler
wince*|!contains(QT_CONFIG, accessibility):SUBDIRS -= qaccessibility
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index b2a4b1cca2..4c370bebc7 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -777,6 +777,7 @@ void tst_QAccessibility::actionTest()
{
QPushButton *button = new QPushButton;
button->show();
+ QTest::qWaitForWindowShown(button);
button->clearFocus();
QCOMPARE(button->hasFocus(), false);
QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(button);
diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
index b22e876c3c..584fcb045a 100644
--- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp
@@ -222,6 +222,8 @@ private slots:
void sqlite_real_data() { generic_data("QSQLITE"); }
void sqlite_real();
+ void aggregateFunctionTypes_data() { generic_data(); }
+ void aggregateFunctionTypes();
private:
// returns all database connections
void generic_data(const QString &engine=QString());
@@ -3339,5 +3341,121 @@ void tst_QSqlQuery::sqlite_real()
QCOMPARE(q.value(0).toDouble(), 5.6);
}
+void tst_QSqlQuery::aggregateFunctionTypes()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ {
+ const QString tableName(qTableName("numericFunctionsWithIntValues", __FILE__));
+ tst_Databases::safeDropTable( db, tableName );
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER)"));
+
+ // First test without any entries
+ QVERIFY_SQL(q, exec("SELECT SUM(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.record().field(0).type(), QVariant::Invalid);
+
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (1)"));
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (2)"));
+
+ QVERIFY_SQL(q, exec("SELECT SUM(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 3);
+ QCOMPARE(q.record().field(0).type(), QVariant::Int);
+
+ QVERIFY_SQL(q, exec("SELECT AVG(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 1.5);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT COUNT(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 2);
+ QCOMPARE(q.record().field(0).type(), QVariant::Int);
+
+ QVERIFY_SQL(q, exec("SELECT MIN(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 1);
+ QCOMPARE(q.record().field(0).type(), QVariant::Int);
+
+ QVERIFY_SQL(q, exec("SELECT MAX(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 2);
+ QCOMPARE(q.record().field(0).type(), QVariant::Int);
+ }
+ {
+ const QString tableName(qTableName("numericFunctionsWithDoubleValues", __FILE__));
+ tst_Databases::safeDropTable( db, tableName );
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id DOUBLE)"));
+
+ // First test without any entries
+ QVERIFY_SQL(q, exec("SELECT SUM(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.record().field(0).type(), QVariant::Invalid);
+
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (1.5)"));
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (2.5)"));
+
+ QVERIFY_SQL(q, exec("SELECT SUM(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 4.0);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT AVG(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 2.0);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT COUNT(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toInt(), 2);
+ QCOMPARE(q.record().field(0).type(), QVariant::Int);
+
+ QVERIFY_SQL(q, exec("SELECT MIN(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 1.5);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT MAX(id) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 2.5);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT ROUND(id, 1) FROM " + tableName + " WHERE id=1.5"));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 1.5);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+
+ QVERIFY_SQL(q, exec("SELECT ROUND(id, 0) FROM " + tableName + " WHERE id=2.5"));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toDouble(), 3.0);
+ QCOMPARE(q.record().field(0).type(), QVariant::Double);
+ }
+ {
+ const QString tableName(qTableName("stringFunctions", __FILE__));
+ tst_Databases::safeDropTable( db, tableName );
+
+ QSqlQuery q(db);
+ QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id INTEGER, txt VARCHAR(50))"));
+
+ QVERIFY_SQL(q, exec("SELECT MAX(txt) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.record().field(0).type(), QVariant::Invalid);
+
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, txt) VALUES (1, 'lower')"));
+ QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id, txt) VALUES (2, 'upper')"));
+
+ QVERIFY_SQL(q, exec("SELECT MAX(txt) FROM " + tableName));
+ QVERIFY(q.next());
+ QCOMPARE(q.value(0).toString(), QLatin1String("upper"));
+ QCOMPARE(q.record().field(0).type(), QVariant::String);
+ }
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index ddafeea427..ce0d8db1fd 100644
--- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -542,6 +542,13 @@ void tst_QSqlRelationalTableModel::setRecord()
model.setSort(0, Qt::AscendingOrder);
QVERIFY_SQL(model, submit());
+ if (model.editStrategy() != QSqlTableModel::OnManualSubmit) {
+ QCOMPARE(model.data(model.index(1, 0)).toInt(), 7);
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("tester"));
+ QCOMPARE(model.data(model.index(1, 2)).toString(), QString("herr"));
+ QVERIFY_SQL(model, select());
+ }
+
QCOMPARE(model.data(model.index(3, 0)).toInt(), 7);
QCOMPARE(model.data(model.index(3, 1)).toString(), QString("tester"));
QCOMPARE(model.data(model.index(3, 2)).toString(), QString("herr"));
@@ -599,6 +606,8 @@ void tst_QSqlRelationalTableModel::insertWithStrategies()
QVERIFY_SQL(model, submitAll());
model.setEditStrategy(QSqlTableModel::OnManualSubmit);
+ // The changes were submitted, but there was no automatic select to resort
+ QVERIFY_SQL(model, select());
QCOMPARE(model.data(model.index(0,0)).toInt(), 1);
QCOMPARE(model.data(model.index(0,1)).toString(), QString("harry"));
@@ -1401,6 +1410,8 @@ void tst_QSqlRelationalTableModel::whiteSpaceInIdentifiers()
QVERIFY_SQL(model, insertRecord(-1, rec));
model.submitAll();
+ if (model.editStrategy() != QSqlTableModel::OnManualSubmit)
+ QVERIFY_SQL(model, select());
QCOMPARE(model.data(model.index(0, 0)).toInt(), 3);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("Washington"));
diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
index 270de8292b..448111cd9f 100644
--- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -411,8 +411,11 @@ void tst_QSqlTableModel::setRecord()
} else if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnRowChange && i == model.rowCount() -1)
model.submit();
else {
- // dataChanged() is not emitted when submitAll() is called
- QCOMPARE(spy.count(), 1);
+ // dataChanged() emitted by selectRow() as well as setRecord()
+ if ((QSqlTableModel::EditStrategy)submitpolicy == QSqlTableModel::OnFieldChange)
+ QCOMPARE(spy.count(), 2);
+ else
+ QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).count(), 2);
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(0)), model.index(i, 0));
QCOMPARE(qvariant_cast<QModelIndex>(spy.at(0).at(1)), model.index(i, rec.count() - 1));
@@ -471,8 +474,7 @@ void tst_QSqlTableModel::insertRow()
rec.setValue(0, 42);
rec.setValue(1, QString("francis"));
- // FieldChange updates immediately and resorts
- // Row/Manual submit does not resort
+ // Setting record does not cause resort
QVERIFY(model.setRecord(2, rec));
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
@@ -482,8 +484,23 @@ void tst_QSqlTableModel::insertRow()
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
QCOMPARE(model.data(model.index(1, 2)).toInt(), 2);
- // See comment above setRecord
- if (submitpolicy == QSqlTableModel::OnFieldChange) {
+ QCOMPARE(model.data(model.index(2, 0)).toInt(), 42);
+ QCOMPARE(model.data(model.index(2, 1)).toString(), QString("francis"));
+ QCOMPARE(model.data(model.index(2, 2)).toInt(), 2);
+ QCOMPARE(model.data(model.index(3, 0)).toInt(), 3);
+ QCOMPARE(model.data(model.index(3, 1)).toString(), QString("vohi"));
+ QCOMPARE(model.data(model.index(3, 2)).toInt(), 3);
+
+ QVERIFY(model.submitAll());
+
+ if (submitpolicy == QSqlTableModel::OnManualSubmit) {
+ // After the submit we should have the resorted view
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toInt(), 1);
+ QCOMPARE(model.data(model.index(1, 0)).toInt(), 2);
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
+ QCOMPARE(model.data(model.index(1, 2)).toInt(), 2);
QCOMPARE(model.data(model.index(2, 0)).toInt(), 3);
QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
QCOMPARE(model.data(model.index(2, 2)).toInt(), 3);
@@ -491,6 +508,13 @@ void tst_QSqlTableModel::insertRow()
QCOMPARE(model.data(model.index(3, 1)).toString(), QString("francis"));
QCOMPARE(model.data(model.index(3, 2)).toInt(), 2);
} else {
+ // Submit does not select, therefore not resorted
+ QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(0, 2)).toInt(), 1);
+ QCOMPARE(model.data(model.index(1, 0)).toInt(), 2);
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
+ QCOMPARE(model.data(model.index(1, 2)).toInt(), 2);
QCOMPARE(model.data(model.index(2, 0)).toInt(), 42);
QCOMPARE(model.data(model.index(2, 1)).toString(), QString("francis"));
QCOMPARE(model.data(model.index(2, 2)).toInt(), 2);
@@ -499,9 +523,8 @@ void tst_QSqlTableModel::insertRow()
QCOMPARE(model.data(model.index(3, 2)).toInt(), 3);
}
- QVERIFY(model.submitAll());
-
- // After the submit we should have the resorted view
+ QVERIFY(model.select());
+ // After the select we should have the resorted view in all strategies
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(0, 2)).toInt(), 1);
@@ -514,7 +537,6 @@ void tst_QSqlTableModel::insertRow()
QCOMPARE(model.data(model.index(3, 0)).toInt(), 42);
QCOMPARE(model.data(model.index(3, 1)).toString(), QString("francis"));
QCOMPARE(model.data(model.index(3, 2)).toInt(), 2);
-
}
void tst_QSqlTableModel::insertRecord()
@@ -647,8 +669,7 @@ void tst_QSqlTableModel::removeRow()
QVERIFY_SQL(model, select());
QCOMPARE(model.rowCount(), 3);
- // headerDataChanged must be emitted by the model when the edit strategy is OnManualSubmit,
- // when OnFieldChange or OnRowChange it's not needed because the model will re-select.
+ // headerDataChanged must be emitted by the model since the row won't vanish until select
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)));
@@ -673,7 +694,10 @@ void tst_QSqlTableModel::removeRow()
headerDataChangedSpy.clear();
QVERIFY(model.removeRow(1));
- QCOMPARE(headerDataChangedSpy.count(), 0);
+ QCOMPARE(headerDataChangedSpy.count(), 1);
+ QCOMPARE(model.rowCount(), 3);
+
+ QVERIFY_SQL(model, select());
QCOMPARE(model.rowCount(), 2);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
@@ -706,6 +730,11 @@ void tst_QSqlTableModel::removeRows()
QCOMPARE(beforeDeleteSpy.count(), 2);
QVERIFY(beforeDeleteSpy.at(0).at(0).toInt() == 0);
QVERIFY(beforeDeleteSpy.at(1).at(0).toInt() == 1);
+ // deleted rows shown as empty until select
+ QCOMPARE(model.rowCount(), 3);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString(""));
+ QVERIFY(model.select());
+ // deleted rows are gone
QCOMPARE(model.rowCount(), 1);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("vohi"));
model.clear();
@@ -730,10 +759,10 @@ void tst_QSqlTableModel::removeRows()
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)));
QVERIFY(model.removeRows(0, 2, QModelIndex()));
QCOMPARE(headerDataChangedSpy.count(), 2);
- QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 0);
- QCOMPARE(headerDataChangedSpy.at(0).at(2).toInt(), 0);
- QCOMPARE(headerDataChangedSpy.at(1).at(1).toInt(), 1);
- QCOMPARE(headerDataChangedSpy.at(1).at(2).toInt(), 1);
+ QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1);
+ QCOMPARE(headerDataChangedSpy.at(0).at(2).toInt(), 1);
+ QCOMPARE(headerDataChangedSpy.at(1).at(1).toInt(), 0);
+ QCOMPARE(headerDataChangedSpy.at(1).at(2).toInt(), 0);
QCOMPARE(model.rowCount(), 3);
QVERIFY(beforeDeleteSpy.count() == 0);
QVERIFY(model.submitAll());
@@ -778,6 +807,14 @@ void tst_QSqlTableModel::removeInsertedRow()
model.submitAll();
+ if (model.editStrategy() != QSqlTableModel::OnManualSubmit) {
+ QCOMPARE(model.rowCount(), 4);
+ QCOMPARE(model.data(model.index(1, 0)).toInt(), 55);
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("null columns"));
+ QCOMPARE(model.data(model.index(1, 2)).isNull(), true);
+ QVERIFY(model.select());
+ }
+
QCOMPARE(model.rowCount(), 4);
QCOMPARE(model.data(model.index(3, 0)).toInt(), 55);
QCOMPARE(model.data(model.index(3, 1)).toString(), QString("null columns"));
@@ -785,8 +822,17 @@ void tst_QSqlTableModel::removeInsertedRow()
QVERIFY(model.removeRow(3));
model.submitAll();
- QCOMPARE(model.rowCount(), 3);
+ if (model.editStrategy() != QSqlTableModel::OnManualSubmit) {
+ QCOMPARE(model.rowCount(), 4);
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
+ QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
+ QCOMPARE(model.data(model.index(3, 1)).toString(), QString(""));
+ QVERIFY(model.select());
+ }
+
+ QCOMPARE(model.rowCount(), 3);
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
@@ -1129,6 +1175,11 @@ void tst_QSqlTableModel::insertRecordBeforeSelect()
buffer.setValue("title", 0);
QVERIFY_SQL(model, insertRecord(1, buffer));
+ if (model.editStrategy() != QSqlTableModel::OnManualSubmit) {
+ QCOMPARE(model.rowCount(), 2);
+ QVERIFY_SQL(model, select());
+ }
+
int rowCount = model.rowCount();
model.clear();
QCOMPARE(model.rowCount(), 0);
diff --git a/tests/auto/testlib/selftests/alive/qtestalive.cpp b/tests/auto/testlib/selftests/alive/qtestalive.cpp
index c2e597ac18..d962b7801f 100644
--- a/tests/auto/testlib/selftests/alive/qtestalive.cpp
+++ b/tests/auto/testlib/selftests/alive/qtestalive.cpp
@@ -50,7 +50,7 @@ public:
enum { AliveEventType = QEvent::User + 422 };
- inline QTestAliveEvent(int aSequenceId)
+ explicit inline QTestAliveEvent(int aSequenceId)
: QEvent(QEvent::Type(AliveEventType)), seqId(aSequenceId)
{}
inline int sequenceId() const { return seqId; }
diff --git a/tests/auto/testlib/selftests/counting/tst_counting.cpp b/tests/auto/testlib/selftests/counting/tst_counting.cpp
index fa61fce173..9c3dd48015 100644
--- a/tests/auto/testlib/selftests/counting/tst_counting.cpp
+++ b/tests/auto/testlib/selftests/counting/tst_counting.cpp
@@ -109,6 +109,7 @@ void tst_Counting::helper()
switch (result) {
case Pass:
QVERIFY(true);
+ QCOMPARE(2 + 1, 3);
break;
case Fail:
QVERIFY(false);
diff --git a/tests/auto/testlib/selftests/expected_counting.lightxml b/tests/auto/testlib/selftests/expected_counting.lightxml
index e7b1136417..c49792fec4 100644
--- a/tests/auto/testlib/selftests/expected_counting.lightxml
+++ b/tests/auto/testlib/selftests/expected_counting.lightxml
@@ -17,7 +17,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[row 1]]></DataTag>
</Incident>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
@@ -26,13 +26,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[row 1]]></DataTag>
</Incident>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
</TestFunction>
<TestFunction name="testSkipPass">
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
@@ -41,27 +41,27 @@
</Incident>
</TestFunction>
<TestFunction name="testSkipSkip">
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
</TestFunction>
<TestFunction name="testSkipFail">
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
</TestFunction>
<TestFunction name="testFailPass">
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
@@ -70,21 +70,21 @@
</Incident>
</TestFunction>
<TestFunction name="testFailSkip">
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
</TestFunction>
<TestFunction name="testFailFail">
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
@@ -93,7 +93,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[before]]></DataTag>
</Incident>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="233">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="234">
<DataTag><![CDATA[fail]]></DataTag>
<Description><![CDATA[Fail in init()]]></Description>
</Incident>
@@ -109,7 +109,7 @@
<DataTag><![CDATA[fail]]></DataTag>
<Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="241">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242">
<DataTag><![CDATA[fail]]></DataTag>
<Description><![CDATA[Fail in cleanup()]]></Description>
</Incident>
@@ -121,7 +121,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[before]]></DataTag>
</Incident>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="235">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="236">
<DataTag><![CDATA[skip]]></DataTag>
<Description><![CDATA[Skip in init()]]></Description>
</Message>
@@ -137,7 +137,7 @@
<DataTag><![CDATA[skip]]></DataTag>
<Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description>
</Message>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="243">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244">
<DataTag><![CDATA[skip]]></DataTag>
<Description><![CDATA[Skip in cleanup()]]></Description>
</Message>
diff --git a/tests/auto/testlib/selftests/expected_counting.txt b/tests/auto/testlib/selftests/expected_counting.txt
index 5c17e3c257..3245d9d7be 100644
--- a/tests/auto/testlib/selftests/expected_counting.txt
+++ b/tests/auto/testlib/selftests/expected_counting.txt
@@ -5,49 +5,49 @@ PASS : tst_Counting::testPassPass(row 1)
PASS : tst_Counting::testPassPass(row 2)
PASS : tst_Counting::testPassSkip(row 1)
SKIP : tst_Counting::testPassSkip(row 2) Skipping
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(117)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
PASS : tst_Counting::testPassFail(row 1)
FAIL! : tst_Counting::testPassFail(row 2) 'false' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(114)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
SKIP : tst_Counting::testSkipPass(row 1) Skipping
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(117)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
PASS : tst_Counting::testSkipPass(row 2)
SKIP : tst_Counting::testSkipSkip(row 1) Skipping
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(117)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
SKIP : tst_Counting::testSkipSkip(row 2) Skipping
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(117)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
SKIP : tst_Counting::testSkipFail(row 1) Skipping
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(117)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
FAIL! : tst_Counting::testSkipFail(row 2) 'false' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(114)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
FAIL! : tst_Counting::testFailPass(row 1) 'false' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(114)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
PASS : tst_Counting::testFailPass(row 2)
FAIL! : tst_Counting::testFailSkip(row 1) 'false' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(114)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
SKIP : tst_Counting::testFailSkip(row 2) Skipping
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(117)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
FAIL! : tst_Counting::testFailFail(row 1) 'false' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(114)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
FAIL! : tst_Counting::testFailFail(row 2) 'false' returned FALSE. ()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(114)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
PASS : tst_Counting::testFailInInit(before)
FAIL! : tst_Counting::testFailInInit(fail) Fail in init()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(233)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(234)]
PASS : tst_Counting::testFailInInit(after)
PASS : tst_Counting::testFailInCleanup(before)
QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup()
FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(241)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)]
PASS : tst_Counting::testFailInCleanup(after)
PASS : tst_Counting::testSkipInInit(before)
SKIP : tst_Counting::testSkipInInit(skip) Skip in init()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(235)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(236)]
PASS : tst_Counting::testSkipInInit(after)
PASS : tst_Counting::testSkipInCleanup(before)
QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup()
SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup()
- Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(243)]
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)]
PASS : tst_Counting::testSkipInCleanup(after)
PASS : tst_Counting::cleanupTestCase()
Totals: 16 passed, 8 failed, 8 skipped
diff --git a/tests/auto/testlib/selftests/expected_counting.xml b/tests/auto/testlib/selftests/expected_counting.xml
index a97296807d..7ed93b9c73 100644
--- a/tests/auto/testlib/selftests/expected_counting.xml
+++ b/tests/auto/testlib/selftests/expected_counting.xml
@@ -19,7 +19,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[row 1]]></DataTag>
</Incident>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
@@ -28,13 +28,13 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[row 1]]></DataTag>
</Incident>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
</TestFunction>
<TestFunction name="testSkipPass">
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
@@ -43,27 +43,27 @@
</Incident>
</TestFunction>
<TestFunction name="testSkipSkip">
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
</TestFunction>
<TestFunction name="testSkipFail">
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
</TestFunction>
<TestFunction name="testFailPass">
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
@@ -72,21 +72,21 @@
</Incident>
</TestFunction>
<TestFunction name="testFailSkip">
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="117">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA[Skipping]]></Description>
</Message>
</TestFunction>
<TestFunction name="testFailFail">
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 1]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="114">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
<DataTag><![CDATA[row 2]]></DataTag>
<Description><![CDATA['false' returned FALSE. ()]]></Description>
</Incident>
@@ -95,7 +95,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[before]]></DataTag>
</Incident>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="233">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="234">
<DataTag><![CDATA[fail]]></DataTag>
<Description><![CDATA[Fail in init()]]></Description>
</Incident>
@@ -111,7 +111,7 @@
<DataTag><![CDATA[fail]]></DataTag>
<Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description>
</Message>
-<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="241">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242">
<DataTag><![CDATA[fail]]></DataTag>
<Description><![CDATA[Fail in cleanup()]]></Description>
</Incident>
@@ -123,7 +123,7 @@
<Incident type="pass" file="" line="0">
<DataTag><![CDATA[before]]></DataTag>
</Incident>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="235">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="236">
<DataTag><![CDATA[skip]]></DataTag>
<Description><![CDATA[Skip in init()]]></Description>
</Message>
@@ -139,7 +139,7 @@
<DataTag><![CDATA[skip]]></DataTag>
<Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description>
</Message>
-<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="243">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244">
<DataTag><![CDATA[skip]]></DataTag>
<Description><![CDATA[Skip in cleanup()]]></Description>
</Message>
diff --git a/tests/auto/testlib/selftests/expected_fatal.txt b/tests/auto/testlib/selftests/expected_fatal.txt
deleted file mode 100644
index a525fee0a1..0000000000
--- a/tests/auto/testlib/selftests/expected_fatal.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-********* Start testing of tst_Fatal *********
-Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
-PASS : tst_Fatal::initTestCase()
-QFATAL : tst_Fatal::testFunction() A fatal error occured! Ouuiieee!! The world is coming to an end and I will die! Buhu!
-Totals: 1 passed, 0 failed, 0 skipped
-********* Finished testing of tst_Fatal *********
diff --git a/tests/auto/testlib/selftests/expected_verbose1.lightxml b/tests/auto/testlib/selftests/expected_verbose1.lightxml
new file mode 100644
index 0000000000..c49792fec4
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose1.lightxml
@@ -0,0 +1,150 @@
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="testPassPass">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testPassSkip">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testPassFail">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipPass">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipSkip">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testSkipFail">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailPass">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailSkip">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testFailFail">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="234">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in init()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in cleanup()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="236">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in init()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in cleanup()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
diff --git a/tests/auto/testlib/selftests/expected_verbose1.txt b/tests/auto/testlib/selftests/expected_verbose1.txt
new file mode 100644
index 0000000000..0286f719aa
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose1.txt
@@ -0,0 +1,69 @@
+********* Start testing of tst_Counting *********
+Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
+INFO : tst_Counting::initTestCase() entering
+PASS : tst_Counting::initTestCase()
+INFO : tst_Counting::testPassPass() entering
+PASS : tst_Counting::testPassPass(row 1)
+PASS : tst_Counting::testPassPass(row 2)
+INFO : tst_Counting::testPassSkip() entering
+PASS : tst_Counting::testPassSkip(row 1)
+SKIP : tst_Counting::testPassSkip(row 2) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testPassFail() entering
+PASS : tst_Counting::testPassFail(row 1)
+FAIL! : tst_Counting::testPassFail(row 2) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testSkipPass() entering
+SKIP : tst_Counting::testSkipPass(row 1) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+PASS : tst_Counting::testSkipPass(row 2)
+INFO : tst_Counting::testSkipSkip() entering
+SKIP : tst_Counting::testSkipSkip(row 1) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+SKIP : tst_Counting::testSkipSkip(row 2) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testSkipFail() entering
+SKIP : tst_Counting::testSkipFail(row 1) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+FAIL! : tst_Counting::testSkipFail(row 2) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testFailPass() entering
+FAIL! : tst_Counting::testFailPass(row 1) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+PASS : tst_Counting::testFailPass(row 2)
+INFO : tst_Counting::testFailSkip() entering
+FAIL! : tst_Counting::testFailSkip(row 1) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+SKIP : tst_Counting::testFailSkip(row 2) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testFailFail() entering
+FAIL! : tst_Counting::testFailFail(row 1) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testFailFail(row 2) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testFailInInit() entering
+PASS : tst_Counting::testFailInInit(before)
+FAIL! : tst_Counting::testFailInInit(fail) Fail in init()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(234)]
+PASS : tst_Counting::testFailInInit(after)
+INFO : tst_Counting::testFailInCleanup() entering
+PASS : tst_Counting::testFailInCleanup(before)
+QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup()
+FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)]
+PASS : tst_Counting::testFailInCleanup(after)
+INFO : tst_Counting::testSkipInInit() entering
+PASS : tst_Counting::testSkipInInit(before)
+SKIP : tst_Counting::testSkipInInit(skip) Skip in init()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(236)]
+PASS : tst_Counting::testSkipInInit(after)
+INFO : tst_Counting::testSkipInCleanup() entering
+PASS : tst_Counting::testSkipInCleanup(before)
+QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup()
+SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)]
+PASS : tst_Counting::testSkipInCleanup(after)
+INFO : tst_Counting::cleanupTestCase() entering
+PASS : tst_Counting::cleanupTestCase()
+Totals: 16 passed, 8 failed, 8 skipped
+********* Finished testing of tst_Counting *********
diff --git a/tests/auto/testlib/selftests/expected_verbose1.xml b/tests/auto/testlib/selftests/expected_verbose1.xml
new file mode 100644
index 0000000000..7ed93b9c73
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose1.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<TestCase name="tst_Counting">
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="testPassPass">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testPassSkip">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testPassFail">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipPass">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipSkip">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testSkipFail">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailPass">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailSkip">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testFailFail">
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="234">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in init()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in cleanup()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="236">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in init()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in cleanup()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+</TestCase>
diff --git a/tests/auto/testlib/selftests/expected_verbose1.xunitxml b/tests/auto/testlib/selftests/expected_verbose1.xunitxml
new file mode 100644
index 0000000000..f317ed5923
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose1.xunitxml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="10" failures="8" tests="15" name="tst_Counting">
+ <properties>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ </properties>
+ <testcase result="pass" name="initTestCase"/>
+ <testcase result="pass" name="testPassPass"/>
+ <testcase result="pass" name="testPassSkip">
+ <!-- tag="row 2" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="testPassFail">
+ <failure tag="row 2" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="testSkipPass">
+ <!-- tag="row 1" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase name="testSkipSkip">
+ <!-- tag="row 1" message="Skipping" type="skip" -->
+ <!-- tag="row 2" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="testSkipFail">
+ <!-- tag="row 1" message="Skipping" type="skip" -->
+ <failure tag="row 2" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailPass">
+ <failure tag="row 1" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailSkip">
+ <failure tag="row 1" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ <!-- tag="row 2" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="testFailFail">
+ <failure tag="row 1" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ <failure tag="row 2" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailInInit">
+ <failure tag="fail" message="Fail in init()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailInCleanup">
+ <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" -->
+ <failure tag="fail" message="Fail in cleanup()" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="testSkipInInit">
+ <!-- tag="skip" message="Skip in init()" type="skip" -->
+ </testcase>
+ <testcase result="pass" name="testSkipInCleanup">
+ <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" -->
+ <!-- tag="skip" message="Skip in cleanup()" type="skip" -->
+ </testcase>
+ <testcase result="pass" name="cleanupTestCase"/>
+ <system-err>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[This test function should execute and then QFAIL in cleanup() ]]>
+<![CDATA[Skip in init()]]>
+<![CDATA[This test function should execute and then QSKIP in cleanup() ]]>
+<![CDATA[Skip in cleanup()]]>
+ </system-err>
+</testsuite>
diff --git a/tests/auto/testlib/selftests/expected_verbose2.lightxml b/tests/auto/testlib/selftests/expected_verbose2.lightxml
new file mode 100644
index 0000000000..1310f2bb09
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose2.lightxml
@@ -0,0 +1,222 @@
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="testPassPass">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testPassSkip">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testPassFail">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipPass">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipSkip">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testSkipFail">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailPass">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailSkip">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testFailFail">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="234">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in init()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in cleanup()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="236">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in init()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in cleanup()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
diff --git a/tests/auto/testlib/selftests/expected_verbose2.txt b/tests/auto/testlib/selftests/expected_verbose2.txt
new file mode 100644
index 0000000000..9012a7c569
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose2.txt
@@ -0,0 +1,105 @@
+********* Start testing of tst_Counting *********
+Config: Using QTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
+INFO : tst_Counting::initTestCase() entering
+PASS : tst_Counting::initTestCase()
+INFO : tst_Counting::testPassPass() entering
+INFO : tst_Counting::testPassPass(row 1) QVERIFY(true)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(111)]
+INFO : tst_Counting::testPassPass(row 1) COMPARE()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(112)]
+PASS : tst_Counting::testPassPass(row 1)
+INFO : tst_Counting::testPassPass(row 2) QVERIFY(true)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(111)]
+INFO : tst_Counting::testPassPass(row 2) COMPARE()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(112)]
+PASS : tst_Counting::testPassPass(row 2)
+INFO : tst_Counting::testPassSkip() entering
+INFO : tst_Counting::testPassSkip(row 1) QVERIFY(true)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(111)]
+INFO : tst_Counting::testPassSkip(row 1) COMPARE()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(112)]
+PASS : tst_Counting::testPassSkip(row 1)
+SKIP : tst_Counting::testPassSkip(row 2) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testPassFail() entering
+INFO : tst_Counting::testPassFail(row 1) QVERIFY(true)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(111)]
+INFO : tst_Counting::testPassFail(row 1) COMPARE()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(112)]
+PASS : tst_Counting::testPassFail(row 1)
+INFO : tst_Counting::testPassFail(row 2) QVERIFY(false)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testPassFail(row 2) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testSkipPass() entering
+SKIP : tst_Counting::testSkipPass(row 1) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testSkipPass(row 2) QVERIFY(true)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(111)]
+INFO : tst_Counting::testSkipPass(row 2) COMPARE()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(112)]
+PASS : tst_Counting::testSkipPass(row 2)
+INFO : tst_Counting::testSkipSkip() entering
+SKIP : tst_Counting::testSkipSkip(row 1) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+SKIP : tst_Counting::testSkipSkip(row 2) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testSkipFail() entering
+SKIP : tst_Counting::testSkipFail(row 1) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testSkipFail(row 2) QVERIFY(false)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testSkipFail(row 2) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testFailPass() entering
+INFO : tst_Counting::testFailPass(row 1) QVERIFY(false)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testFailPass(row 1) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testFailPass(row 2) QVERIFY(true)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(111)]
+INFO : tst_Counting::testFailPass(row 2) COMPARE()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(112)]
+PASS : tst_Counting::testFailPass(row 2)
+INFO : tst_Counting::testFailSkip() entering
+INFO : tst_Counting::testFailSkip(row 1) QVERIFY(false)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testFailSkip(row 1) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+SKIP : tst_Counting::testFailSkip(row 2) Skipping
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(118)]
+INFO : tst_Counting::testFailFail() entering
+INFO : tst_Counting::testFailFail(row 1) QVERIFY(false)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testFailFail(row 1) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testFailFail(row 2) QVERIFY(false)
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+FAIL! : tst_Counting::testFailFail(row 2) 'false' returned FALSE. ()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(115)]
+INFO : tst_Counting::testFailInInit() entering
+PASS : tst_Counting::testFailInInit(before)
+FAIL! : tst_Counting::testFailInInit(fail) Fail in init()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(234)]
+PASS : tst_Counting::testFailInInit(after)
+INFO : tst_Counting::testFailInCleanup() entering
+PASS : tst_Counting::testFailInCleanup(before)
+QDEBUG : tst_Counting::testFailInCleanup(fail) This test function should execute and then QFAIL in cleanup()
+FAIL! : tst_Counting::testFailInCleanup(fail) Fail in cleanup()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(242)]
+PASS : tst_Counting::testFailInCleanup(after)
+INFO : tst_Counting::testSkipInInit() entering
+PASS : tst_Counting::testSkipInInit(before)
+SKIP : tst_Counting::testSkipInInit(skip) Skip in init()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(236)]
+PASS : tst_Counting::testSkipInInit(after)
+INFO : tst_Counting::testSkipInCleanup() entering
+PASS : tst_Counting::testSkipInCleanup(before)
+QDEBUG : tst_Counting::testSkipInCleanup(skip) This test function should execute and then QSKIP in cleanup()
+SKIP : tst_Counting::testSkipInCleanup(skip) Skip in cleanup()
+ Loc: [/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp(244)]
+PASS : tst_Counting::testSkipInCleanup(after)
+INFO : tst_Counting::cleanupTestCase() entering
+PASS : tst_Counting::cleanupTestCase()
+Totals: 16 passed, 8 failed, 8 skipped
+********* Finished testing of tst_Counting *********
diff --git a/tests/auto/testlib/selftests/expected_verbose2.xml b/tests/auto/testlib/selftests/expected_verbose2.xml
new file mode 100644
index 0000000000..693ef2b187
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose2.xml
@@ -0,0 +1,225 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<TestCase name="tst_Counting">
+<Environment>
+ <QtVersion>@INSERT_QT_VERSION_HERE@</QtVersion>
+ <QTestVersion>@INSERT_QT_VERSION_HERE@</QTestVersion>
+</Environment>
+<TestFunction name="initTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+<TestFunction name="testPassPass">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testPassSkip">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testPassFail">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 1]]></DataTag>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipPass">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipSkip">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testSkipFail">
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailPass">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="111">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(true)]]></Description>
+</Message>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="112">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[COMPARE()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[row 2]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailSkip">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="118">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[Skipping]]></Description>
+</Message>
+</TestFunction>
+<TestFunction name="testFailFail">
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 1]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+<Message type="info" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA[QVERIFY(false)]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="115">
+ <DataTag><![CDATA[row 2]]></DataTag>
+ <Description><![CDATA['false' returned FALSE. ()]]></Description>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="234">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in init()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testFailInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QFAIL in cleanup() ]]></Description>
+</Message>
+<Incident type="fail" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="242">
+ <DataTag><![CDATA[fail]]></DataTag>
+ <Description><![CDATA[Fail in cleanup()]]></Description>
+</Incident>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInInit">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="236">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in init()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="testSkipInCleanup">
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[before]]></DataTag>
+</Incident>
+<Message type="qdebug" file="" line="0">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[This test function should execute and then QSKIP in cleanup() ]]></Description>
+</Message>
+<Message type="skip" file="/home/user/dev/qt5/qtbase/tests/auto/testlib/selftests/counting/tst_counting.cpp" line="244">
+ <DataTag><![CDATA[skip]]></DataTag>
+ <Description><![CDATA[Skip in cleanup()]]></Description>
+</Message>
+<Incident type="pass" file="" line="0">
+ <DataTag><![CDATA[after]]></DataTag>
+</Incident>
+</TestFunction>
+<TestFunction name="cleanupTestCase">
+<Incident type="pass" file="" line="0" />
+</TestFunction>
+</TestCase>
diff --git a/tests/auto/testlib/selftests/expected_verbose2.xunitxml b/tests/auto/testlib/selftests/expected_verbose2.xunitxml
new file mode 100644
index 0000000000..8b9ed5257d
--- /dev/null
+++ b/tests/auto/testlib/selftests/expected_verbose2.xunitxml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite errors="28" failures="8" tests="15" name="tst_Counting">
+ <properties>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QTestVersion"/>
+ <property value="@INSERT_QT_VERSION_HERE@" name="QtVersion"/>
+ </properties>
+ <testcase result="pass" name="initTestCase"/>
+ <testcase result="pass" name="testPassPass">
+ <!-- tag="row 1" message="QVERIFY(true)" type="info" -->
+ <!-- tag="row 1" message="COMPARE()" type="info" -->
+ <!-- tag="row 2" message="QVERIFY(true)" type="info" -->
+ <!-- tag="row 2" message="COMPARE()" type="info" -->
+ </testcase>
+ <testcase result="pass" name="testPassSkip">
+ <!-- tag="row 1" message="QVERIFY(true)" type="info" -->
+ <!-- tag="row 1" message="COMPARE()" type="info" -->
+ <!-- tag="row 2" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="testPassFail">
+ <!-- tag="row 1" message="QVERIFY(true)" type="info" -->
+ <!-- tag="row 1" message="COMPARE()" type="info" -->
+ <!-- tag="row 2" message="QVERIFY(false)" type="info" -->
+ <failure tag="row 2" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="testSkipPass">
+ <!-- tag="row 1" message="Skipping" type="skip" -->
+ <!-- tag="row 2" message="QVERIFY(true)" type="info" -->
+ <!-- tag="row 2" message="COMPARE()" type="info" -->
+ </testcase>
+ <testcase name="testSkipSkip">
+ <!-- tag="row 1" message="Skipping" type="skip" -->
+ <!-- tag="row 2" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="testSkipFail">
+ <!-- tag="row 1" message="Skipping" type="skip" -->
+ <!-- tag="row 2" message="QVERIFY(false)" type="info" -->
+ <failure tag="row 2" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailPass">
+ <!-- tag="row 1" message="QVERIFY(false)" type="info" -->
+ <failure tag="row 1" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ <!-- tag="row 2" message="QVERIFY(true)" type="info" -->
+ <!-- tag="row 2" message="COMPARE()" type="info" -->
+ </testcase>
+ <testcase result="fail" name="testFailSkip">
+ <!-- tag="row 1" message="QVERIFY(false)" type="info" -->
+ <failure tag="row 1" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ <!-- tag="row 2" message="Skipping" type="skip" -->
+ </testcase>
+ <testcase result="fail" name="testFailFail">
+ <!-- tag="row 1" message="QVERIFY(false)" type="info" -->
+ <failure tag="row 1" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ <!-- tag="row 2" message="QVERIFY(false)" type="info" -->
+ <failure tag="row 2" message="&apos;false&apos; returned FALSE. ()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailInInit">
+ <failure tag="fail" message="Fail in init()" result="fail"/>
+ </testcase>
+ <testcase result="fail" name="testFailInCleanup">
+ <!-- tag="fail" message="This test function should execute and then QFAIL in cleanup() " type="qdebug" -->
+ <failure tag="fail" message="Fail in cleanup()" result="fail"/>
+ </testcase>
+ <testcase result="pass" name="testSkipInInit">
+ <!-- tag="skip" message="Skip in init()" type="skip" -->
+ </testcase>
+ <testcase result="pass" name="testSkipInCleanup">
+ <!-- tag="skip" message="This test function should execute and then QSKIP in cleanup() " type="qdebug" -->
+ <!-- tag="skip" message="Skip in cleanup()" type="skip" -->
+ </testcase>
+ <testcase result="pass" name="cleanupTestCase"/>
+ <system-err>
+<![CDATA[QVERIFY(true)]]>
+<![CDATA[COMPARE()]]>
+<![CDATA[QVERIFY(true)]]>
+<![CDATA[COMPARE()]]>
+<![CDATA[QVERIFY(true)]]>
+<![CDATA[COMPARE()]]>
+<![CDATA[Skipping]]>
+<![CDATA[QVERIFY(true)]]>
+<![CDATA[COMPARE()]]>
+<![CDATA[QVERIFY(false)]]>
+<![CDATA[Skipping]]>
+<![CDATA[QVERIFY(true)]]>
+<![CDATA[COMPARE()]]>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[Skipping]]>
+<![CDATA[QVERIFY(false)]]>
+<![CDATA[QVERIFY(false)]]>
+<![CDATA[QVERIFY(true)]]>
+<![CDATA[COMPARE()]]>
+<![CDATA[QVERIFY(false)]]>
+<![CDATA[Skipping]]>
+<![CDATA[QVERIFY(false)]]>
+<![CDATA[QVERIFY(false)]]>
+<![CDATA[This test function should execute and then QFAIL in cleanup() ]]>
+<![CDATA[Skip in init()]]>
+<![CDATA[This test function should execute and then QSKIP in cleanup() ]]>
+<![CDATA[Skip in cleanup()]]>
+ </system-err>
+</testsuite>
diff --git a/tests/auto/testlib/selftests/selftests.pri b/tests/auto/testlib/selftests/selftests.pri
index 1fc66e6364..c9474419eb 100644
--- a/tests/auto/testlib/selftests/selftests.pri
+++ b/tests/auto/testlib/selftests/selftests.pri
@@ -39,5 +39,7 @@ SUBPROGRAMS = \
sleep \
strcmp \
subtest \
+ verbose1 \
+ verbose2 \
warnings \
xunit
diff --git a/tests/auto/testlib/selftests/selftests.qrc b/tests/auto/testlib/selftests/selftests.qrc
index d05ac2a516..03de05fb89 100644
--- a/tests/auto/testlib/selftests/selftests.qrc
+++ b/tests/auto/testlib/selftests/selftests.qrc
@@ -71,11 +71,14 @@
<file>expected_failinitdata.txt</file>
<file>expected_failinitdata.xml</file>
<file>expected_failinitdata.xunitxml</file>
- <file>expected_fatal.txt</file>
<file>expected_fetchbogus.lightxml</file>
<file>expected_fetchbogus.txt</file>
<file>expected_fetchbogus.xml</file>
<file>expected_fetchbogus.xunitxml</file>
+ <file>expected_findtestdata.lightxml</file>
+ <file>expected_findtestdata.txt</file>
+ <file>expected_findtestdata.xml</file>
+ <file>expected_findtestdata.xunitxml</file>
<file>expected_float.txt</file>
<file>expected_globaldata.lightxml</file>
<file>expected_globaldata.txt</file>
@@ -123,10 +126,14 @@
<file>expected_subtest.txt</file>
<file>expected_subtest.xml</file>
<file>expected_subtest.xunitxml</file>
- <file>expected_findtestdata.lightxml</file>
- <file>expected_findtestdata.txt</file>
- <file>expected_findtestdata.xml</file>
- <file>expected_findtestdata.xunitxml</file>
+ <file>expected_verbose1.lightxml</file>
+ <file>expected_verbose1.txt</file>
+ <file>expected_verbose1.xml</file>
+ <file>expected_verbose1.xunitxml</file>
+ <file>expected_verbose2.lightxml</file>
+ <file>expected_verbose2.txt</file>
+ <file>expected_verbose2.xml</file>
+ <file>expected_verbose2.xunitxml</file>
<file>expected_warnings.lightxml</file>
<file>expected_warnings.txt</file>
<file>expected_warnings.xml</file>
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 2b90bdb389..5d216992d7 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -346,6 +346,7 @@ void tst_Selftests::runSubTest_data()
// Disable this test on Windows, as the run-time will popup dialogs with warnings
<< "fetchbogus"
#endif
+ << "findtestdata"
<< "float"
<< "globaldata"
<< "longstring"
@@ -363,7 +364,8 @@ void tst_Selftests::runSubTest_data()
<< "sleep"
<< "strcmp"
<< "subtest"
- << "findtestdata"
+ << "verbose1"
+ << "verbose2"
<< "warnings"
<< "xunit"
;
@@ -413,6 +415,12 @@ void tst_Selftests::runSubTest_data()
else if (subtest == "silent") {
arguments << "-silent";
}
+ else if (subtest == "verbose1") {
+ arguments << "-v1";
+ }
+ else if (subtest == "verbose2") {
+ arguments << "-v2";
+ }
// These tests don't work right unless logging plain text to
diff --git a/tests/auto/testlib/selftests/verbose1/verbose1.pro b/tests/auto/testlib/selftests/verbose1/verbose1.pro
new file mode 100644
index 0000000000..f00ae69d17
--- /dev/null
+++ b/tests/auto/testlib/selftests/verbose1/verbose1.pro
@@ -0,0 +1,10 @@
+# This test just reuses the counting selftest to show how the output
+# differs when the -v1 command-line switch is used.
+
+SOURCES += ../counting/tst_counting.cpp
+QT = core testlib
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = verbose1
diff --git a/tests/auto/testlib/selftests/verbose2/verbose2.pro b/tests/auto/testlib/selftests/verbose2/verbose2.pro
new file mode 100644
index 0000000000..796cdeb975
--- /dev/null
+++ b/tests/auto/testlib/selftests/verbose2/verbose2.pro
@@ -0,0 +1,10 @@
+# This test just reuses the counting selftest to show how the output
+# differs when the -v2 command-line switch is used.
+
+SOURCES += ../counting/tst_counting.cpp
+QT = core testlib
+
+mac:CONFIG -= app_bundle
+CONFIG -= debug_and_release_target
+
+TARGET = verbose2
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index ae3780207b..e8639eec47 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -535,6 +535,7 @@ private slots:
void cxx11Enums_data();
void cxx11Enums();
void returnRefs();
+ void redefinedNames();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -1762,6 +1763,157 @@ void tst_Moc::returnRefs()
// they used to cause miscompilation of the moc generated file.
}
+struct ActualInterfaceName
+{
+ virtual ~ActualInterfaceName() {}
+ virtual void foo() = 0;
+};
+
+QT_BEGIN_NAMESPACE
+Q_DECLARE_INTERFACE(ActualInterfaceName, "foo.bar.ActualInterfaceName")
+QT_END_NAMESPACE
+
+#define DefinedInterfaceName ActualInterfaceName
+#define RedefinedInterfaceName DefinedInterfaceName
+
+struct ActualName {};
+#define DefinedName ActualName
+#define RedefinedName DefinedName
+
+template<typename T>
+struct ActualTemplateName {};
+
+#define DefinedTemplateName ActualTemplateName
+#define RedefinedTemplateName DefinedTemplateName
+
+#define ActualName ActualName
+
+class RedefinitionTest : public QObject, public RedefinedInterfaceName
+{
+ Q_OBJECT
+ Q_INTERFACES(RedefinedInterfaceName)
+
+ Q_PROPERTY(ActualName p1 READ getP1)
+
+ Q_PROPERTY(DefinedName p2 READ getP2)
+ Q_PROPERTY(RedefinedName p3 READ getP3)
+
+ Q_PROPERTY(DefinedName * p4 READ getP4)
+ Q_PROPERTY(RedefinedName * p5 READ getP5)
+
+ Q_PROPERTY(DefinedName ** p6 READ getP6)
+ Q_PROPERTY(RedefinedName ** p7 READ getP7)
+
+ Q_PROPERTY(DefinedName const ** p8 READ getP8)
+ Q_PROPERTY(RedefinedName const ** p9 READ getP9)
+
+ Q_PROPERTY(DefinedName const * const * p10 READ getP10)
+ Q_PROPERTY(RedefinedName const * const * p11 READ getP11)
+
+ Q_PROPERTY(DefinedTemplateName<DefinedName> p16 READ getP16)
+ Q_PROPERTY(RedefinedTemplateName<RedefinedName> p17 READ getP17)
+
+ Q_PROPERTY(DefinedTemplateName<DefinedName **> p18 READ getP18)
+ Q_PROPERTY(RedefinedTemplateName<RedefinedName **> p19 READ getP19)
+
+ Q_PROPERTY(DefinedTemplateName<DefinedName const * const> p20 READ getP20)
+ Q_PROPERTY(RedefinedTemplateName<RedefinedName const * const> p21 READ getP21)
+
+signals:
+ void signal1(ActualName);
+ void signal2(DefinedName);
+ void signal3(RedefinedName);
+
+public slots:
+ void slot1(ActualName x) { v = x; }
+ void slot2(DefinedName x) { v = x; }
+ void slot3(RedefinedName x) { v = x; }
+
+public:
+ void foo() {}
+
+ ActualName v;
+
+ ActualName *vp;
+ ActualName const *vcp;
+
+ ActualTemplateName<ActualName> tv;
+ ActualTemplateName<ActualName **> tvpp;
+ ActualTemplateName<ActualName const * const> tvcpc;
+
+ ActualName getP0() { return v; }
+ ActualName getP1() { return v; }
+
+ DefinedName getP2() { return v; }
+ RedefinedName getP3() { return v; }
+
+ DefinedName * getP4() { return &v; }
+ RedefinedName * getP5() { return &v; }
+
+ DefinedName ** getP6() { return &vp; }
+ RedefinedName ** getP7() { return &vp; }
+
+ DefinedName const ** getP8() { return &vcp; }
+ RedefinedName const ** getP9() { return &vcp; }
+
+ DefinedName const * const * getP10() const { return &vcp; }
+ RedefinedName const * const * getP11() const { return &vcp; }
+
+ DefinedTemplateName<DefinedName> getP16() { return tv; }
+ RedefinedTemplateName<RedefinedName> getP17() { return tv; }
+
+ DefinedTemplateName<DefinedName **> getP18() { return tvpp; }
+ RedefinedTemplateName<RedefinedName **> getP19() { return tvpp; }
+
+ DefinedTemplateName<DefinedName const * const> getP20() { return tvcpc; }
+ RedefinedTemplateName<RedefinedName const * const> getP21() { return tvcpc; }
+};
+
+void tst_Moc::redefinedNames()
+{
+ RedefinitionTest tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfProperty("p1") != -1);
+
+ // Use the true slot name rather than the declared name
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal1(ActualName)),
+ &tst, SLOT(slot1(ActualName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal2(ActualName)),
+ &tst, SLOT(slot2(ActualName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal3(ActualName)),
+ &tst, SLOT(slot3(ActualName))));
+
+ // Use the declared slot name rather than the true name
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal1(ActualName)),
+ &tst, SLOT(slot2(DefinedName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal1(ActualName)),
+ &tst, SLOT(slot3(RedefinedName))));
+
+ // Use the declared signal name rather than the true name
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal2(DefinedName)),
+ &tst, SLOT(slot1(ActualName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal3(RedefinedName)),
+ &tst, SLOT(slot1(ActualName))));
+
+ // Use both declared names
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal2(DefinedName)),
+ &tst, SLOT(slot2(DefinedName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal2(DefinedName)),
+ &tst, SLOT(slot3(RedefinedName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal3(RedefinedName)),
+ &tst, SLOT(slot2(DefinedName))));
+
+ QVERIFY(QObject::connect(&tst, SIGNAL(signal3(RedefinedName)),
+ &tst, SLOT(slot3(RedefinedName))));
+}
+
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"
diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp
index 97c640b28f..4e5dc26eac 100644
--- a/tests/auto/tools/qmake/testcompiler.cpp
+++ b/tests/auto/tools/qmake/testcompiler.cpp
@@ -132,13 +132,34 @@ bool TestCompiler::errorOut()
return false;
}
+// Return the system environment, remove MAKEFLAGS variable in
+// case the CI uses jom passing flags incompatible to nmake
+// or vice versa.
+static inline QStringList systemEnvironment()
+{
+#ifdef Q_OS_WIN
+ static QStringList result;
+ if (result.isEmpty()) {
+ foreach (const QString &variable, QProcess::systemEnvironment()) {
+ if (variable.startsWith(QStringLiteral("MAKEFLAGS="), Qt::CaseInsensitive)) {
+ qWarning("Removing environment setting '%s'", qPrintable(variable));
+ } else {
+ result.push_back(variable);
+ }
+ }
+ }
+#else
+ static const QStringList result = QProcess::systemEnvironment();
+#endif // ifdef Q_OS_WIN
+ return result;
+}
+
bool TestCompiler::runCommand( QString cmdline, bool expectFail )
{
testOutput_.append("Running command: " + cmdline);
QProcess child;
- if (!environment_.empty())
- child.setEnvironment(QProcess::systemEnvironment() + environment_);
+ child.setEnvironment(systemEnvironment() + environment_);
child.start(cmdline);
if (!child.waitForStarted(-1)) {
diff --git a/tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri b/tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri
index cbd2d0f7d0..ea58ef076e 100644
--- a/tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri
+++ b/tests/auto/tools/qmake/testdata/export_across_file_boundaries/oink.pri
@@ -1 +1,2 @@
+load(default_pre)
setVar(BAR)
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
index 6e08e2d02b..166306757c 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro
@@ -5,5 +5,3 @@ QT += core-private gui testlib
SOURCES += tst_qfilesystemmodel.cpp
TARGET = tst_qfilesystemmodel
-
-win32:CONFIG += insignificant_test # QTBUG-24291
diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 8724bf63c8..fe374b1e8d 100644
--- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -51,6 +51,10 @@
#include <QTime>
#include <QStyle>
#include <QtGlobal>
+#include <QTemporaryDir>
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+# include <qt_windows.h> // for SetFileAttributes
+#endif
#define WAITTIME 1000
@@ -69,13 +73,13 @@ class tst_QFileSystemModel : public QObject {
public:
tst_QFileSystemModel();
- virtual ~tst_QFileSystemModel();
public Q_SLOTS:
void init();
void cleanup();
private slots:
+ void initTestCase();
void indexPath();
void rootPath();
@@ -122,29 +126,17 @@ private slots:
void roleNames();
protected:
- bool createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount = 0, const QStringList &intial_dirs = QStringList(), const QString &baseDir = QDir::temp().absolutePath());
+ bool createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount = 0, const QStringList &intial_dirs = QStringList());
private:
QFileSystemModel *model;
QString flatDirTestPath;
+ QTemporaryDir m_tempDir;
};
tst_QFileSystemModel::tst_QFileSystemModel() : model(0)
{
qRegisterMetaType<QModelIndex>("QModelIndex");
-
- QTime midnight(0, 0, 0);
- qsrand(midnight.secsTo(QTime::currentTime()));
- // generating unique temporary directory name
- flatDirTestPath = QDir::temp().path() + '/' + QString("flatdirtest.") + QString::number(qrand());
-}
-
-tst_QFileSystemModel::~tst_QFileSystemModel()
-{
- QString tmp = flatDirTestPath;
- QDir dir(tmp);
- if (dir.exists() && !dir.rmdir(tmp))
- qWarning("failed to remove tmp dir %s", dir.dirName().toAscii().data());
}
void tst_QFileSystemModel::init()
@@ -178,6 +170,12 @@ void tst_QFileSystemModel::cleanup()
}
}
+void tst_QFileSystemModel::initTestCase()
+{
+ QVERIFY(m_tempDir.isValid());
+ flatDirTestPath = m_tempDir.path();
+}
+
void tst_QFileSystemModel::indexPath()
{
#if !defined(Q_OS_WIN)
@@ -367,15 +365,8 @@ void tst_QFileSystemModel::iconProvider()
delete custom;
}
-bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs, const QString &dir)
+bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs)
{
- QDir baseDir(dir);
- if (!baseDir.exists(test_path)) {
- if (!baseDir.mkdir(test_path) && false) {
- qDebug() << "failed to create dir" << test_path;
- return false;
- }
- }
//qDebug() << (model->rowCount(model->index(test_path))) << existingFileCount << initial_files;
TRY_WAIT((model->rowCount(model->index(test_path)) == existingFileCount));
for (int i = 0; i < initial_dirs.count(); ++i) {
@@ -406,8 +397,21 @@ bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringLi
}
file.close();
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- if (initial_files.at(i)[0] == '.')
- QProcess::execute(QString("attrib +h %1").arg(file.fileName()));
+ if (initial_files.at(i)[0] == '.') {
+ QString hiddenFile = QDir::toNativeSeparators(file.fileName());
+ wchar_t nativeHiddenFile[MAX_PATH];
+ qMemSet(nativeHiddenFile, 0, sizeof(nativeHiddenFile));
+ hiddenFile.toWCharArray(nativeHiddenFile);
+ DWORD currentAttributes = ::GetFileAttributes(nativeHiddenFile);
+ if (currentAttributes == 0xFFFFFFFF) {
+ qErrnoWarning("failed to get file attributes: %s", qPrintable(hiddenFile));
+ return false;
+ }
+ if (!::SetFileAttributes(nativeHiddenFile, currentAttributes | FILE_ATTRIBUTE_HIDDEN)) {
+ qErrnoWarning("failed to set file hidden: %s", qPrintable(hiddenFile));
+ return false;
+ }
+ }
#endif
//qDebug() << test_path + '/' + initial_files.at(i) << (QFile::exists(test_path + '/' + initial_files.at(i)));
}
@@ -818,16 +822,8 @@ void tst_QFileSystemModel::sort()
myModel->d_func()->disableRecursiveSort = true;
#endif
- QDir dir(QDir::tempPath());
- //initialize the randomness
- qsrand(QDateTime::currentDateTime().toTime_t());
- QString tempName = QLatin1String("sortTemp.") + QString::number(qrand());
- dir.mkdir(tempName);
- dir.cd(tempName);
- QTRY_VERIFY(dir.exists());
-
+ QDir dir(flatDirTestPath);
const QString dirPath = dir.absolutePath();
- QVERIFY(dir.exists());
//Create a file that will be at the end when sorting by name (For Mac, the default)
//but if we sort by size descending it will be the first
@@ -889,14 +885,6 @@ void tst_QFileSystemModel::sort()
delete tree;
delete myModel;
-
- dir.setPath(QDir::tempPath());
- dir.cd(tempName);
- tempFile.remove();
- tempFile2.remove();
- dir.cdUp();
- dir.rmdir(tempName);
-
}
void tst_QFileSystemModel::mkdir()
@@ -978,29 +966,17 @@ void tst_QFileSystemModel::drives()
void tst_QFileSystemModel::dirsBeforeFiles()
{
- const QString dirPath = QString("%1/task221717_sortedOrder_test_dir").arg(QDir::tempPath());
- QDir dir(dirPath);
- // clean up from last time
- if (dir.exists()) {
- for (int i = 0; i < 3; ++i) {
- QLatin1Char c('a' + i);
- dir.rmdir(QString("%1-dir").arg(c));
- QFile::remove(dirPath + QString("/%1-file").arg(c));
- }
- dir.rmdir(dirPath);
- }
- QVERIFY(dir.mkpath(dirPath));
- QVERIFY(QDir(dirPath).exists());
+ QDir dir(flatDirTestPath);
for (int i = 0; i < 3; ++i) {
QLatin1Char c('a' + i);
dir.mkdir(QString("%1-dir").arg(c));
- QFile file(dirPath + QString("/%1-file").arg(c));
+ QFile file(flatDirTestPath + QString("/%1-file").arg(c));
file.open(QIODevice::ReadWrite);
file.close();
}
- QModelIndex root = model->setRootPath(dirPath);
+ QModelIndex root = model->setRootPath(flatDirTestPath);
QTest::qWait(1000); // allow model to be notified by the file system watcher
// ensure that no file occurs before a directory
diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
index 872c13216f..9d9b55cafd 100644
--- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
+++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp
@@ -562,8 +562,8 @@ void tst_QWizard::setDefaultProperty()
// make sure the data structure is reasonable
for (int i = 0; i < 200000; ++i) {
- wizard.setDefaultProperty("QLineEdit", "x" + QByteArray::number(i), 0);
- wizard.setDefaultProperty("QLabel", "y" + QByteArray::number(i), 0);
+ wizard.setDefaultProperty("QLineEdit", QByteArray("x" + QByteArray::number(i)).constData(), 0);
+ wizard.setDefaultProperty("QLabel", QByteArray("y" + QByteArray::number(i)).constData(), 0);
}
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index ca5b992012..843b584ce5 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -3379,10 +3379,11 @@ void tst_QGraphicsProxyWidget::updateAndDelete()
// Update and hide.
proxy->update();
proxy->hide();
- QTRY_COMPARE(view.npaints, 1);
#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23700", Continue);
+ QEXPECT_FAIL("", "QTBUG-23700", Abort);
#endif
+
+ QTRY_COMPARE(view.npaints, 1);
QCOMPARE(view.paintEventRegion, expectedRegion);
proxy->show();
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index 84dea04c45..ee7ec7ba57 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -69,6 +69,7 @@
#include <QtWidgets/QStyle>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QDesktopWidget>
+#include <private/qgraphicsscene_p.h>
#include <private/qgraphicsview_p.h>
#include "../../../platformquirks.h"
#include "../../../shared/platforminputcontext.h"
@@ -136,6 +137,14 @@ protected:
QEvent::Type spied;
};
+#if defined QT_BUILD_INTERNAL
+class FriendlyGraphicsScene : public QGraphicsScene
+{
+ friend class tst_QGraphicsView;
+ Q_DECLARE_PRIVATE(QGraphicsScene);
+};
+#endif
+
class tst_QGraphicsView : public QObject
{
Q_OBJECT
@@ -167,6 +176,10 @@ private slots:
void ensureVisibleRect();
void fitInView();
void itemsAtPoint();
+#if defined QT_BUILD_INTERNAL
+ void itemsAtPosition_data();
+ void itemsAtPosition();
+#endif
void itemsInRect();
void itemsInRect_cosmeticAdjust_data();
void itemsInRect_cosmeticAdjust();
@@ -1354,6 +1367,55 @@ void tst_QGraphicsView::itemsAtPoint()
QCOMPARE(items.takeFirst()->zValue(), qreal(-1));
}
+#if defined QT_BUILD_INTERNAL
+void tst_QGraphicsView::itemsAtPosition_data()
+{
+ QTest::addColumn<float>("rotation");
+ QTest::addColumn<float>("scale");
+ QTest::addColumn<QPoint>("viewPos");
+ QTest::addColumn<bool>("ignoreTransform");
+ QTest::addColumn<bool>("hit");
+ QTest::newRow("scaled + ignore transform, no hit") << 0.0f << 1000.0f << QPoint(0, 0) << true << false;
+ QTest::newRow("scaled + ignore transform, hit") << 0.0f << 1000.0f << QPoint(100, 100) << true << true;
+ QTest::newRow("rotated + scaled, no hit") << 45.0f << 2.0f << QPoint(90, 90) << false << false;
+ QTest::newRow("rotated + scaled, hit") << 45.0f << 2.0f << QPoint(100, 100) << false << true;
+}
+
+void tst_QGraphicsView::itemsAtPosition()
+{
+ QFETCH(float, rotation);
+ QFETCH(float, scale);
+ QFETCH(QPoint, viewPos);
+ QFETCH(bool, ignoreTransform);
+ QFETCH(bool, hit);
+
+ FriendlyGraphicsScene scene;
+ scene.setSceneRect(QRect(-100, -100, 200, 200));
+ QGraphicsItem *item = scene.addRect(-5, -5, 10, 10);
+
+ if (ignoreTransform)
+ item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
+
+ QGraphicsView view;
+ view.setFrameStyle(QFrame::NoFrame);
+ view.resize(200, 200);
+ view.scale(scale, scale);
+ view.rotate(rotation);
+ view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ view.setScene(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ QPoint screenPos = view.viewport()->mapToGlobal(viewPos);
+ QPointF scenePos = view.mapToScene(viewPos);
+ QGraphicsScenePrivate *viewPrivate = scene.d_func();
+ QList<QGraphicsItem *> items;
+ items = viewPrivate->itemsAtPosition(screenPos, scenePos, view.viewport());
+ QCOMPARE(!items.empty(), hit);
+}
+#endif
+
void tst_QGraphicsView::itemsInRect()
{
QGraphicsScene scene;
@@ -4276,9 +4338,16 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
QPointF newMouseScenePos = view.mapToScene(mouseViewPos);
qreal slack = 1;
- QEXPECT_FAIL("", "QTBUG-22455", Abort);
- QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack);
- QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack);
+
+ const qreal dx = qAbs(newMouseScenePos.x() - mouseScenePos.x());
+ const qreal dy = qAbs(newMouseScenePos.y() - mouseScenePos.y());
+ const QByteArray message = QString::fromLatin1("QTBUG-22455, distance: dx=%1, dy=%2 slack=%3 (%4).").
+ arg(dx).arg(dy).arg(slack).arg(qApp->style()->metaObject()->className()).toLocal8Bit();
+ // This is highly unstable (observed to pass on Windows and some Linux configurations).
+#ifdef Q_OS_MAC
+ QEXPECT_FAIL("", message.constData(), Abort);
+#endif
+ QVERIFY2(dx < slack && dy < slack, message.constData());
#endif
}
diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
index 0a2d0cd2f8..c6b2b49d98 100644
--- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1158,9 +1158,6 @@ void tst_QGraphicsWidget::initStyleOption()
QCOMPARE(hasFocus, focus);
bool isUnderMouse = option.state & QStyle::State_MouseOver;
#ifndef Q_OS_WINCE
-# if !defined(Q_OS_MAC) && !defined(Q_OS_WIN)
- QEXPECT_FAIL("all", "QTBUG-22457", Abort);
-# endif
QCOMPARE(isUnderMouse, underMouse);
#endif
// if (layoutDirection != Qt::LeftToRight)
diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
index f139eac275..9bb08edcce 100644
--- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
+++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp
@@ -1830,10 +1830,11 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
QStringListModel model(&view);
QStringList list;
for (int i = 0; i < rowCount; ++i)
- list << QString::fromAscii("Item %1").arg(i);
+ list << QString::number(i);
model.setStringList(list);
view.setModel(&model);
+ view.setUniformItemSizes(true);
view.setViewMode(QListView::ListMode);
for (int i = 0; i < rowCount / 2; ++i)
view.setRowHidden(2 * i, true);
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
index 98872cb2f6..9bbb6aa7f6 100644
--- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
+++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp
@@ -605,9 +605,6 @@ public slots:
void tst_QApplication::quitOnLastWindowClosed()
{
-#ifdef Q_OS_WIN32
- QSKIP("This test crashes on Windows. Remove skip once the issue causing the crash is fixed (QTBUG-24300).");
-#endif
#ifndef Q_OS_MAC
// Test hangs on Mac OS X, see QTBUG-24319
{
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index caf0f1f80d..dab9dd7690 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -5693,7 +5693,6 @@ private:
void tst_QWidget::childEvents()
{
EventRecorder::EventList expected;
- bool accessibilityEnabled = false;
// Move away the cursor; otherwise it might result in an enter event if it's
// inside the widget when the widget is shown.
@@ -5735,8 +5734,6 @@ void tst_QWidget::childEvents()
<< qMakePair(&widget, QEvent::Resize)
<< qMakePair(&widget, QEvent::Show);
- if (accessibilityEnabled)
- expected << qMakePair(&widget, QEvent::AccessibilityPrepare);
expected << qMakePair(&widget, QEvent::ShowToParent);
QCOMPARE(spy.eventList(), expected);
spy.clear();
@@ -5820,8 +5817,6 @@ void tst_QWidget::childEvents()
<< qMakePair(&widget, QEvent::Resize)
<< qMakePair(&widget, QEvent::Show);
- if (accessibilityEnabled)
- expected << qMakePair(&widget, QEvent::AccessibilityPrepare);
expected << qMakePair(&widget, QEvent::ShowToParent);
QCOMPARE(spy.eventList(), expected);
spy.clear();
@@ -5908,8 +5903,6 @@ void tst_QWidget::childEvents()
<< qMakePair(&widget, QEvent::Resize)
<< qMakePair(&widget, QEvent::Show);
- if (accessibilityEnabled)
- expected << qMakePair(&widget, QEvent::AccessibilityPrepare);
expected << qMakePair(&widget, QEvent::ShowToParent);
QCOMPARE(spy.eventList(), expected);
spy.clear();
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 1201b0f1da..544923a1c3 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -555,11 +555,11 @@ void tst_QStyleSheetStyle::layoutSpacing()
void tst_QStyleSheetStyle::qproperty()
{
QPushButton pb;
- pb.setStyleSheet("QPushButton { qproperty-text: hello; qproperty-checkable: true; qproperty-checked: 1}");
+ pb.setStyleSheet("QPushButton { qproperty-text: hello; qproperty-checkable: 1; qproperty-checked: false}");
pb.ensurePolished();
QCOMPARE(pb.text(), QString("hello"));
QCOMPARE(pb.isCheckable(), true);
- QCOMPARE(pb.isChecked(), true);
+ QCOMPARE(pb.isChecked(), false);
}
namespace ns {
@@ -781,10 +781,6 @@ void tst_QStyleSheetStyle::focusColors()
+ " did not contain background color #e8ff66, using style "
+ QString::fromLatin1(qApp->style()->metaObject()->className()))
.toLocal8Bit().constData());
-#ifdef Q_OS_MAC
- if (widget == widgets.first())
- QEXPECT_FAIL("", "Failure only for first widget, the QPushButton, see QTBUG-23686", Continue);
-#endif
QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
(QString::fromLatin1(widget->metaObject()->className())
+ " did not contain text color #ff0084, using style "
@@ -882,8 +878,7 @@ void tst_QStyleSheetStyle::hoverColors()
(QString::fromLatin1(widget->metaObject()->className())
+ " did not contain background color #e8ff66").toLocal8Bit().constData());
#ifdef Q_OS_MAC
- if (qobject_cast<QPushButton *>(widget)
- || qobject_cast<QComboBox *>(widget))
+ if (qobject_cast<QComboBox *>(widget))
QEXPECT_FAIL("", "Failure only for QPushButton and QComboBox, see QTBUG-23686", Continue);
#endif
QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
index 6021f90ed4..cff847474c 100644
--- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp
@@ -93,6 +93,7 @@ private slots:
void setValue_data();
void setValue();
void setRepeatAction();
+ void connectedSliders();
private:
void waitUntilTimeElapsed(const QTime& t, int ms);
@@ -1259,5 +1260,17 @@ void tst_QAbstractSlider::setRepeatAction()
QCOMPARE(slider->value(), 115);
}
+void tst_QAbstractSlider::connectedSliders()
+{
+ Slider *slider2 = new Slider(topLevel);
+ connect(slider, SIGNAL(rangeChanged(int, int)), slider2, SLOT(setRange(int, int)));
+ const int sliderlow = 13;
+ const int sliderhigh = 1017;
+ slider->setRange(sliderlow, sliderhigh);
+ QCOMPARE(slider2->minimum(), sliderlow);
+ QCOMPARE(slider2->maximum(), sliderhigh);
+ delete slider2;
+}
+
QTEST_MAIN(tst_QAbstractSlider)
#include "tst_qabstractslider.moc"
diff --git a/tests/auto/widgets/widgets/qcalendarwidget/qcalendarwidget.pro b/tests/auto/widgets/widgets/qcalendarwidget/qcalendarwidget.pro
index 127d78596a..f16110cbd1 100644
--- a/tests/auto/widgets/widgets/qcalendarwidget/qcalendarwidget.pro
+++ b/tests/auto/widgets/widgets/qcalendarwidget/qcalendarwidget.pro
@@ -2,6 +2,3 @@ CONFIG += testcase
TARGET = tst_qcalendarwidget
QT += widgets testlib
SOURCES += tst_qcalendarwidget.cpp
-
-# QTBUG-23615 - unstable test
-linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test
diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
index 4f95f80525..4857900dc8 100644
--- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
+++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp
@@ -175,6 +175,8 @@ void tst_QCalendarWidget::buttonClickCheck()
QSize size = object.sizeHint();
object.setGeometry(0,0,size.width(), size.height());
object.show();
+ QTest::qWaitForWindowShown(&object);
+ object.activateWindow();
QDate selectedDate(2005, 1, 1);
//click on the month buttons
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 0fe93995a1..f9eb8b6159 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -1335,7 +1335,7 @@ void tst_QComboBox::textpixmapdata()
for (int i = 0; i<text.count(); ++i) {
QIcon icon = testWidget->itemIcon(i);
- QVERIFY(icon.serialNumber() == icons.at(i).serialNumber());
+ QCOMPARE(icon.cacheKey(), icons.at(i).cacheKey());
QPixmap original = icons.at(i).pixmap(1024);
QPixmap pixmap = icon.pixmap(1024);
QVERIFY(pixmap.toImage() == original.toImage());
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 0f07546559..c6a039cb37 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -1435,6 +1435,11 @@ void MoveSeparator::apply(QMainWindow *mw) const
}
QVERIFY(!path.isEmpty());
+ // For QTBUG-15689:
+ // Following commands is used to simulate user move action. A better way should
+ // use QMainWindowLayout::startSeparatorMove/separatorMove/endSeparatorMove,
+ // but then we will need real start/end position coordinates.
+ l->layoutState.dockAreaLayout.fallbackToSizeHints = false;
l->layoutState.dockAreaLayout.separatorMove(path, QPoint(0, 0), QPoint(delta, delta));
}
#endif
diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
index 4fffd74491..473c5e05ec 100644
--- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
+++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp
@@ -562,9 +562,6 @@ void tst_QMenu::tearOff()
QTest::mouseClick(menu, Qt::LeftButton, 0, QPoint(3, 3), 10);
QTest::qWait(100);
-#ifndef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-22565", Abort);
-#endif
QVERIFY(menu->isTearOffMenuVisible());
QPointer<QMenu> torn = 0;
foreach (QWidget *w, QApplication::allWidgets()) {
@@ -783,9 +780,6 @@ void tst_QMenu::task258920_mouseBorder()
#ifdef Q_OS_WINCE_WM
QSKIP("Mouse move related signals for Windows Mobile unavailable");
#endif
- // ### fixme: Check platforms
- QSKIP("QTBUG-20753 QCursor::setPos() / QTest::mouseMove() doesn't work on qpa");
-
Menu258920 menu;
// For styles which inherit from QWindowsStyle, styleHint(QStyle::SH_Menu_MouseTracking) is true.
menu.setMouseTracking(true);
diff --git a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
index a3cdd38e56..c80a946366 100644
--- a/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
+++ b/tests/benchmarks/corelib/kernel/qmetatype/tst_qmetatype.cpp
@@ -77,6 +77,9 @@ private slots:
void constructCoreTypeCopy_data();
void constructCoreTypeCopy();
+ void constructCustomType_data();
+ void constructCustomType();
+
void constructInPlace_data();
void constructInPlace();
void constructInPlaceCopy_data();
@@ -309,6 +312,24 @@ void tst_QMetaType::constructCoreTypeCopy()
}
}
+void tst_QMetaType::constructCustomType_data()
+{
+ QTest::addColumn<int>("typeId");
+
+ QTest::newRow("BigClass") << qMetaTypeId<BigClass>();
+}
+
+void tst_QMetaType::constructCustomType()
+{
+ QFETCH(int, typeId);
+ QBENCHMARK {
+ for (int i = 0; i < 100000; ++i) {
+ void *data = QMetaType::create(typeId, (void *)0);
+ QMetaType::destroy(typeId, data);
+ }
+ }
+}
+
void tst_QMetaType::constructInPlace_data()
{
constructCoreType_data();
diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/main.cpp
index 7f2e7b68ca..ab1c406708 100644
--- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp
+++ b/tests/benchmarks/corelib/tools/containers-associative/main.cpp
@@ -72,8 +72,8 @@ void tst_associative_containers::insert_data()
const QByteArray sizeString = QByteArray::number(size);
- QTest::newRow(("hash--" + sizeString).constData()) << true << size;
- QTest::newRow(("map--" + sizeString).constData()) << false << size;
+ QTest::newRow(QByteArray("hash--" + sizeString).constData()) << true << size;
+ QTest::newRow(QByteArray("map--" + sizeString).constData()) << false << size;
}
}
@@ -104,8 +104,8 @@ void tst_associative_containers::lookup_data()
const QByteArray sizeString = QByteArray::number(size);
- QTest::newRow(("hash--" + sizeString).constData()) << true << size;
- QTest::newRow(("map--" + sizeString).constData()) << false << size;
+ QTest::newRow(QByteArray("hash--" + sizeString).constData()) << true << size;
+ QTest::newRow(QByteArray("map--" + sizeString).constData()) << false << size;
}
}
diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
index e42a40b110..43eadb6633 100644
--- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
+++ b/tests/benchmarks/corelib/tools/containers-sequential/main.cpp
@@ -176,8 +176,8 @@ void tst_vector_vs_std::insert_int_data()
for (int size = 10; size < 20000; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
- QTest::newRow(("std::vector-int--" + sizeString).constData()) << true << size;
- QTest::newRow(("QVector-int--" + sizeString).constData()) << false << size;
+ QTest::newRow(QByteArray("std::vector-int--" + sizeString).constData()) << true << size;
+ QTest::newRow(QByteArray("QVector-int--" + sizeString).constData()) << false << size;
}
}
@@ -199,8 +199,8 @@ void tst_vector_vs_std::insert_Large_data()
for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
- QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
- QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
+ QTest::newRow(QByteArray("std::vector-Large--" + sizeString).constData()) << true << size;
+ QTest::newRow(QByteArray("QVector-Large--" + sizeString).constData()) << false << size;
}
}
@@ -222,8 +222,8 @@ void tst_vector_vs_std::lookup_int_data()
for (int size = 10; size < 20000; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
- QTest::newRow(("std::vector-int--" + sizeString).constData()) << true << size;
- QTest::newRow(("QVector-int--" + sizeString).constData()) << false << size;
+ QTest::newRow(QByteArray("std::vector-int--" + sizeString).constData()) << true << size;
+ QTest::newRow(QByteArray("QVector-int--" + sizeString).constData()) << false << size;
}
}
@@ -245,8 +245,8 @@ void tst_vector_vs_std::lookup_Large_data()
for (int size = 10; size < LARGE_MAX_SIZE; size += 100) {
const QByteArray sizeString = QByteArray::number(size);
- QTest::newRow(("std::vector-Large--" + sizeString).constData()) << true << size;
- QTest::newRow(("QVector-Large--" + sizeString).constData()) << false << size;
+ QTest::newRow(QByteArray("std::vector-Large--" + sizeString).constData()) << true << size;
+ QTest::newRow(QByteArray("QVector-Large--" + sizeString).constData()) << false << size;
}
}
diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/main.cpp
index 18138cbd47..67396ffd57 100644
--- a/tests/benchmarks/corelib/tools/qhash/main.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/main.cpp
@@ -54,72 +54,91 @@ class tst_QHash : public QObject
Q_OBJECT
private slots:
+ void initTestCase();
void qhash_qt4_data() { data(); }
void qhash_qt4();
- void qhash_faster_data() { data(); }
- void qhash_faster();
void javaString_data() { data(); }
void javaString();
private:
void data();
+
+ QStringList smallFilePaths;
+ QStringList uuids;
+ QStringList dict;
+ QStringList numbers;
};
///////////////////// QHash /////////////////////
-void tst_QHash::data()
-{
- QTest::addColumn<QStringList>("items");
- static QStringList smallFilePaths;
-
- {
- // small list of file paths
- if (smallFilePaths.isEmpty()) {
- QFile smallPathsData("paths_small_data.txt");
- QVERIFY(smallPathsData.open(QIODevice::ReadOnly));
- smallFilePaths = QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n'));
- Q_ASSERT(!smallFilePaths.isEmpty());
- }
+#include <QDebug>
- QTest::newRow("paths-small") << smallFilePaths;
- }
-
- {
- // list of UUIDs
- static QStringList uuids;
- if (uuids.isEmpty()) {
- // guaranteed to be completely random, generated by http://xkcd.com/221/
- QUuid ns = QUuid("{f43d2ef3-2fe9-4563-a6f5-5a0100c2d699}");
- uuids.reserve(smallFilePaths.size());
-
- foreach (const QString &path, smallFilePaths)
- uuids.append(QUuid::createUuidV5(ns, path).toString());
+void tst_QHash::initTestCase()
+{
+ // small list of file paths
+ QFile smallPathsData("paths_small_data.txt");
+ QVERIFY(smallPathsData.open(QIODevice::ReadOnly));
+ smallFilePaths = QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n'));
+ QVERIFY(!smallFilePaths.isEmpty());
+
+ // list of UUIDs
+ // guaranteed to be completely random, generated by http://xkcd.com/221/
+ QUuid ns = QUuid("{f43d2ef3-2fe9-4563-a6f5-5a0100c2d699}");
+ uuids.reserve(smallFilePaths.size());
+
+ foreach (const QString &path, smallFilePaths)
+ uuids.append(QUuid::createUuidV5(ns, path).toString());
+
+
+ // lots of strings with alphabetical characters, vaguely reminiscent of
+ // a dictionary.
+ //
+ // this programatically generates a series like:
+ // AAAAAA
+ // AAAAAB
+ // AAAAAC
+ // ...
+ // AAAAAZ
+ // AAAABZ
+ // ...
+ // AAAAZZ
+ // AAABZZ
+ QByteArray id("AAAAAAA");
+
+ if (dict.isEmpty()) {
+ for (int i = id.length() - 1; i > 0;) {
+ dict.append(id);
+ char c = id.at(i);
+ id[i] = ++c;
+
+ if (c == 'Z') {
+ // wrap to next digit
+ i--;
+ id[i] = 'A';
+ }
}
-
- QTest::newRow("uuids-list") << uuids;
}
+ // string versions of numbers.
+ for (int i = 5000000; i < 5005001; ++i)
+ numbers.append(QString::number(i));
}
-void tst_QHash::qhash_qt4()
+void tst_QHash::data()
{
- QFETCH(QStringList, items);
- QStringList realitems = items; // for copy/paste ease between benchmarks
- QHash<QString, int> hash;
-
- QBENCHMARK {
- for (int i = 0, n = realitems.size(); i != n; ++i) {
- hash[realitems.at(i)] = i;
- }
- }
+ QTest::addColumn<QStringList>("items");
+ QTest::newRow("paths-small") << smallFilePaths;
+ QTest::newRow("uuids-list") << uuids;
+ QTest::newRow("dictionary") << dict;
+ QTest::newRow("numbers") << numbers;
}
-void tst_QHash::qhash_faster()
+void tst_QHash::qhash_qt4()
{
QFETCH(QStringList, items);
- QHash<String, int> hash;
+ QHash<Qt4String, int> hash;
- QList<String> realitems;
+ QList<Qt4String> realitems;
foreach (const QString &s, items)
realitems.append(s);
diff --git a/tests/benchmarks/corelib/tools/qhash/main.h b/tests/benchmarks/corelib/tools/qhash/main.h
index c4cf94e190..a865eaf7a6 100644
--- a/tests/benchmarks/corelib/tools/qhash/main.h
+++ b/tests/benchmarks/corelib/tools/qhash/main.h
@@ -41,14 +41,14 @@
#include <QString>
-struct String : QString
+struct Qt4String : QString
{
- String() {}
- String(const QString &s) : QString(s) {}
+ Qt4String() {}
+ Qt4String(const QString &s) : QString(s) {}
};
QT_BEGIN_NAMESPACE
-uint qHash(const String &);
+uint qHash(const Qt4String &);
QT_END_NAMESPACE
diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
index 162c604a35..75d99f96f8 100644
--- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp
+++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp
@@ -41,49 +41,19 @@
#include "main.h"
-static void doHash(const unsigned short *p, uint &h)
-{
-#if 1
- // Copied from static uint hash(const QChar *p, int n).
- // Possibly not the cheapest way.
- h = (h << 4) + (*p++);
- h ^= (h & 0xf0000000) >> 23;
- h &= 0x0fffffff;
-
- h = (h << 4) + (*p++);
- h ^= (h & 0xf0000000) >> 23;
- h &= 0x0fffffff;
-
- h = (h << 4) + (*p++);
- h ^= (h & 0xf0000000) >> 23;
- h &= 0x0fffffff;
-
- h = (h << 4) + (*p++);
- h ^= (h & 0xf0000000) >> 23;
- h &= 0x0fffffff;
-#else
- // Faster, but probably less spread.
- h ^= *(unsigned int *)p;
-#endif
-}
-
QT_BEGIN_NAMESPACE
-uint qHash(const String &str)
+uint qHash(const Qt4String &str)
{
- const unsigned short *p = (unsigned short *)str.constData();
- const int s = str.size();
- switch (s) {
- case 0: return 0;
- case 1: return *p;
- case 2: return *(unsigned int *)p;
- case 3: return (*(unsigned int *)p) ^ *(p + 2);
- //case 3: return (*p << 11) + (*(p + 1) << 22) + *(p + 2);
- }
+ int n = str.length();
+ const QChar *p = str.unicode();
uint h = 0;
- doHash(p, h);
- doHash(p + s / 2 - 2, h);
- doHash(p + s - 4, h);
+
+ while (n--) {
+ h = (h << 4) + (*p++).unicode();
+ h ^= (h & 0xf0000000) >> 23;
+ h &= 0x0fffffff;
+ }
return h;
}
diff --git a/tests/benchmarks/dbus/qdbustype/main.cpp b/tests/benchmarks/dbus/qdbustype/main.cpp
index 0e0ce358bb..b0f6988425 100644
--- a/tests/benchmarks/dbus/qdbustype/main.cpp
+++ b/tests/benchmarks/dbus/qdbustype/main.cpp
@@ -56,7 +56,7 @@ private Q_SLOTS:
static inline void benchmarkAddRow(const char *name, const char *data)
{
- QTest::newRow(QByteArray("native-") + name) << data << true;
+ QTest::newRow(QByteArray(QByteArray("native-") + name)) << data << true;
QTest::newRow(name) << data << false;
}
diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
index 1ebdf2e0bb..3ce3d5c2c1 100644
--- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
+++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.cpp
@@ -41,7 +41,7 @@
#include "themeevent.h"
-ThemeEvent::ThemeEvent( QString newTheme, Type type) : QEvent(type),
+ThemeEvent::ThemeEvent( const QString &newTheme, Type type) : QEvent(type),
m_theme(newTheme)
{
diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
index c98f90da55..3603b5966f 100644
--- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
+++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/themeevent.h
@@ -50,7 +50,7 @@ static QEvent::Type ThemeEventType = (QEvent::Type) 1010;
class ThemeEvent : public QEvent
{
public:
- ThemeEvent(QString newTheme, QEvent::Type type = ThemeEventType );
+ explicit ThemeEvent(const QString &newTheme, QEvent::Type type = ThemeEventType );
~ThemeEvent();
public:
diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
index fcddf5ed90..45acd41749 100644
--- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
+++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp
@@ -153,9 +153,9 @@ void tst_qstylesheetstyle::grid_data()
QTest::addColumn<int>("N");
for (int n = 5; n <= 25; n += 5) {
const QByteArray nString = QByteArray::number(n*n);
- QTest::newRow(("simple--" + nString).constData()) << false << false << n;
- QTest::newRow(("events--" + nString).constData()) << true << false << n;
- QTest::newRow(("show--" + nString).constData()) << true << true << n;
+ QTest::newRow(QByteArray("simple--" + nString).constData()) << false << false << n;
+ QTest::newRow(QByteArray("events--" + nString).constData()) << true << false << n;
+ QTest::newRow(QByteArray("show--" + nString).constData()) << true << true << n;
}
}
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
index fe9efa55b7..16f9625eba 100644
--- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -530,7 +530,7 @@ void tst_qnetworkreply::downloadPerformance()
// unlike the above function, this one tries to send as fast as possible
// and measures how fast it was.
TimedSender sender(5000);
- QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(sender.serverPort()) + "/?bare=1");
+ QNetworkRequest request(QUrl(QStringLiteral("debugpipe://127.0.0.1:") + QString::number(sender.serverPort()) + QStringLiteral("/?bare=1")));
QNetworkReplyPtr reply = manager.get(request);
DataReader reader(reply, false);
@@ -552,7 +552,7 @@ void tst_qnetworkreply::uploadPerformance()
DataGenerator generator;
- QNetworkRequest request("debugpipe://127.0.0.1:" + QString::number(reader.serverPort()) + "/?bare=1");
+ QNetworkRequest request(QUrl(QStringLiteral("debugpipe://127.0.0.1:") + QString::number(reader.serverPort()) + QStringLiteral("/?bare=1")));
QNetworkReplyPtr reply = manager.put(request, &generator);
generator.start();
connect(&reader, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
diff --git a/tests/manual/qcursor/allcursors/allcursors.pro b/tests/manual/qcursor/allcursors/allcursors.pro
index 8e7da30752..b9f6a0c98d 100644
--- a/tests/manual/qcursor/allcursors/allcursors.pro
+++ b/tests/manual/qcursor/allcursors/allcursors.pro
@@ -6,7 +6,7 @@
TARGET = tst_allcursors
TEMPLATE = app
-
+QT = core gui widgets
SOURCES += main.cpp\
mainwindow.cpp
diff --git a/tests/manual/qcursor/allcursors/main.cpp b/tests/manual/qcursor/allcursors/main.cpp
index 8872481e88..fab9a7d3d7 100644
--- a/tests/manual/qcursor/allcursors/main.cpp
+++ b/tests/manual/qcursor/allcursors/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/tests/manual/qcursor/allcursors/mainwindow.h b/tests/manual/qcursor/allcursors/mainwindow.h
index 938f744862..5908d26e17 100644
--- a/tests/manual/qcursor/allcursors/mainwindow.h
+++ b/tests/manual/qcursor/allcursors/mainwindow.h
@@ -42,7 +42,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtGui/QMainWindow>
+#include <QtWidgets/QMainWindow>
class QTimer;
diff --git a/tests/manual/qcursor/grab_override/grab_override.pro b/tests/manual/qcursor/grab_override/grab_override.pro
index c0f69be5ad..d84e2ee2b8 100644
--- a/tests/manual/qcursor/grab_override/grab_override.pro
+++ b/tests/manual/qcursor/grab_override/grab_override.pro
@@ -6,7 +6,7 @@
TARGET = t_cursors
TEMPLATE = app
-
+QT = core gui widgets
SOURCES += main.cpp\
mainwindow.cpp
diff --git a/tests/manual/qcursor/grab_override/main.cpp b/tests/manual/qcursor/grab_override/main.cpp
index 8872481e88..fab9a7d3d7 100644
--- a/tests/manual/qcursor/grab_override/main.cpp
+++ b/tests/manual/qcursor/grab_override/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
+#include <QtWidgets/QApplication>
#include "mainwindow.h"
int main(int argc, char *argv[])
diff --git a/tests/manual/qcursor/grab_override/mainwindow.h b/tests/manual/qcursor/grab_override/mainwindow.h
index c231e9583d..3eb7e26fd7 100644
--- a/tests/manual/qcursor/grab_override/mainwindow.h
+++ b/tests/manual/qcursor/grab_override/mainwindow.h
@@ -42,7 +42,7 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtGui/QMainWindow>
+#include <QtWidgets/QMainWindow>
class QTimer;