From 77833b90c8d93b86904b744f7be2926ba377ca6e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 23 Jul 2013 15:42:55 +0200 Subject: Fix crashes when invoking toVariant() on empty QJsonValue objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I51cd114e862c6fad564484e990348f324ad56ab9 Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/json/tst_qtjson.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index bdf8c86442..94e6e1129e 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -1062,6 +1062,8 @@ void tst_QtJson::fromVariantMap() void tst_QtJson::toVariantMap() { + QCOMPARE(QMetaType::Type(QJsonValue(QJsonObject()).toVariant().type()), QMetaType::QVariantMap); // QTBUG-32524 + QJsonObject object; QVariantMap map = object.toVariantMap(); QVERIFY(map.isEmpty()); @@ -1091,6 +1093,8 @@ void tst_QtJson::toVariantMap() void tst_QtJson::toVariantList() { + QCOMPARE(QMetaType::Type(QJsonValue(QJsonArray()).toVariant().type()), QMetaType::QVariantList); // QTBUG-32524 + QJsonArray array; QVariantList list = array.toVariantList(); QVERIFY(list.isEmpty()); -- cgit v1.2.3 From 651a03b0dd9a5fe54e78648414327f9ba7bef4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Wed, 24 Jul 2013 14:26:27 +0300 Subject: Fix for tst_qundostack autotest in shadow build Added full path to src dir for testdata. Task-number: QTBUG-32536 Change-Id: I5ef215d451a6407c277d2c98f21ffc35a8657e28 Reviewed-by: Friedemann Kleint --- tests/auto/widgets/util/qundostack/tst_qundostack.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp index 4556816655..6e6c72db5e 100644 --- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp +++ b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp @@ -2974,10 +2974,14 @@ void tst_QUndoStack::commandTextFormat() if (QProcess::execute(binDir + "/lrelease -version") != 0) QSKIP("lrelease is missing or broken"); - QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/qundostack.ts")); + const QString tsFile = QFINDTESTDATA("testdata/qundostack.ts"); + QVERIFY(!tsFile.isEmpty()); + QVERIFY(!QProcess::execute(binDir + "/lrelease " + tsFile)); QTranslator translator; - QVERIFY(translator.load("testdata/qundostack.qm")); + const QString qmFile = QFINDTESTDATA("testdata/qundostack.qm"); + QVERIFY(!qmFile.isEmpty()); + QVERIFY(translator.load(qmFile)); qApp->installTranslator(&translator); QUndoStack stack; -- cgit v1.2.3 From 34d2abe3093a71ca098dd35bd6ac0aa78fe42249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Wed, 24 Jul 2013 14:51:05 +0300 Subject: Fix for tst_qundogroup autotest in shadow build Added full path to src dir for testdata. Task-number: QTBUG-32535 Change-Id: I38e96216e9a016869151adf0ae995e068b8b5354 Reviewed-by: Friedemann Kleint Reviewed-by: Sergio Ahumada --- tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp index ddab98ebc6..7e0e942be5 100644 --- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp @@ -615,10 +615,15 @@ void tst_QUndoGroup::commandTextFormat() if (QProcess::execute(binDir + "/lrelease -version") != 0) QSKIP("lrelease is missing or broken"); - QVERIFY(!QProcess::execute(binDir + "/lrelease testdata/qundogroup.ts")); + const QString tsFile = QFINDTESTDATA("testdata/qundogroup.ts"); + QVERIFY(!tsFile.isEmpty()); + QVERIFY(!QProcess::execute(binDir + "/lrelease " + tsFile)); QTranslator translator; - QVERIFY(translator.load("testdata/qundogroup.qm")); + + const QString qmFile = QFINDTESTDATA("testdata/qundogroup.qm"); + QVERIFY(!qmFile.isEmpty()); + QVERIFY(translator.load(qmFile)); qApp->installTranslator(&translator); QUndoGroup group; -- cgit v1.2.3 From 06b6061b43a866d100c922f918c3b118a14dfaee Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 26 Jul 2013 14:22:58 +0200 Subject: test: Remove insignificant mark from tst_qfilesystemmodel Tests are passing nowaways on OS X. Task-number: QTBUG-27890 Change-Id: I6a0a881ece844ef931cb8af51b58d33c40be4d2c Reviewed-by: Friedemann Kleint --- tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro index e77364c3f0..fc9ec46e11 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro @@ -7,5 +7,3 @@ QT += core-private gui testlib SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel - -mac:CONFIG+=insignificant_test # QTBUG-27890 -- cgit v1.2.3 From 456a4740cced1eb84d73d0e10869764e79e303f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Fri, 26 Jul 2013 10:08:27 +0300 Subject: Mark tst_exceptionsafety as insignificant We're rolling back exception safety support Task-number: QTBUG-32642 Change-Id: I25f20b554a93f25d00cca19b3e308d6cc8fe85e2 Reviewed-by: Thiago Macieira --- tests/auto/other/exceptionsafety/exceptionsafety.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/other/exceptionsafety/exceptionsafety.pro b/tests/auto/other/exceptionsafety/exceptionsafety.pro index 558c1d6636..3e9c996cd8 100644 --- a/tests/auto/other/exceptionsafety/exceptionsafety.pro +++ b/tests/auto/other/exceptionsafety/exceptionsafety.pro @@ -2,5 +2,5 @@ CONFIG += testcase TARGET = tst_exceptionsafety SOURCES += tst_exceptionsafety.cpp QT = core testlib -CONFIG += parallel_test +CONFIG += parallel_test insignificant_test DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From af96c6fed931564c95037539f07e9c8e33c69529 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 25 Jul 2013 12:05:29 -0400 Subject: QHttpMultiPart: fix data corruption in readData method When readData() is called repeatedly, we need to keep track which part of the multipart message we are currently reading from. Hereby we also need to take the boundary size into account, and not only the size of the multipart; otherwise we would skip a not completely read part. This would then later lead to advancing the read pointer by negative indexes and data loss. Task-number: QTBUG-32534 Change-Id: Ibb6dff16adaf4ea67181d23d1d0c8459e33a0ed0 Reviewed-by: Jonathan Liu Reviewed-by: Shane Kearns --- .../access/qnetworkreply/tst_qnetworkreply.cpp | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'tests') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 5c04ac8a01..ce8293edbc 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -221,6 +221,7 @@ private Q_SLOTS: void postToHttpSynchronous(); void postToHttpMultipart_data(); void postToHttpMultipart(); + void multipartSkipIndices(); // QTBUG-32534 #ifndef QT_NO_SSL void putToHttps_data(); void putToHttps(); @@ -2382,6 +2383,49 @@ void tst_QNetworkReply::postToHttpMultipart() QCOMPARE(replyData, expectedReplyData); } +void tst_QNetworkReply::multipartSkipIndices() // QTBUG-32534 +{ + QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::MixedType); + QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/multipart.cgi"); + QNetworkRequest request(url); + QList parts; + parts << QByteArray(56083, 'X') << QByteArray(468, 'X') << QByteArray(24952, 'X'); + + QHttpPart part1; + part1.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"field1\"; filename=\"aaaa.bin\""); + part1.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream"); + part1.setBody(parts.at(0)); + multiPart->append(part1); + + QHttpPart part2; + part2.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"field2\"; filename=\"bbbb.txt\""); + part2.setHeader(QNetworkRequest::ContentTypeHeader, "text/plain"); + part2.setBody(parts.at(1)); + multiPart->append(part2); + + QHttpPart part3; + part3.setHeader(QNetworkRequest::ContentDispositionHeader, "form-data; name=\"text-3\"; filename=\"cccc.txt\""); + part3.setHeader(QNetworkRequest::ContentTypeHeader, "text/plain"); + part3.setBody(parts.at(2)); + multiPart->append(part3); + + QNetworkReplyPtr reply; + RUN_REQUEST(runMultipartRequest(request, reply, multiPart, "POST")); + + QCOMPARE(reply->error(), QNetworkReply::NoError); + + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); // 200 Ok + QByteArray line; + int partIndex = 0; + while ((line = reply->readLine()) != QByteArray("")) { + if (line.startsWith("content:")) { + // before, the 3rd part would return garbled output at the end + QCOMPARE("content: " + parts[partIndex++] + "\n", line); + } + } + multiPart->deleteLater(); +} + void tst_QNetworkReply::putToHttpMultipart_data() { postToHttpMultipart_data(); -- cgit v1.2.3 From cf3e435299ef2705fb217279bb5e93847cfc7d8c Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Fri, 26 Jul 2013 17:51:42 +0200 Subject: Cocoa: Make sure that resizeEvent is invoked after calling resize The QWindow::resizeEvent documentation states that resizeEvent is invoked after the windowing system has acknowledged a setGeometry() or resize() request. The Cocoa plugin however did set the platform window geometry immediately so that the qnsview's updateGeometry returned too early. Task-number: QTBUG-32706 Change-Id: I1f359ab368833d174ab6740f4467b0848c290f13 Reviewed-by: Friedemann Kleint Reviewed-by: Gunnar Sletta --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index b4208949b0..7ad7880330 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -59,6 +59,7 @@ class tst_QWindow: public QObject private slots: void eventOrderOnShow(); + void resizeEventAfterResize(); void mapGlobal(); void positioning(); void isExposed(); @@ -168,6 +169,25 @@ void tst_QWindow::eventOrderOnShow() QVERIFY(window.eventIndex(QEvent::Resize) < window.eventIndex(QEvent::Expose)); } +void tst_QWindow::resizeEventAfterResize() +{ + // Some platforms enforce minimum widths for windows, which can cause extra resize + // events, so set the width to suitably large value to avoid those. + QRect geometry(QGuiApplication::primaryScreen()->availableGeometry().topLeft() + QPoint(20, 20), QSize(300, 40)); + + Window window; + window.setGeometry(geometry); + window.show(); + + QTRY_COMPARE(window.received(QEvent::Resize), 1); + + // QTBUG-32706 + // Make sure we get a resizeEvent after calling resize + window.resize(400, 100); + + QTRY_COMPARE(window.received(QEvent::Resize), 2); +} + void tst_QWindow::positioning() { if (!QGuiApplicationPrivate::platformIntegration()->hasCapability( -- cgit v1.2.3 From c3f485c5250a503832e767e1fe5e40595126f6c5 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 25 Jul 2013 17:06:16 +0200 Subject: Expose invokables that are not slots in the xml Without it the invocations were working but were not listed on introspection Change-Id: Ie62f7dc3577f52b6888ddebf0392fdf51f2845d5 Reviewed-by: Thiago Macieira --- tests/auto/dbus/dbus.pro | 1 + .../dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro | 5 + .../qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp | 125 +++++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro create mode 100644 tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp (limited to 'tests') diff --git a/tests/auto/dbus/dbus.pro b/tests/auto/dbus/dbus.pro index cd845d7043..52ee154008 100644 --- a/tests/auto/dbus/dbus.pro +++ b/tests/auto/dbus/dbus.pro @@ -17,6 +17,7 @@ SUBDIRS=\ qdbustype \ qdbusthreading \ qdbusxmlparser \ + qdbusxmlgenerator \ !contains(QT_CONFIG,private_tests): SUBDIRS -= \ qdbusmarshall \ diff --git a/tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro b/tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro new file mode 100644 index 0000000000..5bf8523c42 --- /dev/null +++ b/tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +TARGET = tst_qdbusxmlgenerator +QT = core dbus testlib xml +SOURCES += tst_qdbusxmlgenerator.cpp +DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp b/tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp new file mode 100644 index 0000000000..1ff613b5ca --- /dev/null +++ b/tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include +#include +#include + +static const QString serviceName = "org.example.qdbus"; +static const QString interfaceName = serviceName; + +Q_DECLARE_METATYPE(QDBusConnection::RegisterOption); + +class DBusXmlGenetarorObject : public QObject +{ + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.example.qdbus") +public: + Q_INVOKABLE void nonScriptableInvokable() {} + Q_SCRIPTABLE Q_INVOKABLE void scriptableInvokable() {} +}; + +class tst_QDBusXmlGenerator : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase(); + void introspect_data(); + void introspect(); +}; + +void tst_QDBusXmlGenerator::initTestCase() +{ + QDBusConnection::sessionBus().registerService(serviceName); +} + +void tst_QDBusXmlGenerator::introspect_data() +{ + QTest::addColumn("methodName"); + QTest::addColumn("flags"); + + QTest::newRow("scriptableInvokable") << "scriptableInvokable" << QDBusConnection::ExportScriptableInvokables; + QTest::newRow("nonScriptableInvokable") << "nonScriptableInvokable" << QDBusConnection::ExportNonScriptableInvokables; +} + +void tst_QDBusXmlGenerator::introspect() +{ + QFETCH(QString, methodName); + QFETCH(QDBusConnection::RegisterOption, flags); + DBusXmlGenetarorObject obj; + + QDBusConnection::sessionBus().registerObject("/" + methodName, &obj, flags ); + + QDBusInterface dif(serviceName, "/" + methodName, "", QDBusConnection::sessionBus()); + QDBusReply reply = dif.call("Introspect"); + + bool found = false; + QDomDocument d; + d.setContent(reply.value(), false); + QDomNode n = d.documentElement().firstChild(); + while (!found && !n.isNull()) { + QDomElement e = n.toElement(); // try to convert the node to an element. + if (!e.isNull()) { + if (e.tagName() == "interface" && e.attribute("name") == interfaceName ) { + QDomNode n2 = e.firstChild(); + while (!n2.isNull()) { + QDomElement e2 = n2.toElement(); // try to convert the node to an element. + if (!e2.isNull()) { + if (e2.tagName() == "method") { + found = e2.attribute("name") == methodName; + } + } + n2 = n2.nextSibling(); + } + } + } + n = n.nextSibling(); + } + + QVERIFY(found); +} + +QTEST_MAIN(tst_QDBusXmlGenerator) + +#include "tst_qdbusxmlgenerator.moc" + -- cgit v1.2.3 From e440b35bb34023998f62fd426987c23bd5983f46 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 31 Jul 2013 10:37:31 -0400 Subject: Update Info.plist templates to use the current standard plist format. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the version number to 1.0, and use the public doctype. Change-Id: I9b071c80c410c31c38813c4447edd7b186226fab Reviewed-by: Jake Petroules Reviewed-by: Tor Arne Vestbø --- tests/auto/other/macplist/tst_macplist.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'tests') diff --git a/tests/auto/other/macplist/tst_macplist.cpp b/tests/auto/other/macplist/tst_macplist.cpp index 5ce72bac53..1f0a572ce8 100644 --- a/tests/auto/other/macplist/tst_macplist.cpp +++ b/tests/auto/other/macplist/tst_macplist.cpp @@ -65,14 +65,14 @@ void tst_MacPlist::test_plist_data() QTest::newRow("control") << QString::fromLatin1( "" -"\n" -"\n" +"\n" +"\n" "\n" " CFBundleIconFile\n" " \n" " CFBundlePackageType\n" " APPL\n" -" CFBundleGetInfoString\n" +" CFBundleGetInfoString\n" " Created by Qt/QMake\n" " CFBundleExecutable\n" " app\n" @@ -83,14 +83,14 @@ void tst_MacPlist::test_plist_data() QTest::newRow("LSUIElement-as-string") << QString::fromLatin1( "" -"\n" -"\n" +"\n" +"\n" "\n" " CFBundleIconFile\n" " \n" " CFBundlePackageType\n" " APPL\n" -" CFBundleGetInfoString\n" +" CFBundleGetInfoString\n" " Created by Qt/QMake\n" " CFBundleExecutable\n" " app\n" @@ -103,14 +103,14 @@ void tst_MacPlist::test_plist_data() QTest::newRow("LSUIElement-as-bool") << QString::fromLatin1( "" -"\n" -"\n" +"\n" +"\n" "\n" " CFBundleIconFile\n" " \n" " CFBundlePackageType\n" " APPL\n" -" CFBundleGetInfoString\n" +" CFBundleGetInfoString\n" " Created by Qt/QMake\n" " CFBundleExecutable\n" " app\n" @@ -123,14 +123,14 @@ void tst_MacPlist::test_plist_data() QTest::newRow("LSUIElement-as-int") << QString::fromLatin1( "" -"\n" -"\n" +"\n" +"\n" "\n" " CFBundleIconFile\n" " \n" " CFBundlePackageType\n" " APPL\n" -" CFBundleGetInfoString\n" +" CFBundleGetInfoString\n" " Created by Qt/QMake\n" " CFBundleExecutable\n" " app\n" @@ -143,14 +143,14 @@ void tst_MacPlist::test_plist_data() QTest::newRow("LSUIElement-as-garbage") << QString::fromLatin1( "" -"\n" -"\n" +"\n" +"\n" "\n" " CFBundleIconFile\n" " \n" " CFBundlePackageType\n" " APPL\n" -" CFBundleGetInfoString\n" +" CFBundleGetInfoString\n" " Created by Qt/QMake\n" " CFBundleExecutable\n" " app\n" -- cgit v1.2.3 From 672fcbe9c6586e909513c91f5b36ad9a83a0ef1c Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 28 Jul 2013 20:03:57 +0200 Subject: QMimeDatabase: Fix handling of duplicate mimetype definitions (2/2). 7721c3d27c6a fixed the case where two similar definitions are in the same directory. This commit fixes the case where two similar definitions are in different directories, both in the search path (GenericDataLocation). If the file extension gives us the same mimetype twice, there's no conflict, i.e. no reason to fallback to determination from contents. Change-Id: I72c56004b6d5e88964159e53ec160ce8b06c2264 Reviewed-by: Thiago Macieira --- .../corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index a90bfadd73..07d3c5c7b8 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -876,7 +876,10 @@ void tst_QMimeDatabase::installNewLocalMimeType() QDir().mkpath(destDir); const QString destFile = destDir + QLatin1String(yastFileName); QFile::remove(destFile); + const QString destQmlFile = destDir + QLatin1String(qmlAgainFileName); + QFile::remove(destQmlFile); QVERIFY(QFile::copy(m_yastMimeTypes, destFile)); + QVERIFY(QFile::copy(m_qmlAgainFileName, destQmlFile)); if (!runUpdateMimeDatabase(mimeDir)) { const QString skipWarning = QStringLiteral("shared-mime-info not found, skipping mime.cache test (") + QDir::toNativeSeparators(mimeDir) + QLatin1Char(')'); @@ -888,8 +891,17 @@ void tst_QMimeDatabase::installNewLocalMimeType() QVERIFY(db.mimeTypeForName(QLatin1String("text/x-suse-ymp")).isValid()); checkHasMimeType("text/x-suse-ymp"); - // Now test removing it again (note, this leaves a mostly-empty mime.cache file) + // Test that a double-definition of a mimetype doesn't lead to sniffing ("conflicting globs"). + const QString qmlTestFile = QFINDTESTDATA("test.qml"); + QVERIFY2(!qmlTestFile.isEmpty(), + qPrintable(QString::fromLatin1("Cannot find '%1' starting from '%2'"). + arg("test.qml", QDir::currentPath()))); + QCOMPARE(db.mimeTypeForFile(qmlTestFile).name(), + QString::fromLatin1("text/x-qml")); + + // Now test removing the local mimetypes again (note, this leaves a mostly-empty mime.cache file) QFile::remove(destFile); + QFile::remove(destQmlFile); if (!waitAndRunUpdateMimeDatabase(mimeDir)) QSKIP("shared-mime-info not found, skipping mime.cache test"); QCOMPARE(db.mimeTypeForFile(QLatin1String("foo.ymu"), QMimeDatabase::MatchExtension).name(), -- cgit v1.2.3 From 13d7823ef722f753b962315c285ba0941586a060 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sat, 3 Aug 2013 15:00:10 +0200 Subject: tests: Enable some itemmodels tests that don't depend on Qt Widgets Make qabstractproxymodel and qidentityproxymodel build and run even if -no-widgets is used since they don't depend on Qt Widgets. Change-Id: I48bc2f6a78812b1bf0083f76c6a4e106f4e38650 Reviewed-by: Stephen Kelly --- tests/auto/corelib/itemmodels/itemmodels.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro index 2f681c3330..e0bc2a8a4b 100644 --- a/tests/auto/corelib/itemmodels/itemmodels.pro +++ b/tests/auto/corelib/itemmodels/itemmodels.pro @@ -1,11 +1,11 @@ TEMPLATE=subdirs SUBDIRS = qabstractitemmodel \ - qstringlistmodel - -qtHaveModule(widgets): SUBDIRS += \ qabstractproxymodel \ qidentityproxymodel \ + qstringlistmodel \ + +qtHaveModule(widgets): SUBDIRS += \ qitemmodel \ qitemselectionmodel \ qsortfilterproxymodel \ -- cgit v1.2.3 From d66d912c530d53ae19a36df63db15d33a984bce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 5 Aug 2013 16:48:46 +0200 Subject: Fix tst_QCompleter::directoryModel() on OS X By not assuming that we have the '/Developer' directory at the root of the file system. 'Users' is less likely to be removed/deprecated. Change-Id: I659bdb67cfb1ed2f73bc643ba4afe1f1f89d5bc5 Reviewed-by: Gabriel de Dietrich --- tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index d7050033f3..0f7993540c 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -608,7 +608,7 @@ void tst_QCompleter::directoryModel_data() #elif defined (Q_OS_MAC) QTest::newRow("()") << "" << "" << "/" << "/"; QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; - QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; + QTest::newRow("(/u)") << "/u" << "" << "Users" << "/Users"; #else QTest::newRow("()") << "" << "" << "/" << "/"; #if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) -- cgit v1.2.3 From 12571cc095ce1d789f27f94bfc530efb32d9d1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 5 Aug 2013 17:09:10 +0200 Subject: Fix tst_QFile::caseSensitivity on OS X By not assuming that the file system is case insensitive. OSX supports both. Change-Id: I11a4ac4cdff97b97b183dd319757a42ae14bb52d Reviewed-by: Gabriel de Dietrich --- tests/auto/corelib/io/qfile/tst_qfile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index 42dca7fc66..2b029203e9 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -3255,11 +3255,14 @@ void tst_QFile::objectConstructors() void tst_QFile::caseSensitivity() { -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) +#if defined(Q_OS_WIN) const bool caseSensitive = false; +#elif defined(Q_OS_MAC) + const bool caseSensitive = pathconf(QDir::currentPath().toLatin1().constData(), _PC_CASE_SENSITIVE); #else const bool caseSensitive = true; #endif + QByteArray testData("a little test"); QString filename("File.txt"); { -- cgit v1.2.3 From 8fce4e97ba8479a24bff167ce72ed43223076905 Mon Sep 17 00:00:00 2001 From: Andreas Aardal Hanssen Date: Tue, 30 Jul 2013 18:08:10 +0200 Subject: Fix double transform for items ignoring parent transformations. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the topmost untransformable's scene transform, which includes the item's position and local transformation, was used to determine the item's anchoring position. This position was then passed on to be multiplied by the item's transform again. This works fine for toplevel untransformable items that don't have any transform set at all, but those who do would have their transforms applied twice - one to determine the anchoring position, and again to transform the item itself. Since only translation transformations can affect the first operation (the anchoring pos), this bug only applies to items that set ItemIgnoresTransformations and use a local transform that includes translation. Task-number: QTBUG-21618 Change-Id: I772d52d59dfd9f242d0140632a87e9c68dfe0ea1 Reviewed-by: Jan Arve Sæther --- .../qgraphicsitem/tst_qgraphicsitem.cpp | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 3e24257736..9353aa0eba 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -471,6 +471,7 @@ private slots: void QTBUG_16374_crashInDestructor(); void QTBUG_20699_focusScopeCrash(); void QTBUG_30990_rightClickSelection(); + void QTBUG_21618_untransformable_sceneTransform(); private: QList paintedItems; @@ -11496,5 +11497,65 @@ void tst_QGraphicsItem::QTBUG_30990_rightClickSelection() QVERIFY(!item2->isSelected()); } +void tst_QGraphicsItem::QTBUG_21618_untransformable_sceneTransform() +{ + QGraphicsScene scene(0, 0, 150, 150); + scene.addRect(-2, -2, 4, 4); + + QGraphicsItem *item1 = scene.addRect(0, 0, 100, 100, QPen(), Qt::red); + item1->setPos(50, 50); + item1->translate(50, 50); + item1->rotate(90); + QGraphicsItem *item2 = scene.addRect(0, 0, 100, 100, QPen(), Qt::green); + item2->setPos(50, 50); + item2->translate(50, 50); + item2->rotate(90); + item2->setFlags(QGraphicsItem::ItemIgnoresTransformations); + + QGraphicsRectItem *item1_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4)); + item1_topleft->setParentItem(item1); + item1_topleft->setBrush(Qt::black); + QGraphicsRectItem *item1_bottomright = new QGraphicsRectItem(QRectF(-2, -2, 4, 4)); + item1_bottomright->setParentItem(item1); + item1_bottomright->setPos(100, 100); + item1_bottomright->setBrush(Qt::yellow); + + QGraphicsRectItem *item2_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4)); + item2_topleft->setParentItem(item2); + item2_topleft->setBrush(Qt::black); + QGraphicsRectItem *item2_bottomright = new QGraphicsRectItem(QRectF(-2, -2, 4, 4)); + item2_bottomright->setParentItem(item2); + item2_bottomright->setPos(100, 100); + item2_bottomright->setBrush(Qt::yellow); + + QCOMPARE(item1->sceneTransform(), item2->sceneTransform()); + QCOMPARE(item1_topleft->sceneTransform(), item2_topleft->sceneTransform()); + QCOMPARE(item1_bottomright->sceneTransform(), item2_bottomright->sceneTransform()); + QCOMPARE(item1->deviceTransform(QTransform()), item2->deviceTransform(QTransform())); + QCOMPARE(item1->deviceTransform(QTransform()).map(QPointF()), QPointF(100, 100)); + QCOMPARE(item2->deviceTransform(QTransform()).map(QPointF()), QPointF(100, 100)); + QCOMPARE(item1->deviceTransform(QTransform()).map(QPointF(100, 100)), QPointF(0, 200)); + QCOMPARE(item2->deviceTransform(QTransform()).map(QPointF(100, 100)), QPointF(0, 200)); + QCOMPARE(item1_topleft->deviceTransform(QTransform()).map(QPointF()), QPointF(100, 100)); + QCOMPARE(item2_topleft->deviceTransform(QTransform()).map(QPointF()), QPointF(100, 100)); + QCOMPARE(item1_bottomright->deviceTransform(QTransform()).map(QPointF()), QPointF(0, 200)); + QCOMPARE(item2_bottomright->deviceTransform(QTransform()).map(QPointF()), QPointF(0, 200)); + + item2->setParentItem(item1); + + QCOMPARE(item2->deviceTransform(QTransform()).map(QPointF()), QPointF(100, 200)); + QCOMPARE(item2->deviceTransform(QTransform()).map(QPointF(100, 100)), QPointF(0, 300)); + QCOMPARE(item2_topleft->deviceTransform(QTransform()).map(QPointF()), QPointF(100, 200)); + QCOMPARE(item2_bottomright->deviceTransform(QTransform()).map(QPointF()), QPointF(0, 300)); + + QTransform tx = QTransform::fromTranslate(100, 0); + QCOMPARE(item1->deviceTransform(tx).map(QPointF()), QPointF(200, 100)); + QCOMPARE(item1->deviceTransform(tx).map(QPointF(100, 100)), QPointF(100, 200)); + QCOMPARE(item2->deviceTransform(tx).map(QPointF()), QPointF(200, 200)); + QCOMPARE(item2->deviceTransform(tx).map(QPointF(100, 100)), QPointF(100, 300)); + QCOMPARE(item2_topleft->deviceTransform(tx).map(QPointF()), QPointF(200, 200)); + QCOMPARE(item2_bottomright->deviceTransform(tx).map(QPointF()), QPointF(100, 300)); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" -- cgit v1.2.3 From 79d7fd924ee68ead7cdf5ac0e9784e54ccb7f57c Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 5 Aug 2013 14:59:51 +0200 Subject: tst_qfilesystemmodel: increased test's permitted runtime MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test has recently timed out a few times on OS X test runs, with no relevant changes to account for the timeout. Task-number: QTBUG-27890 Change-Id: Ia24f7812ed2a0b3eac51847a7dacbc9f225b48b8 Reviewed-by: Simo Fält Reviewed-by: Sergio Ahumada --- tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro index fc9ec46e11..d180054ca8 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro @@ -1,6 +1,7 @@ CONFIG += testcase -# This testcase can be slow on Windows and may interfere with other file system tests. +# This testcase can be slow on Windows and OS X, and may interfere with other file system tests. win32:testcase.timeout = 900 +macx:testcase.timeout = 900 QT += widgets widgets-private QT += core-private gui testlib -- cgit v1.2.3 From 08d3b0165ae49a9ca019b7074423606492856b70 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 6 Aug 2013 10:49:23 +0200 Subject: test: Mark tst_QRawFont::fromFont() as XFAIL Mark some tests as expected failures on OS X 10.8 - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=0, writingSystem=0) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=0, writingSystem=5) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=0, writingSystem=1) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=1, writingSystem=0) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=1, writingSystem=5) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=1, writingSystem=1) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=2, writingSystem=0) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=2, writingSystem=5) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=2, writingSystem=1) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=3, writingSystem=0) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=3, writingSystem=5) - tst_QRawFont::fromFont(testfont.ttf, hintingPreference=3, writingSystem=1) Task-number: QTBUG-32654 Change-Id: I46d64852ccb751824a2eff68513389baa52c1baf Reviewed-by: Frederik Gladhorn --- tests/auto/gui/text/qrawfont/tst_qrawfont.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp index ae6e450301..19f60baa29 100644 --- a/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/gui/text/qrawfont/tst_qrawfont.cpp @@ -675,6 +675,10 @@ void tst_QRawFont::fromFont() QFontDatabase fontDatabase; int id = fontDatabase.addApplicationFont(fileName); +#ifdef Q_OS_MACX + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) + QEXPECT_FAIL("", "See QTBUG-32654", Abort); +#endif QVERIFY(id >= 0); QFont font(familyName); -- cgit v1.2.3 From 9a061a0a2c6dcf2248653396f3c5ec867a2f8aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 17 Jul 2013 21:55:18 +0200 Subject: Remove unused member in QEventLoop auto-test Change-Id: Icd6a09402c3cf14286f4ba1f8f4c99ac483ec1a3 Reviewed-by: Gabriel de Dietrich Reviewed-by: Frederik Gladhorn --- tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index 25e5f03566..c696c6e21a 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -580,7 +580,7 @@ class JobObject : public QObject public: explicit JobObject(QEventLoop *loop, QObject *parent = 0) - : QObject(parent), loop(loop), locker(loop) + : QObject(parent), locker(loop) { } @@ -606,7 +606,6 @@ signals: void done(); private: - QEventLoop *loop; QEventLoopLocker locker; }; -- cgit v1.2.3 From 4ca4fb93f666820ab10fc0e17f54b2b777540779 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 6 Aug 2013 11:56:03 +0200 Subject: Expect fail broken font family from QFontDatabase on OS X 10.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I682d58350427975a692b523095c1c38e1891663f Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/text/qfont/tst_qfont.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index b8cce2671f..082bb94b60 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -667,6 +667,15 @@ void tst_QFont::defaultFamily_data() void tst_QFont::defaultFamily() { +#if defined(Q_OS_MAC) + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) { + QEXPECT_FAIL("serif", "See QTBUG-32834", Continue); + QEXPECT_FAIL("monospace", "See QTBUG-32834", Continue); + QEXPECT_FAIL("cursive", "See QTBUG-32834", Continue); + QEXPECT_FAIL("fantasy", "See QTBUG-32834", Continue); + } +#endif + QFETCH(QFont::StyleHint, styleHint); QFETCH(QStringList, acceptableFamilies); -- cgit v1.2.3 From bf7129af979412102e0dd4c23d9152dfb26fe7b1 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Mon, 5 Aug 2013 17:46:55 +0200 Subject: Fixed tst_qgl for fullscreen platforms Replaced show() with showNormal(). Change-Id: Ia6e7f34587090de5019f9ca9cb82a44e7cf495e5 Reviewed-by: Rafael Roquetto --- tests/auto/opengl/qgl/tst_qgl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/opengl/qgl/tst_qgl.cpp b/tests/auto/opengl/qgl/tst_qgl.cpp index 3fc89acb67..38c92c7610 100644 --- a/tests/auto/opengl/qgl/tst_qgl.cpp +++ b/tests/auto/opengl/qgl/tst_qgl.cpp @@ -1288,7 +1288,7 @@ void tst_QGL::glFBOUseInGLWidget() FBOUseInGLWidget w; w.resize(100, 100); - w.show(); + w.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&w)); @@ -1774,7 +1774,7 @@ void tst_QGL::clipTest() { ClipTestGLWidget glw; glw.resize(220, 220); - glw.show(); + glw.showNormal(); QVERIFY(QTest::qWaitForWindowExposed(&glw)); -- cgit v1.2.3 From 5885b8f775998c30d53f40b7f368c5f6364e6df4 Mon Sep 17 00:00:00 2001 From: Dario Freddi Date: Wed, 7 Aug 2013 11:17:25 +0200 Subject: qobject: Do not destroy slot objects inside a lock This prevents deadlocks in case the destructor re-enters. (Example: a functor containing a QSharedPointer of a QObject) This also fixes a leaked slot object in disconnectHelper. Change-Id: Ia939790e3b54e64067b99540974306b4808a77f2 Reviewed-by: Olivier Goffart --- tests/auto/corelib/kernel/qobject/tst_qobject.cpp | 58 ++++++++++++++++++++--- 1 file changed, 51 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index d16369de02..1cdf39018b 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -5726,27 +5726,44 @@ void tst_QObject::connectFunctorOverloads() #endif } +class GetSenderObject : public QObject +{ + Q_OBJECT +public: + QObject *accessSender() { return sender(); } + +public Q_SLOTS: + void triggerSignal() { Q_EMIT aSignal(); } + +Q_SIGNALS: + void aSignal(); +}; + static int countedStructObjectsCount = 0; struct CountedStruct { - CountedStruct() { ++countedStructObjectsCount; } - CountedStruct(const CountedStruct &) { ++countedStructObjectsCount; } + CountedStruct() : sender(Q_NULLPTR) { ++countedStructObjectsCount; } + CountedStruct(GetSenderObject *sender) : sender(sender) { ++countedStructObjectsCount; } + CountedStruct(const CountedStruct &o) : sender(o.sender) { ++countedStructObjectsCount; } CountedStruct &operator=(const CountedStruct &) { return *this; } - ~CountedStruct() { --countedStructObjectsCount; } - void operator()() const {} + // accessSender here allows us to check if there's a deadlock + ~CountedStruct() { --countedStructObjectsCount; if (sender != Q_NULLPTR) (void)sender->accessSender(); } + void operator()() const { } + + GetSenderObject *sender; }; void tst_QObject::disconnectDoesNotLeakFunctor() { QCOMPARE(countedStructObjectsCount, 0); { + GetSenderObject obj; QMetaObject::Connection c; { - CountedStruct s; + CountedStruct s(&obj); QCOMPARE(countedStructObjectsCount, 1); - QTimer timer; - c = connect(&timer, &QTimer::timeout, s); + c = connect(&obj, &GetSenderObject::aSignal, s); QVERIFY(c); QCOMPARE(countedStructObjectsCount, 2); QVERIFY(QObject::disconnect(c)); @@ -5796,6 +5813,33 @@ void tst_QObject::disconnectDoesNotLeakFunctor() QCOMPARE(countedStructObjectsCount, 0); // functor being destroyed } QCOMPARE(countedStructObjectsCount, 0); + { + QTimer *timer = new QTimer; + QEventLoop e; + + connect(timer, &QTimer::timeout, CountedStruct()); + QCOMPARE(countedStructObjectsCount, 1); // only one instance, in Qt internals + timer->deleteLater(); + connect(timer, &QObject::destroyed, &e, &QEventLoop::quit, Qt::QueuedConnection); + e.exec(); + QCOMPARE(countedStructObjectsCount, 0); // functor being destroyed + } + QCOMPARE(countedStructObjectsCount, 0); + { + GetSenderObject obj; + + connect(&obj, &GetSenderObject::aSignal, CountedStruct(&obj)); + QCOMPARE(countedStructObjectsCount, 1); + } + QCOMPARE(countedStructObjectsCount, 0); + { + GetSenderObject obj; + + connect(&obj, &GetSenderObject::aSignal, CountedStruct(&obj)); + QCOMPARE(countedStructObjectsCount, 1); + QObject::disconnect(&obj, &GetSenderObject::aSignal, 0, 0); + } + QCOMPARE(countedStructObjectsCount, 0); { #if defined(Q_COMPILER_LAMBDA) CountedStruct s; -- cgit v1.2.3 From e6218ecfb55d67397331213663043e9fb71fcdb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 6 Aug 2013 15:00:07 +0200 Subject: Improve tst_QFileInfo::compare() test, but mark as QEXPECT_FAIL on Mac As Qt still thinks that all UNIX filesystems are case sensitive, which is not the case for eg Mac, where they might be both, as well as for mounts of other filesystems. Change-Id: I07b8550685bfa17ac407c20ac991dc54df040942 Reviewed-by: Gabriel de Dietrich --- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index bcc971bf4b..af2578ac37 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -916,16 +916,6 @@ void tst_QFileInfo::compare_data() QTest::addColumn("file2"); QTest::addColumn("same"); -#if defined(Q_OS_MAC) - // Since 10.6 we use realpath() in qfsfileengine, and it properly handles - // file system case sensitivity. However here in the autotest we don't - // check if the file system is case sensitive, so to make it pass in the - // default OS X installation we assume we are running on a case insensitive - // file system if on 10.6 and on a case sensitive file system if on 10.5 - bool caseSensitiveOnMac = true; - if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) - caseSensitiveOnMac = false; -#endif QString caseChangedSource = m_sourceFile; caseChangedSource.replace("info", "Info"); @@ -947,7 +937,7 @@ void tst_QFileInfo::compare_data() #if defined(Q_OS_WIN) << true; #elif defined(Q_OS_MAC) - << !caseSensitiveOnMac; + << !pathconf(QDir::currentPath().toLatin1().constData(), _PC_CASE_SENSITIVE); #else << false; #endif @@ -955,6 +945,11 @@ void tst_QFileInfo::compare_data() void tst_QFileInfo::compare() { +#if defined(Q_OS_MAC) + if (qstrcmp(QTest::currentDataTag(), "casesense1") == 0) + QSKIP("Qt thinks all UNIX filesystems are case sensitive, see QTBUG-28246"); +#endif + QFETCH(QString, file1); QFETCH(QString, file2); QFETCH(bool, same); -- cgit v1.2.3 From cffd1633b267d0034627756296e61abcc0ef50be Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 7 Aug 2013 14:23:18 +0200 Subject: Fix QCompleter::activated(QModelIndex) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When falling back to the completion prefix, make sure to also pass an invalid index to activated(). Change-Id: I6b282a01c95492466890632b77837bcc96eb038a Reviewed-by: Stephen Kelly Reviewed-by: Thorbjørn Lund Martsum --- tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index 0f7993540c..3a6fca7146 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -1305,10 +1305,15 @@ void tst_QCompleter::task246056_setCompletionPrefix() comboBox.show(); QApplication::setActiveWindow(&comboBox); QVERIFY(QTest::qWaitForWindowActive(&comboBox)); + QSignalSpy spy(comboBox.completer(), SIGNAL(activated(QModelIndex))); QTest::keyPress(&comboBox, 'a'); QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down); QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Down); QTest::keyPress(comboBox.completer()->popup(), Qt::Key_Enter); // don't crash! + QCOMPARE(spy.count(), 1); + QList arguments = spy.at(0); + QModelIndex index = arguments.at(0).value(); + QVERIFY(!index.isValid()); } class task250064_TextEdit : public QTextEdit -- cgit v1.2.3 From f8ce891d22ebf8e053c0772ce66f3bbad1849a3c Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 6 Aug 2013 10:34:19 +0200 Subject: test: Mark tst_QSettings::ctor() and tst_QSettings::rainersSyncBugOnMac(native) as XFAIL Mark some tests as expected failures on OS X 10.8 - tst_QSettings::ctor(native) - tst_QSettings::ctor(ini) - tst_QSettings::ctor(custom1) - tst_QSettings::ctor(custom2) - tst_QSettings::rainersSyncBugOnMac(native) Task-number: QTBUG-32655 Change-Id: I54928d991a8ccf300b40747feaa6fda9d124781b Reviewed-by: Gabriel de Dietrich --- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index c2909cf7c5..aec8d1b241 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -513,12 +513,20 @@ void tst_QSettings::ctor() QSettings settings5(format, QSettings::UserScope, "SoftWare.ORG", "killerApp"); if (format == QSettings::NativeFormat) { #if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) +# ifdef Q_OS_MACX + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) + QEXPECT_FAIL("native", "See QTBUG-32655", Continue); +# endif // Q_OS_MACX QCOMPARE(settings5.value("key 1").toString(), QString("gurgle")); #else QVERIFY(!settings5.contains("key 1")); #endif } else { #if defined(Q_OS_WIN) || defined(Q_OS_DARWIN) +# ifdef Q_OS_MACX + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) + QEXPECT_FAIL("", "See QTBUG-32655", Continue); +# endif // Q_OS_MACX QCOMPARE(settings5.value("key 1").toString(), QString("gurgle")); #else QVERIFY(!settings5.contains("key 1")); @@ -3162,6 +3170,10 @@ void tst_QSettings::rainersSyncBugOnMac() { QSettings s3(format, QSettings::UserScope, "software.org", "KillerAPP"); +#ifdef Q_OS_MACX + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) + QEXPECT_FAIL("native", "See QTBUG-32655", Continue); +#endif QCOMPARE(s3.value("key1", 30).toInt(), 25); } } -- cgit v1.2.3 From 737abb8a5e51d75c0f2f93d5f7b42b05400034a9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 2 Jul 2013 15:49:50 +0200 Subject: QComboBox: fix item activation via completer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-31146 Change-Id: I64291f397d80bf934152f63e629810540abf466e Reviewed-by: Friedemann Kleint Reviewed-by: Stephen Kelly Reviewed-by: Thorbjørn Lund Martsum --- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 0bfd4baa0c..82d3fae0fa 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -160,6 +160,7 @@ private slots: void maxVisibleItems(); void task_QTBUG_10491_currentIndexAndModelColumn(); void highlightedSignal(); + void task_QTBUG_31146_popupCompletion(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -2755,5 +2756,39 @@ void tst_QComboBox::highlightedSignal() QCOMPARE(spy.size(), 1); } +void tst_QComboBox::task_QTBUG_31146_popupCompletion() +{ + QComboBox comboBox; + comboBox.setEditable(true); + comboBox.setAutoCompletion(true); + comboBox.setInsertPolicy(QComboBox::NoInsert); + comboBox.completer()->setCaseSensitivity(Qt::CaseInsensitive); + comboBox.completer()->setCompletionMode(QCompleter::PopupCompletion); + + comboBox.addItems(QStringList() << QStringLiteral("item") << QStringLiteral("item")); + + comboBox.show(); + comboBox.activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(&comboBox)); + + QCOMPARE(comboBox.currentIndex(), 0); + + comboBox.lineEdit()->selectAll(); + QTest::keyClicks(comboBox.lineEdit(), "item"); + + QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Down); + QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Down); + QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Enter); + QCOMPARE(comboBox.currentIndex(), 1); + + comboBox.lineEdit()->selectAll(); + QTest::keyClicks(comboBox.lineEdit(), "item"); + + QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Up); + QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Up); + QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Enter); + QCOMPARE(comboBox.currentIndex(), 0); +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" -- cgit v1.2.3 From 23214c815ec267e999015a971768dbf8f6ea0957 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 7 Aug 2013 20:19:09 +0200 Subject: Revert c3f485c5250a503832e767e1fe5e40595126f6c5 It has been discovered it changes the behavior of qdbuscpp2xml resulting in builds of some apps breaking. Even if the behavior is more correct, such behavior change in a stable branch is not acceptable Change-Id: I1d79104ebf11c3f48c84f109be2926af96cddae7 Reviewed-by: Thiago Macieira --- tests/auto/dbus/dbus.pro | 1 - .../dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro | 5 - .../qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp | 125 --------------------- 3 files changed, 131 deletions(-) delete mode 100644 tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro delete mode 100644 tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp (limited to 'tests') diff --git a/tests/auto/dbus/dbus.pro b/tests/auto/dbus/dbus.pro index 52ee154008..cd845d7043 100644 --- a/tests/auto/dbus/dbus.pro +++ b/tests/auto/dbus/dbus.pro @@ -17,7 +17,6 @@ SUBDIRS=\ qdbustype \ qdbusthreading \ qdbusxmlparser \ - qdbusxmlgenerator \ !contains(QT_CONFIG,private_tests): SUBDIRS -= \ qdbusmarshall \ diff --git a/tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro b/tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro deleted file mode 100644 index 5bf8523c42..0000000000 --- a/tests/auto/dbus/qdbusxmlgenerator/qdbusxmlgenerator.pro +++ /dev/null @@ -1,5 +0,0 @@ -CONFIG += testcase -TARGET = tst_qdbusxmlgenerator -QT = core dbus testlib xml -SOURCES += tst_qdbusxmlgenerator.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp b/tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp deleted file mode 100644 index 1ff613b5ca..0000000000 --- a/tests/auto/dbus/qdbusxmlgenerator/tst_qdbusxmlgenerator.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Canonical Limited -** Contact: http://www.qt-project.org/legal -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include - -#include -#include -#include - -static const QString serviceName = "org.example.qdbus"; -static const QString interfaceName = serviceName; - -Q_DECLARE_METATYPE(QDBusConnection::RegisterOption); - -class DBusXmlGenetarorObject : public QObject -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "org.example.qdbus") -public: - Q_INVOKABLE void nonScriptableInvokable() {} - Q_SCRIPTABLE Q_INVOKABLE void scriptableInvokable() {} -}; - -class tst_QDBusXmlGenerator : public QObject -{ - Q_OBJECT - -private slots: - void initTestCase(); - void introspect_data(); - void introspect(); -}; - -void tst_QDBusXmlGenerator::initTestCase() -{ - QDBusConnection::sessionBus().registerService(serviceName); -} - -void tst_QDBusXmlGenerator::introspect_data() -{ - QTest::addColumn("methodName"); - QTest::addColumn("flags"); - - QTest::newRow("scriptableInvokable") << "scriptableInvokable" << QDBusConnection::ExportScriptableInvokables; - QTest::newRow("nonScriptableInvokable") << "nonScriptableInvokable" << QDBusConnection::ExportNonScriptableInvokables; -} - -void tst_QDBusXmlGenerator::introspect() -{ - QFETCH(QString, methodName); - QFETCH(QDBusConnection::RegisterOption, flags); - DBusXmlGenetarorObject obj; - - QDBusConnection::sessionBus().registerObject("/" + methodName, &obj, flags ); - - QDBusInterface dif(serviceName, "/" + methodName, "", QDBusConnection::sessionBus()); - QDBusReply reply = dif.call("Introspect"); - - bool found = false; - QDomDocument d; - d.setContent(reply.value(), false); - QDomNode n = d.documentElement().firstChild(); - while (!found && !n.isNull()) { - QDomElement e = n.toElement(); // try to convert the node to an element. - if (!e.isNull()) { - if (e.tagName() == "interface" && e.attribute("name") == interfaceName ) { - QDomNode n2 = e.firstChild(); - while (!n2.isNull()) { - QDomElement e2 = n2.toElement(); // try to convert the node to an element. - if (!e2.isNull()) { - if (e2.tagName() == "method") { - found = e2.attribute("name") == methodName; - } - } - n2 = n2.nextSibling(); - } - } - } - n = n.nextSibling(); - } - - QVERIFY(found); -} - -QTEST_MAIN(tst_QDBusXmlGenerator) - -#include "tst_qdbusxmlgenerator.moc" - -- cgit v1.2.3 From c98943b4cd1c2c2007a9be19a0cfbe8739ab8ccb Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 7 Aug 2013 13:14:32 +0200 Subject: Expect fail font family mismatch in the right place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes 4ca4fb93f666820ab10fc0e17f54b2b777540779 where the fix was right, just in the wrong place. Change-Id: I3cde24624e3789870f1c16ccb92f78f7fc567fd5 Reviewed-by: Tor Arne Vestbø --- tests/auto/gui/text/qfont/tst_qfont.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index 082bb94b60..acb55c2d86 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -667,15 +667,6 @@ void tst_QFont::defaultFamily_data() void tst_QFont::defaultFamily() { -#if defined(Q_OS_MAC) - if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) { - QEXPECT_FAIL("serif", "See QTBUG-32834", Continue); - QEXPECT_FAIL("monospace", "See QTBUG-32834", Continue); - QEXPECT_FAIL("cursive", "See QTBUG-32834", Continue); - QEXPECT_FAIL("fantasy", "See QTBUG-32834", Continue); - } -#endif - QFETCH(QFont::StyleHint, styleHint); QFETCH(QStringList, acceptableFamilies); @@ -694,6 +685,15 @@ void tst_QFont::defaultFamily() break; } } + +#if defined(Q_OS_MAC) + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_8) { + QEXPECT_FAIL("serif", "See QTBUG-32834", Continue); + QEXPECT_FAIL("monospace", "See QTBUG-32834", Continue); + QEXPECT_FAIL("cursive", "See QTBUG-32834", Continue); + QEXPECT_FAIL("fantasy", "See QTBUG-32834", Continue); + } +#endif QVERIFY2(isAcceptable, msgNotAcceptableFont(familyForHint, acceptableFamilies)); } -- cgit v1.2.3 From 0352c74755a0e593b8fe32fd4bedf8f73e2cc155 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 9 Aug 2013 12:18:26 +0200 Subject: test: Mark tst_QGlyphRun::drawMultiScriptText2() as XFAIL This is a flaky test on OS X 10.8, so marking it as XFAIL if it is expected to fail. Task-number: QTBUG-32690 Change-Id: I0665c7474bb62c4c0a70e4b93cc977e3dbf1e150 Reviewed-by: Frederik Gladhorn --- tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index 6b06424ad7..3f6eaae89b 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -502,6 +502,10 @@ void tst_QGlyphRun::drawMultiScriptText2() drawGlyphs.save("drawMultiScriptText2_drawGlyphIndexes.png"); #endif +#ifdef Q_OS_MACX + if (drawGlyphs.toImage() != textLayoutDraw.toImage()) + QEXPECT_FAIL("", "See QTBUG-32690", Continue); +#endif // Q_OS_MACX QCOMPARE(drawGlyphs, textLayoutDraw); } -- cgit v1.2.3 From d6522b70adaaa51ae3bbbe0b1ada8f8e4dc82e78 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 7 Aug 2013 19:32:08 +0200 Subject: test: Skip some flaky tests, but only if they are expected to fail Task-number: QTBUG-29941 Change-Id: Ieca736c26711fa292855b3281229282628dce608 Reviewed-by: Richard J. Moore --- .../auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 110 ++++++++++++++------- 1 file changed, 77 insertions(+), 33 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index f3adb2b52f..de421a82c2 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -608,7 +608,9 @@ void tst_QSslSocket::connectToHostEncrypted() // This should pass unconditionally when using fluke's CA certificate. // or use untrusted certificate workaround - QVERIFY2(socket->waitForEncrypted(10000), qPrintable(socket->errorString())); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); socket->disconnectFromHost(); QVERIFY(socket->waitForDisconnected()); @@ -640,7 +642,9 @@ void tst_QSslSocket::connectToHostEncryptedWithVerificationPeerName() socket->connectToHostEncrypted(QtNetworkSettings::serverLocalName(), 443, QtNetworkSettings::serverName()); // This should pass unconditionally when using fluke's CA certificate. - QVERIFY2(socket->waitForEncrypted(10000), qPrintable(socket->errorString())); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); socket->disconnectFromHost(); QVERIFY(socket->waitForDisconnected()); @@ -661,7 +665,8 @@ void tst_QSslSocket::sessionCipher() QVERIFY(socket->waitForConnected(10000)); QVERIFY(socket->sessionCipher().isNull()); socket->startClientEncryption(); - QVERIFY(socket->waitForEncrypted(5000)); + if (!socket->waitForEncrypted(5000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QVERIFY(!socket->sessionCipher().isNull()); QVERIFY(QSslSocket::supportedCiphers().contains(socket->sessionCipher())); socket->disconnectFromHost(); @@ -692,7 +697,9 @@ void tst_QSslSocket::localCertificate() socket->setPrivateKey(QLatin1String(SRCDIR "certs/fluke.key")); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted(10000)); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); } void tst_QSslSocket::mode() @@ -724,7 +731,9 @@ void tst_QSslSocket::peerCertificateChain() socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); QCOMPARE(socket->mode(), QSslSocket::UnencryptedMode); QVERIFY(socket->peerCertificateChain().isEmpty()); - QVERIFY2(socket->waitForEncrypted(10000), qPrintable(socket->errorString())); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QList certChain = socket->peerCertificateChain(); QVERIFY(certChain.count() > 0); @@ -738,7 +747,8 @@ void tst_QSslSocket::peerCertificateChain() socket->ignoreSslErrors(); QCOMPARE(socket->mode(), QSslSocket::UnencryptedMode); QVERIFY(socket->peerCertificateChain().isEmpty()); - QVERIFY2(socket->waitForEncrypted(10000), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->peerCertificateChain().first(), socket->peerCertificate()); QVERIFY(socket->peerCertificateChain() != certChain); @@ -753,7 +763,8 @@ void tst_QSslSocket::peerCertificateChain() QVERIFY2(socket->waitForConnected(10000), "Network timeout"); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(10000), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->peerCertificateChain().first(), socket->peerCertificate()); QVERIFY(socket->peerCertificateChain() == certChain); @@ -791,7 +802,9 @@ void tst_QSslSocket::privateKeyOpaque() socket->setPeerVerifyMode(QSslSocket::QueryPeer); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted(10000)); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); } void tst_QSslSocket::protocol() @@ -810,19 +823,22 @@ void tst_QSslSocket::protocol() #endif QCOMPARE(socket->protocol(), QSsl::SecureProtocols); + QFETCH_GLOBAL(bool, setProxy); { // qt-test-server allows SSLv3. socket->setProtocol(QSsl::SslV3); QCOMPARE(socket->protocol(), QSsl::SslV3); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::SslV3); socket->abort(); QCOMPARE(socket->protocol(), QSsl::SslV3); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::SslV3); socket->abort(); } @@ -831,14 +847,16 @@ void tst_QSslSocket::protocol() socket->setProtocol(QSsl::TlsV1_0); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_0); socket->abort(); } @@ -848,14 +866,16 @@ void tst_QSslSocket::protocol() socket->setProtocol(QSsl::TlsV1_1); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_1); socket->abort(); } @@ -864,14 +884,16 @@ void tst_QSslSocket::protocol() socket->setProtocol(QSsl::TlsV1_2); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1_2); socket->abort(); } @@ -882,14 +904,16 @@ void tst_QSslSocket::protocol() socket->setProtocol(QSsl::SslV2); QCOMPARE(socket->protocol(), QSsl::SslV2); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted()); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::SslV2); socket->abort(); QCOMPARE(socket->protocol(), QSsl::SslV2); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); socket->abort(); } #endif @@ -898,14 +922,16 @@ void tst_QSslSocket::protocol() socket->setProtocol(QSsl::AnyProtocol); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted()); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); socket->abort(); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::AnyProtocol); socket->abort(); } @@ -914,14 +940,16 @@ void tst_QSslSocket::protocol() socket->setProtocol(QSsl::TlsV1SslV3); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted()); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); socket->abort(); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); socket->connectToHost(QtNetworkSettings::serverName(), 443); QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); socket->startClientEncryption(); - QVERIFY2(socket->waitForEncrypted(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->protocol(), QSsl::TlsV1SslV3); socket->abort(); } @@ -1252,7 +1280,9 @@ void tst_QSslSocket::waitForEncrypted() connect(this->socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted(10000)); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); } void tst_QSslSocket::waitForEncryptedMinusOne() @@ -1269,7 +1299,9 @@ void tst_QSslSocket::waitForEncryptedMinusOne() connect(this->socket, SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(socket->waitForEncrypted(-1)); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(-1)) + QSKIP("Skipping flaky test - See QTBUG-29941"); } void tst_QSslSocket::waitForConnectedEncryptedReadyRead() @@ -1284,7 +1316,9 @@ void tst_QSslSocket::waitForConnectedEncryptedReadyRead() socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993); QVERIFY(socket->waitForConnected(10000)); - QVERIFY(socket->waitForEncrypted(10000)); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QVERIFY(socket->waitForReadyRead(10000)); QVERIFY(!socket->peerCertificate().isNull()); QVERIFY(!socket->peerCertificateChain().isEmpty()); @@ -1422,7 +1456,9 @@ void tst_QSslSocket::wildcard() #endif socket->connectToHostEncrypted(QtNetworkSettings::wildcardServerName(), 4443); - QVERIFY2(socket->waitForEncrypted(3000), qPrintable(socket->errorString())); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && !socket->waitForEncrypted(3000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QSslCertificate certificate = socket->peerCertificate(); QVERIFY(certificate.subjectInfo(QSslCertificate::CommonName).contains(QString(QtNetworkSettings::serverLocalName() + ".*." + QtNetworkSettings::serverDomainName()))); @@ -1618,7 +1654,8 @@ void tst_QSslSocket::setReadBufferSize_task_250027() socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); socket->ignoreSslErrors(); QVERIFY(socket->waitForConnected(10*1000)); - QVERIFY(socket->waitForEncrypted(10*1000)); + if (setProxy && !socket->waitForEncrypted(10*1000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); // exit the event loop as soon as we receive a readyRead() SetReadBufferSize_task_250027_handler setReadBufferSize_task_250027_handler; @@ -1799,7 +1836,8 @@ void tst_QSslSocket::waitForMinusOne() socket.startClientEncryption(); // first verification: this waiting should take 200 ms - QVERIFY2(socket.waitForEncrypted(-1), qPrintable(socket.errorString())); + if (!socket.waitForEncrypted(-1)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QVERIFY(socket.isEncrypted()); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); QCOMPARE(socket.bytesAvailable(), Q_INT64_C(0)); @@ -1861,7 +1899,8 @@ void tst_QSslSocket::verifyMode() QCOMPARE(socket.peerVerifyMode(), QSslSocket::VerifyPeer); socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY(!socket.waitForEncrypted()); + if (socket.waitForEncrypted()) + QSKIP("Skipping flaky test - See QTBUG-29941"); QList expectedErrors = QList() << QSslError(QSslError::SelfSignedCertificate, socket.peerCertificate()); @@ -1905,7 +1944,8 @@ void tst_QSslSocket::peerVerifyError() QSignalSpy peerVerifyErrorSpy(socket.data(), SIGNAL(peerVerifyError(QSslError))); socket->connectToHostEncrypted(QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString(), 443); - QVERIFY(!socket->waitForEncrypted(10000)); + if (socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QVERIFY(!peerVerifyErrorSpy.isEmpty()); QVERIFY(!sslErrorsSpy.isEmpty()); QCOMPARE(qvariant_cast(peerVerifyErrorSpy.last().at(0)).error(), QSslError::HostNameMismatch); @@ -1945,7 +1985,8 @@ void tst_QSslSocket::disconnectFromHostWhenConnected() QSslSocketPtr socket = newSocket(); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 993); socket->ignoreSslErrors(); - QVERIFY(socket->waitForEncrypted(5000)); + if (!socket->waitForEncrypted(5000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); socket->write("XXXX LOGOUT\r\n"); QCOMPARE(socket->state(), QAbstractSocket::ConnectedState); socket->disconnectFromHost(); @@ -2118,7 +2159,8 @@ void tst_QSslSocket::writeBigChunk() data.data()[i*sizeof(int)] = r; } - QVERIFY(socket->waitForEncrypted(10000)); + if (!socket->waitForEncrypted(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QString errorBefore = socket->errorString(); int ret = socket->write(data.constData(), data.size()); @@ -2590,7 +2632,9 @@ void tst_QSslSocket::setEmptyDefaultConfiguration() // this test should be last, QSslSocketPtr socket = newSocket(); connect(socket.data(), SIGNAL(sslErrors(QList)), this, SLOT(ignoreErrorSlot())); socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); - QVERIFY2(!socket->waitForEncrypted(4000), qPrintable(socket->errorString())); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && socket->waitForEncrypted(4000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); } #endif // QT_NO_SSL -- cgit v1.2.3 From be5225cacea551da8138ab1ba1b9b48d30dbbfd5 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Fri, 9 Aug 2013 21:23:48 +0200 Subject: test: Mark tst_QFileSystemWatcher::watchFileAndItsDirectory() as XFAIL This is a flaky test on Windows 8 64-bit, so marking it as XFAIL if it is expected to fail. Task-number: QTBUG-30943 Change-Id: Idd276f80b54fcd5cf295a7e1adebcf0020eaa8ca Reviewed-by: Robin Burchell --- .../auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 2756fcce50..4105a43735 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -468,7 +468,12 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory() timer.start(3000); eventLoop.exec(); - QCOMPARE(fileChangedSpy.count(), 0); + int fileChangedSpyCount = fileChangedSpy.count(); +#ifdef Q_OS_WIN64 + if (fileChangedSpyCount != 0) + QEXPECT_FAIL("", "See QTBUG-30943", Continue); +#endif + QCOMPARE(fileChangedSpyCount, 0); #ifdef Q_OS_WINCE QEXPECT_FAIL("poller", "Directory does not get updated on file removal(See #137910)", Abort); #endif -- cgit v1.2.3 From efc43ae83dd74d6b1cac4d74e7c5767e9a25ff4f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 12 Aug 2013 13:16:13 +0200 Subject: Add some debugging information to diagnose bug. Task-number: QTBUG-32927 Change-Id: I7d0a1ad9eeb63ac0ec28483106f42109ed1a834c Reviewed-by: Sergio Ahumada --- .../auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 3fa3fbe0ee..c17e2523f9 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp @@ -440,6 +440,10 @@ void tst_QColumnView::scrollTo() if (level >= 2) { if (!reverse) { QTRY_VERIFY(view.HorizontalOffset() < 0); + if (last <= view.HorizontalOffset()) { + qDebug() << "Test failure. last=" << last + << " ; HorizontalOffset= " << view.HorizontalOffset(); + } QTRY_VERIFY(last > view.HorizontalOffset()); } else { QTRY_VERIFY(view.HorizontalOffset() > 0); @@ -457,10 +461,15 @@ void tst_QColumnView::scrollTo() view.scrollTo(index, QAbstractItemView::EnsureVisible); index = index.parent(); if (start != level) { - if (!reverse) + if (!reverse) { QTRY_VERIFY(last < view.HorizontalOffset()); - else + } else { + if (last <= view.HorizontalOffset()) { + qDebug() << "Test failure. last=" << last + << " ; HorizontalOffset= " << view.HorizontalOffset(); + } QTRY_VERIFY(last > view.HorizontalOffset()); + } } level--; last = view.HorizontalOffset(); -- cgit v1.2.3 From 126c1b4b410c1d7eaf8ed5ae26594f39e29f5296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 17 Jul 2013 22:25:11 +0200 Subject: Don't assume Q_OS_UNIX means we support QEventLoop::X11ExcludeTimers A QCoreApplication may run a different event dispatcher, such as the QEventDispatcherBlackberry, and QGuiApplications will have the GUI dispatcher provided by the QPA plugin, such as QCocoaEventDispatcher. Neither support X11ExcludeTimers. Change-Id: Id5ea1c7dd74a127e13fa4d2eaa9a1bd2715a9dbb Reviewed-by: Gabriel de Dietrich --- tests/auto/corelib/kernel/qeventloop/qeventloop.pro | 2 ++ .../corelib/kernel/qeventloop/tst_qeventloop.cpp | 20 +++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index c510052298..50329e239d 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -6,3 +6,5 @@ SOURCES = tst_qeventloop.cpp win32:!wince*:LIBS += -luser32 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +contains(QT_CONFIG, glib): DEFINES += HAVE_GLIB diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index c696c6e21a..baa32e2ed5 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -46,6 +46,12 @@ #include #include #include +#if defined(Q_OS_UNIX) + #include + #if defined(HAVE_GLIB) + #include + #endif +#endif #include #include #include @@ -491,11 +497,19 @@ void tst_QEventLoop::processEventsExcludeTimers() QCOMPARE(timerReceiver.gotTimerEvent, timerId); timerReceiver.gotTimerEvent = -1; - // normal process events will send timers + // but not if we exclude timers eventLoop.processEvents(QEventLoop::X11ExcludeTimers); -#if !defined(Q_OS_UNIX) - QEXPECT_FAIL("", "X11ExcludeTimers only works on UN*X", Continue); + + QAbstractEventDispatcher *eventDispatcher = QCoreApplication::eventDispatcher(); +#if defined(Q_OS_UNIX) + if (!qobject_cast(eventDispatcher) + #if defined(HAVE_GLIB) + && !qobject_cast(eventDispatcher) + #endif + ) #endif + QEXPECT_FAIL("", "X11ExcludeTimers only supported in the UNIX/Glib dispatchers", Continue); + QCOMPARE(timerReceiver.gotTimerEvent, -1); timerReceiver.gotTimerEvent = -1; -- cgit v1.2.3 From 3ca9c396105212af5b84b5740fd9c09b92ab8d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 17 Jul 2013 21:50:56 +0200 Subject: Add auto-test for running the QEventLoop test with the GUI dispatcher Follows a similar include-pattern as the qguieventdispatcher test. Change-Id: Ie8669a5bc155abd6687e81526f2b95d0d19b009e Reviewed-by: Gabriel de Dietrich --- tests/auto/corelib/kernel/qeventloop/qeventloop.pro | 2 +- tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp | 4 ++++ tests/auto/gui/kernel/kernel.pro | 1 + tests/auto/gui/kernel/qguieventloop/qguieventloop.pro | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/auto/gui/kernel/qguieventloop/qguieventloop.pro (limited to 'tests') diff --git a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro index 50329e239d..e5bcc31e6a 100644 --- a/tests/auto/corelib/kernel/qeventloop/qeventloop.pro +++ b/tests/auto/corelib/kernel/qeventloop/qeventloop.pro @@ -2,7 +2,7 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qeventloop QT = core network testlib core-private -SOURCES = tst_qeventloop.cpp +SOURCES = $$PWD/tst_qeventloop.cpp win32:!wince*:LIBS += -luser32 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index baa32e2ed5..df374ffc23 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -165,6 +165,10 @@ public slots: } }; +#ifdef QT_GUI_LIB + #define tst_QEventLoop tst_QGuiEventLoop +#endif + class tst_QEventLoop : public QObject { Q_OBJECT diff --git a/tests/auto/gui/kernel/kernel.pro b/tests/auto/gui/kernel/kernel.pro index 85a81de632..0d0a300eac 100644 --- a/tests/auto/gui/kernel/kernel.pro +++ b/tests/auto/gui/kernel/kernel.pro @@ -6,6 +6,7 @@ SUBDIRS=\ qevent \ qfileopenevent \ qguieventdispatcher \ + qguieventloop \ qguimetatype \ qguitimer \ qguivariant \ diff --git a/tests/auto/gui/kernel/qguieventloop/qguieventloop.pro b/tests/auto/gui/kernel/qguieventloop/qguieventloop.pro new file mode 100644 index 0000000000..633386fa75 --- /dev/null +++ b/tests/auto/gui/kernel/qguieventloop/qguieventloop.pro @@ -0,0 +1,3 @@ +include(../../../corelib/kernel/qeventloop/qeventloop.pro) +TARGET = tst_qguieventloop +QT += gui -- cgit v1.2.3 From dfde98db52452a8c4711b80793c679974aefeb94 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 10 Feb 2013 16:06:05 +0100 Subject: Make the QItemSelectionModel test widgets-independent. Change-Id: I695afe535ff291bc98f43185469a434cd9178926 Reviewed-by: Olivier Goffart --- tests/auto/corelib/itemmodels/itemmodels.pro | 2 +- .../qitemselectionmodel/qitemselectionmodel.pro | 2 +- .../tst_qitemselectionmodel.cpp | 101 ++++++++++----------- 3 files changed, 51 insertions(+), 54 deletions(-) (limited to 'tests') diff --git a/tests/auto/corelib/itemmodels/itemmodels.pro b/tests/auto/corelib/itemmodels/itemmodels.pro index e0bc2a8a4b..3f726692ff 100644 --- a/tests/auto/corelib/itemmodels/itemmodels.pro +++ b/tests/auto/corelib/itemmodels/itemmodels.pro @@ -3,9 +3,9 @@ TEMPLATE=subdirs SUBDIRS = qabstractitemmodel \ qabstractproxymodel \ qidentityproxymodel \ + qitemselectionmodel \ qstringlistmodel \ qtHaveModule(widgets): SUBDIRS += \ qitemmodel \ - qitemselectionmodel \ qsortfilterproxymodel \ diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro b/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro index 9241676076..1b6279ba1b 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/qitemselectionmodel.pro @@ -1,6 +1,6 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qitemselectionmodel -QT += widgets testlib +QT += testlib SOURCES += tst_qitemselectionmodel.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 8fac2c19eb..9788b78771 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -42,7 +42,6 @@ #include #include -#include class tst_QItemSelectionModel : public QObject { @@ -1526,22 +1525,21 @@ public: void tst_QItemSelectionModel::resetModel() { MyStandardItemModel model(20, 20); - QTreeView view; - view.setModel(&model); + QItemSelectionModel *selectionModel = new QItemSelectionModel(&model); - QSignalSpy spy(view.selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection))); + QSignalSpy spy(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection))); QVERIFY(spy.isValid()); - view.selectionModel()->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); + selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); QCOMPARE(spy.count(), 1); model.reset(); - QVERIFY(view.selectionModel()->selection().isEmpty()); - QVERIFY(view.selectionModel()->hasSelection() == false); + QVERIFY(selectionModel->selection().isEmpty()); + QVERIFY(selectionModel->hasSelection() == false); - view.selectionModel()->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); + selectionModel->select(QItemSelection(model.index(0, 0), model.index(5, 5)), QItemSelectionModel::Select); QCOMPARE(spy.count(), 2); QCOMPARE(spy.at(1).count(), 2); @@ -1905,22 +1903,20 @@ void tst_QItemSelectionModel::selectedColumns() void tst_QItemSelectionModel::setCurrentIndex() { // Build up a simple tree - QStandardItemModel *treemodel = new QStandardItemModel(0, 1); + QScopedPointer treemodel(new QStandardItemModel(0, 1)); treemodel->insertRow(0, new QStandardItem(1)); treemodel->insertRow(1, new QStandardItem(2)); - QTreeView treeView; - treeView.setModel(treemodel); - QItemSelectionModel *selectionModel = treeView.selectionModel(); - selectionModel->setCurrentIndex( + QItemSelectionModel selectionModel(treemodel.data()); + selectionModel.setCurrentIndex( treemodel->index(0, 0, treemodel->index(0, 0)), QItemSelectionModel::SelectCurrent); - QSignalSpy currentSpy(selectionModel, + QSignalSpy currentSpy(&selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex))); - QSignalSpy rowSpy(selectionModel, + QSignalSpy rowSpy(&selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex))); - QSignalSpy columnSpy(selectionModel, + QSignalSpy columnSpy(&selectionModel, SIGNAL(currentColumnChanged(QModelIndex,QModelIndex))); QVERIFY(currentSpy.isValid()); @@ -1928,7 +1924,7 @@ void tst_QItemSelectionModel::setCurrentIndex() QVERIFY(columnSpy.isValid()); // Select the same row and column indexes, but with a different parent - selectionModel->setCurrentIndex( + selectionModel.setCurrentIndex( treemodel->index(0, 0, treemodel->index(1, 0)), QItemSelectionModel::SelectCurrent); @@ -1937,15 +1933,13 @@ void tst_QItemSelectionModel::setCurrentIndex() QCOMPARE(columnSpy.count(), 1); // Select another row in the same parent - selectionModel->setCurrentIndex( + selectionModel.setCurrentIndex( treemodel->index(1, 0, treemodel->index(1, 0)), QItemSelectionModel::SelectCurrent); QCOMPARE(currentSpy.count(), 2); QCOMPARE(rowSpy.count(), 2); QCOMPARE(columnSpy.count(), 1); - - delete treemodel; } void tst_QItemSelectionModel::splitOnInsert() @@ -1960,29 +1954,27 @@ void tst_QItemSelectionModel::splitOnInsert() void tst_QItemSelectionModel::rowIntersectsSelection1() { - QTableWidget table; - table.setColumnCount(1); - table.setRowCount(1); - table.setItem(0, 0, new QTableWidgetItem("foo")); - QAbstractItemModel *model = table.model(); - QItemSelectionModel *selectionModel = table.selectionModel(); - QModelIndex index = model->index(0, 0, QModelIndex()); - - selectionModel->select(index, QItemSelectionModel::Select); - QVERIFY(selectionModel->rowIntersectsSelection(0, QModelIndex())); - QVERIFY(selectionModel->columnIntersectsSelection(0, QModelIndex())); - - selectionModel->select(index, QItemSelectionModel::Deselect); - QVERIFY(!selectionModel->rowIntersectsSelection(0, QModelIndex())); - QVERIFY(!selectionModel->columnIntersectsSelection(0, QModelIndex())); - - selectionModel->select(index, QItemSelectionModel::Toggle); - QVERIFY(selectionModel->rowIntersectsSelection(0, QModelIndex())); - QVERIFY(selectionModel->columnIntersectsSelection(0, QModelIndex())); - - selectionModel->select(index, QItemSelectionModel::Toggle); - QVERIFY(!selectionModel->rowIntersectsSelection(0, QModelIndex())); - QVERIFY(!selectionModel->columnIntersectsSelection(0, QModelIndex())); + QStandardItemModel model; + model.setItem(0, 0, new QStandardItem("foo")); + QItemSelectionModel selectionModel(&model); + + QModelIndex index = model.index(0, 0, QModelIndex()); + + selectionModel.select(index, QItemSelectionModel::Select); + QVERIFY(selectionModel.rowIntersectsSelection(0, QModelIndex())); + QVERIFY(selectionModel.columnIntersectsSelection(0, QModelIndex())); + + selectionModel.select(index, QItemSelectionModel::Deselect); + QVERIFY(!selectionModel.rowIntersectsSelection(0, QModelIndex())); + QVERIFY(!selectionModel.columnIntersectsSelection(0, QModelIndex())); + + selectionModel.select(index, QItemSelectionModel::Toggle); + QVERIFY(selectionModel.rowIntersectsSelection(0, QModelIndex())); + QVERIFY(selectionModel.columnIntersectsSelection(0, QModelIndex())); + + selectionModel.select(index, QItemSelectionModel::Toggle); + QVERIFY(!selectionModel.rowIntersectsSelection(0, QModelIndex())); + QVERIFY(!selectionModel.columnIntersectsSelection(0, QModelIndex())); } void tst_QItemSelectionModel::rowIntersectsSelection2() @@ -2057,16 +2049,21 @@ void tst_QItemSelectionModel::rowIntersectsSelection3() void tst_QItemSelectionModel::unselectable() { - QTreeWidget w; - for (int i = 0; i < 10; ++i) - w.setItemSelected(new QTreeWidgetItem(&w), true); - QCOMPARE(w.topLevelItemCount(), 10); - QCOMPARE(w.selectionModel()->selectedIndexes().count(), 10); - QCOMPARE(w.selectionModel()->selectedRows().count(), 10); + QStandardItemModel model; + QStandardItem *parentItem = model.invisibleRootItem(); + + for (int i = 0; i < 10; ++i) { + QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + parentItem->appendRow(item); + } + QItemSelectionModel selectionModel(&model); + selectionModel.select(QItemSelection(model.index(0, 0), model.index(9, 0)), QItemSelectionModel::Select); + QCOMPARE(selectionModel.selectedIndexes().count(), 10); + QCOMPARE(selectionModel.selectedRows().count(), 10); for (int j = 0; j < 10; ++j) - w.topLevelItem(j)->setFlags(0); - QCOMPARE(w.selectionModel()->selectedIndexes().count(), 0); - QCOMPARE(w.selectionModel()->selectedRows().count(), 0); + model.item(j)->setFlags(0); + QCOMPARE(selectionModel.selectedIndexes().count(), 0); + QCOMPARE(selectionModel.selectedRows().count(), 0); } void tst_QItemSelectionModel::selectedIndexes() -- cgit v1.2.3 From 983fa9b5cb8494717acc2903000f85d53848da9a Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Tue, 13 Aug 2013 15:17:42 +0200 Subject: test: Skip some more qsslsocket flaky tests Task-number: QTBUG-29941 Change-Id: Iaf1c4834ef36db284464184639a1ab00928510cf Reviewed-by: Peter Hartmann --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index de421a82c2..85b60686d6 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -910,7 +910,8 @@ void tst_QSslSocket::protocol() socket->abort(); QCOMPARE(socket->protocol(), QSsl::SslV2); socket->connectToHost(QtNetworkSettings::serverName(), 443); - QVERIFY2(socket->waitForConnected(), qPrintable(socket->errorString())); + if (setProxy && !socket->waitForConnected()) + QSKIP("Skipping flaky test - See QTBUG-29941"); socket->startClientEncryption(); if (setProxy && !socket->waitForEncrypted()) QSKIP("Skipping flaky test - See QTBUG-29941"); @@ -1969,7 +1970,8 @@ void tst_QSslSocket::disconnectFromHostWhenConnecting() QCOMPARE(state, socket->state()); QVERIFY(socket->state() == QAbstractSocket::HostLookupState || socket->state() == QAbstractSocket::ConnectingState); - QVERIFY(socket->waitForDisconnected(10000)); + if (!socket->waitForDisconnected(10000)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(socket->state(), QAbstractSocket::UnconnectedState); // we did not call close, so the socket must be still open QVERIFY(socket->isOpen()); @@ -2080,7 +2082,8 @@ void tst_QSslSocket::ignoreSslErrorsList() socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443); bool expectEncryptionSuccess = (expectedSslErrorSignalCount == 0); - QCOMPARE(socket.waitForEncrypted(10000), expectEncryptionSuccess); + if (socket.waitForEncrypted(10000) != expectEncryptionSuccess) + QSKIP("Skipping flaky test - See QTBUG-29941"); QCOMPARE(sslErrorsSpy.count(), expectedSslErrorSignalCount); } @@ -2132,7 +2135,9 @@ void tst_QSslSocket::readFromClosedSocket() socket->write("\n"); socket->waitForBytesWritten(); socket->waitForReadyRead(); - QVERIFY(socket->state() == QAbstractSocket::ConnectedState); + QFETCH_GLOBAL(bool, setProxy); + if (setProxy && (socket->state() != QAbstractSocket::ConnectedState)) + QSKIP("Skipping flaky test - See QTBUG-29941"); QVERIFY(socket->bytesAvailable()); socket->close(); QVERIFY(!socket->bytesAvailable()); -- cgit v1.2.3 From 3c2c9649eb7b966cfc2727fd309cf6d928c43f8c Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 13 Aug 2013 15:26:48 +0200 Subject: RCC: Make auto-test pick up the right binary Change-Id: I30f42d40c69789eb1e292ab6bd1cf2c09d81b11b Reviewed-by: Oswald Buddenhagen Reviewed-by: hjk --- tests/auto/tools/rcc/tst_rcc.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index d9ceb6ff6f..4089d53f3d 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -70,6 +70,9 @@ private slots: void binary(); void cleanupTestCase(); + +private: + QString m_rcc; }; void tst_rcc::initTestCase() @@ -77,6 +80,7 @@ void tst_rcc::initTestCase() // rcc uses a QHash to store files in the resource system. // we must force a certain hash order when testing or tst_rcc will fail, see QTBUG-25078 QVERIFY(qputenv("QT_RCC_TEST", "1")); + m_rcc = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/rcc"); } QString findExpectedFile(const QString &base) @@ -145,13 +149,12 @@ void tst_rcc::rcc() } // Launch - const QString command = QLatin1String("rcc"); QProcess process; - process.start(command, QStringList(qrcfile)); + process.start(m_rcc, QStringList(qrcfile)); if (!process.waitForFinished()) { const QString path = QString::fromLocal8Bit(qgetenv("PATH")); QString message = QString::fromLatin1("'%1' could not be found when run from '%2'. Path: '%3' "). - arg(command, QDir::currentPath(), path); + arg(m_rcc, QDir::currentPath(), path); QFAIL(qPrintable(message)); } const QChar cr = QLatin1Char('\r'); @@ -176,13 +179,14 @@ void tst_rcc::rcc() -static void createRccBinaryData(const QString &baseDir, const QString &qrcFileName, const QString &rccFileName) +static void createRccBinaryData(const QString &rcc, const QString &baseDir, + const QString &qrcFileName, const QString &rccFileName) { QString currentDir = QDir::currentPath(); QDir::setCurrent(baseDir); QProcess rccProcess; - rccProcess.start("rcc", QStringList() << "-binary" << "-o" << rccFileName << qrcFileName); + rccProcess.start(rcc, QStringList() << "-binary" << "-o" << rccFileName << qrcFileName); bool ok = rccProcess.waitForFinished(); if (!ok) { QString errorString = QString::fromLatin1("Could not start rcc (is it in PATH?): %1").arg(rccProcess.errorString()); @@ -262,7 +266,7 @@ void tst_rcc::binary_data() QFileInfo qrcFileInfo = iter.fileInfo(); QString absoluteBaseName = QFileInfo(qrcFileInfo.absolutePath(), qrcFileInfo.baseName()).absoluteFilePath(); QString rccFileName = absoluteBaseName + QLatin1String(".rcc"); - createRccBinaryData(dataPath, qrcFileInfo.absoluteFilePath(), rccFileName); + createRccBinaryData(m_rcc, dataPath, qrcFileInfo.absoluteFilePath(), rccFileName); QString localeFileName = absoluteBaseName + QLatin1String(".locale"); QFile localeFile(localeFileName); -- cgit v1.2.3 From c8d9b17367cfdcb034d11f8a168ca4ae3993e7c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 13 Aug 2013 13:20:05 +0200 Subject: Fix crash in QProcess::waitForStarted() on Unix. Invoking waitForStarted() on a QProcess before or after an unsuccessful call to start() (e.g., with an empty command), would execute FD_SET with an invalid file descriptor and cause the process to abort. The bug can be reliably reproduced on OSX. Task-number: QTBUG-32958 Change-Id: Id25b7781168489281645e21571361ca1a71d43e3 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index f2759dfd6e..7a3f6837f8 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -154,6 +154,7 @@ private slots: void invalidProgramString(); void onlyOneStartedSignal(); void finishProcessBeforeReadingDone(); + void waitForStartedWithoutStart(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -2214,6 +2215,12 @@ void tst_QProcess::finishProcessBeforeReadingDone() QCOMPARE(lines.last(), QStringLiteral("10239 -this is a number")); } +void tst_QProcess::waitForStartedWithoutStart() +{ + QProcess process; + QVERIFY(!process.waitForStarted(5000)); +} + #endif //QT_NO_PROCESS QTEST_MAIN(tst_QProcess) -- cgit v1.2.3