From 95984487586f0699829c35278efbc73e01bf3c23 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 9 Jan 2014 18:54:46 -0800 Subject: Remove #ifdef from outside test functions It's usually a bad idea to surround slots or signals with #ifdef since moc may not parse it the same way the compiler does. Change-Id: I6a3623ed7cb9fbc1b966df9d60f71b7fdf91acfe Reviewed-by: Olivier Goffart --- tests/auto/corelib/io/largefile/tst_largefile.cpp | 6 ++---- .../auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index 88b4abe2e3..7564e3fc1f 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -121,9 +121,7 @@ private slots: // Map/unmap large file void mapFile(); -#ifndef Q_OS_MAC void mapOffsetOverflow(); -#endif void closeFile() { largeFile.close(); } @@ -513,9 +511,9 @@ void tst_LargeFile::mapFile() } //Mac: memory-mapping beyond EOF may succeed but it could generate bus error on access -#ifndef Q_OS_MAC void tst_LargeFile::mapOffsetOverflow() { +#ifndef Q_OS_MAC // Out-of-range mappings should fail, and not silently clip the offset for (int i = 50; i < 63; ++i) { uchar *address = 0; @@ -529,8 +527,8 @@ void tst_LargeFile::mapOffsetOverflow() address = largeFile.map(((qint64)1 << i) + blockSize, blockSize); QVERIFY( !address ); } -} #endif +} QTEST_APPLESS_MAIN(tst_LargeFile) #include "tst_largefile.moc" diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index bd7bd3a464..493d7e20c5 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -120,10 +120,8 @@ private slots: void symetricConstructors(); void checkMultipleNames(); void checkMultipleCodes(); -#ifndef Q_OS_MAC void mnemonic_data(); void mnemonic(); -#endif void toString_data(); void toString(); void toStringFromKeycode_data(); @@ -144,10 +142,8 @@ private slots: void standardKeys_data(); void standardKeys(); void keyBindings(); -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) void translated_data(); void translated(); -#endif void i18nKeys_data(); void i18nKeys(); @@ -405,9 +401,11 @@ void tst_QKeySequence::keyBindings() QCOMPARE(bindings, expected); } -#ifndef Q_OS_MAC void tst_QKeySequence::mnemonic_data() { +#ifdef Q_OS_MAC + QSKIP("Test not applicable to Mac OS X"); +#endif QTest::addColumn("string"); QTest::addColumn("key"); QTest::addColumn("warning"); @@ -427,6 +425,7 @@ void tst_QKeySequence::mnemonic_data() void tst_QKeySequence::mnemonic() { +#ifndef Q_OS_MAC QFETCH(QString, string); QFETCH(QString, key); QFETCH(bool, warning); @@ -444,8 +443,8 @@ void tst_QKeySequence::mnemonic() QKeySequence res = QKeySequence(key); QCOMPARE(seq, res); -} #endif +} void tst_QKeySequence::toString_data() { @@ -734,9 +733,12 @@ void tst_QKeySequence::listFromString() QCOMPARE(QKeySequence::listFromString(strSequences), sequences); } -#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) void tst_QKeySequence::translated_data() { +#if defined (Q_OS_MAC) || defined (Q_OS_WINCE) + QSKIP("Test not applicable"); +#endif + qApp->installTranslator(ourTranslator); qApp->installTranslator(qtTranslator); @@ -764,6 +766,7 @@ void tst_QKeySequence::translated_data() void tst_QKeySequence::translated() { +#if !defined (Q_OS_MAC) && !defined (Q_OS_WINCE) QFETCH(QString, transKey); QFETCH(QString, compKey); @@ -775,8 +778,8 @@ void tst_QKeySequence::translated() qApp->removeTranslator(ourTranslator); qApp->removeTranslator(qtTranslator); -} #endif +} void tst_QKeySequence::i18nKeys_data() { -- cgit v1.2.3 From 6fd205d579ff53eb846ce5e15e558d4ea0e90823 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 18 Dec 2013 11:22:30 +0100 Subject: network proxy tests: adapt proxy authentication to new server The tests pass with the new test server image. Once we are using the new test server we can remove the test for the host not found error. Change-Id: Iac8ba6d8ce31b0865b33a003086aac0339afe338 Reviewed-by: Richard J. Moore --- tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index 1837e8d665..291b368e47 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -6596,9 +6596,8 @@ void tst_QNetworkReply::authenticationCacheAfterCancel() QTestEventLoop::instance().enterLoop(10); QVERIFY(!QTestEventLoop::instance().timeout()); - QEXPECT_FAIL("http+socksauth", "QTBUG-23136 - danted accepts bad authentication but blocks the connection", Continue); - QEXPECT_FAIL("https+socksauth", "QTBUG-23136 - danted accepts bad authentication but blocks the connection", Continue); - + if (reply->error() == QNetworkReply::HostNotFoundError) + QSKIP("skip because of quirk in the old test server"); QCOMPARE(reply->error(), QNetworkReply::ProxyAuthenticationRequiredError); QCOMPARE(authSpy.count(), 0); QVERIFY(proxyAuthSpy.count() > 0); -- cgit v1.2.3 From a41a5f6671616128eed650ad4742842b8e81a6ff Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 6 Jan 2014 19:20:58 +0100 Subject: QDateTime - Fix isValid() if invalid QTimeZone Explicitly check that the QTimeZone is valid before trying to use it. Change-Id: Iec415a2cb07071502fe71ee5ac92a7657e818f99 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 5d1fe0784f..866f68c99c 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2784,6 +2784,13 @@ void tst_QDateTime::daylightTransitions() const void tst_QDateTime::timeZones() const { + QTimeZone invalidTz = QTimeZone("Vulcan/ShiKahr"); + QCOMPARE(invalidTz.isValid(), false); + QDateTime invalidDateTime = QDateTime(QDate(2000, 1, 1), QTime(0, 0, 0), invalidTz); + QCOMPARE(invalidDateTime.isValid(), false); + QCOMPARE(invalidDateTime.date(), QDate(2000, 1, 1)); + QCOMPARE(invalidDateTime.time(), QTime(0, 0, 0)); + QTimeZone nzTz = QTimeZone("Pacific/Auckland"); // During Standard Time NZ is +12:00 -- cgit v1.2.3 From 684ebc66481eb095bac1aea4db5ae5a41aabd604 Mon Sep 17 00:00:00 2001 From: John Layt Date: Mon, 6 Jan 2014 20:03:37 +0100 Subject: QDate - Fix parsing Qt::ISODate Fix parsing of ISO Date from being totally lenient to being semi-strict by requiring the separator positions to be non-numeric. [ChangeLog][Important Behavior Changes] Parsing of Qt::ISODate by QDate::fromString() and QDateTime()::fromString() is not as lenient as before, the date component separators are now required to be non-numeric. This means a string like "2000901901" will no longer be recognized as a valid ISO Date, but "2000/01/01" will still be even though it doesn't strictly meet the ISO format of "2000-01-01". Task-number: QTBUG-34141 Change-Id: I0e481144136c60d4cac61364b9b2c1d2cd1e78fc Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qdate/tst_qdate.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index b91de092e8..807dcf5cbe 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -944,6 +944,13 @@ void tst_QDate::fromStringDateFormat_data() QTest::newRow("iso2") << QDate(1999, 11, 14).toString(Qt::ISODate) << Qt::ISODate << QDate(1999, 11, 14); QTest::newRow("iso3") << QString("0999-01-01") << Qt::ISODate << QDate(999, 1, 1); QTest::newRow("iso3b") << QString("0999-01-01") << Qt::ISODate << QDate(999, 1, 1); + QTest::newRow("iso4") << QString("2000101101") << Qt::ISODate << QDate(); + QTest::newRow("iso5") << QString("2000/01/01") << Qt::ISODate << QDate(2000, 1, 1); + QTest::newRow("iso6") << QString("2000-01-01 blah") << Qt::ISODate << QDate(2000, 1, 1); + QTest::newRow("iso7") << QString("2000-01-011blah") << Qt::ISODate << QDate(); + QTest::newRow("iso8") << QString("2000-01-01blah") << Qt::ISODate << QDate(2000, 1, 1); + QTest::newRow("iso9") << QString("-001-01-01") << Qt::ISODate << QDate(); + QTest::newRow("iso10") << QString("99999-01-01") << Qt::ISODate << QDate(); // Test Qt::RFC2822Date format (RFC 2822). QTest::newRow("RFC 2822") << QString::fromLatin1("13 Feb 1987 13:24:51 +0100") -- cgit v1.2.3 From 122ae7142b2dfd7ec0e03820c1d7f4317d1ce267 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 13 Jan 2014 16:55:22 +0100 Subject: Stabilize tst_scrollbar. - Use a separate widget for each test. - Replace hard-coded timeouts by qWaitForWindowExposed. - Center windows on screen. Change-Id: I45ae306fd23348ee5dec3849e64ec98843e8bf32 Reviewed-by: Frederik Gladhorn --- .../widgets/widgets/qscrollbar/tst_qscrollbar.cpp | 93 ++++++++++++---------- 1 file changed, 52 insertions(+), 41 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index baa3022919..51dd0852ee 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp @@ -44,68 +44,72 @@ #include #include #include +#include + +static inline void centerOnScreen(QWidget *w, const QSize &size) +{ + const QPoint offset = QPoint(size.width() / 2, size.height() / 2); + w->move(QGuiApplication::primaryScreen()->availableGeometry().center() - offset); +} + +static inline void centerOnScreen(QWidget *w) +{ + centerOnScreen(w, w->geometry().size()); +} class tst_QScrollBar : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void hideAndShow(int action); - private slots: void scrollSingleStep(); void task_209492(); #ifndef QT_NO_WHEELEVENT void QTBUG_27308(); #endif - -private: - QScrollBar *testWidget; }; -void tst_QScrollBar::initTestCase() -{ - testWidget = new QScrollBar(Qt::Horizontal); - testWidget->resize(100, testWidget->height()); - testWidget->show(); -} - -void tst_QScrollBar::cleanupTestCase() -{ - delete testWidget; - testWidget = 0; -} +class SingleStepTestScrollBar : public QScrollBar { + Q_OBJECT +public: + explicit SingleStepTestScrollBar(Qt::Orientation o, QWidget *parent = 0) : QScrollBar(o, parent) {} -void tst_QScrollBar::hideAndShow(int) -{ - testWidget->hide(); - testWidget->show(); -} +public slots: + void hideAndShow() + { + hide(); + show(); + } +}; // Check that the scrollbar doesn't scroll after calling hide and show // from a slot connected to the scrollbar's actionTriggered signal. void tst_QScrollBar::scrollSingleStep() { - testWidget->setValue(testWidget->minimum()); - QCOMPARE(testWidget->value(), testWidget->minimum()); - connect(testWidget, SIGNAL(actionTriggered(int)), this, SLOT(hideAndShow(int))); + SingleStepTestScrollBar testWidget(Qt::Horizontal); + connect(&testWidget, &QAbstractSlider::actionTriggered, &testWidget, &SingleStepTestScrollBar::hideAndShow); + testWidget.resize(100, testWidget.height()); + centerOnScreen(&testWidget); + testWidget.show(); + QTest::qWaitForWindowExposed(&testWidget); + + testWidget.setValue(testWidget.minimum()); + QCOMPARE(testWidget.value(), testWidget.minimum()); // Get rect for the area to click on - const QStyleOptionSlider opt = qt_qscrollbarStyleOption(testWidget); - QRect sr = testWidget->style()->subControlRect(QStyle::CC_ScrollBar, &opt, - QStyle::SC_ScrollBarAddLine, testWidget); + const QStyleOptionSlider opt = qt_qscrollbarStyleOption(&testWidget); + QRect sr = testWidget.style()->subControlRect(QStyle::CC_ScrollBar, &opt, + QStyle::SC_ScrollBarAddLine, &testWidget); if (!sr.isValid()) QSKIP("SC_ScrollBarAddLine not valid"); - QTest::mouseClick(testWidget, Qt::LeftButton, Qt::NoModifier, QPoint(sr.x(), sr.y())); + QTest::mouseClick(&testWidget, Qt::LeftButton, Qt::NoModifier, QPoint(sr.x(), sr.y())); QTest::qWait(510); // initial delay is 500 for setRepeatAction - disconnect(testWidget, SIGNAL(actionTriggered(int)), 0, 0); + disconnect(&testWidget, &QAbstractSlider::actionTriggered, &testWidget, &SingleStepTestScrollBar::hideAndShow); #ifdef Q_OS_MAC QEXPECT_FAIL("", "This test fails on Mac OS X, see QTBUG-25272", Abort); #endif - QCOMPARE(testWidget->value(), testWidget->singleStep()); + QCOMPARE(testWidget.value(), testWidget.singleStep()); } void tst_QScrollBar::task_209492() @@ -123,8 +127,9 @@ void tst_QScrollBar::task_209492() MyScrollArea scrollArea; QScrollBar *verticalScrollBar = scrollArea.verticalScrollBar(); verticalScrollBar->setRange(0, 1000); + centerOnScreen(&scrollArea); scrollArea.show(); - QTest::qWait(300); + QTest::qWaitForWindowExposed(&scrollArea); QSignalSpy spy(verticalScrollBar, SIGNAL(actionTriggered(int))); QCOMPARE(scrollArea.scrollCount, 0); @@ -153,12 +158,18 @@ void tst_QScrollBar::QTBUG_27308() // https://bugreports.qt-project.org/browse/QTBUG-27308 // Check that a disabled scrollbar doesn't react on wheel events anymore - testWidget->setValue(testWidget->minimum()); - testWidget->setEnabled(false); - QWheelEvent event(testWidget->rect().center(), - -WHEEL_DELTA, Qt::NoButton, Qt::NoModifier, testWidget->orientation()); - qApp->sendEvent(testWidget, &event); - QCOMPARE(testWidget->value(), testWidget->minimum()); + QScrollBar testWidget(Qt::Horizontal); + testWidget.resize(100, testWidget.height()); + centerOnScreen(&testWidget); + testWidget.show(); + QTest::qWaitForWindowExposed(&testWidget); + + testWidget.setValue(testWidget.minimum()); + testWidget.setEnabled(false); + QWheelEvent event(testWidget.rect().center(), + -WHEEL_DELTA, Qt::NoButton, Qt::NoModifier, testWidget.orientation()); + qApp->sendEvent(&testWidget, &event); + QCOMPARE(testWidget.value(), testWidget.minimum()); } #endif -- cgit v1.2.3 From f15d73058903eee77daa0a3f6deb8554aa01ea93 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 15 Jan 2014 14:01:08 +0100 Subject: test: tst_qhostinfo requires `private_tests' set Otherwise you get: undefined reference to `qt_qhostinfo_clear_cache()' Change-Id: I32313f290b9e4236440ae01afe12285d4539be60 Reviewed-by: Peter Hartmann --- tests/auto/network/kernel/qhostinfo/qhostinfo.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro index c21e73ccee..b6f5c2badb 100644 --- a/tests/auto/network/kernel/qhostinfo/qhostinfo.pro +++ b/tests/auto/network/kernel/qhostinfo/qhostinfo.pro @@ -3,6 +3,7 @@ TARGET = tst_qhostinfo SOURCES += tst_qhostinfo.cpp +requires(contains(QT_CONFIG,private_tests)) QT = core-private network-private testlib wince*: { -- cgit v1.2.3 From fa907401e90364797b3e60223618b94b4b8776e5 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 15 Jan 2014 14:10:16 +0100 Subject: test: tst_qhttpsocketengine requires `private_tests' set Otherwise you get: undefined reference to `vtable for QAbstractSocketEngine' when -developer-build is not used. Change-Id: I444140736a6bf736894dc12a20f6a4d48af2678e Reviewed-by: Peter Hartmann --- tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') diff --git a/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro index 414486f82b..009d151e29 100644 --- a/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro +++ b/tests/auto/network/socket/qhttpsocketengine/qhttpsocketengine.pro @@ -7,6 +7,7 @@ include(../platformsocketengine/platformsocketengine.pri) MOC_DIR=tmp +requires(contains(QT_CONFIG,private_tests)) QT = core-private network-private testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From aa7ec3cdf5d423b7abb7d0bb5ff7772602d41962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Tue, 18 Jun 2013 13:56:29 +0200 Subject: Android: QStandardPaths implementation Adds standard paths implementation for Android. [ChangeLog][QtCore][QStandardPaths] Added QStandardPaths implementation for Android. Task-number: QTBUG-34631 Change-Id: I38673204a521a990438470c4e165105a2b02b7ad Reviewed-by: BogDan Vatra Reviewed-by: Shawn Rutledge --- tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index 35a59401b7..21dfa5a962 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -52,7 +52,7 @@ #include #endif -#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_BLACKBERRY) +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) #define Q_XDG_PLATFORM #endif @@ -289,9 +289,9 @@ void tst_qstandardpaths::testDataLocation() { // On all platforms, DataLocation should be GenericDataLocation / organization name / app name // This allows one app to access the data of another app. - // Blackberry OS is an exception to this case, owing to the fact that + // Blackberry OS and Android are exceptions to this case, owing to the fact that // applications are sandboxed. -#ifndef Q_OS_BLACKBERRY +#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); -- cgit v1.2.3 From 73b5a5cdd534044573d49fac53666b8490d54c79 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 16 Jan 2014 12:48:08 +0100 Subject: test: Don't build qmimedatabase-cache for QNX update-mime-database does not exist, so there is no point in trying to build this test. Change-Id: Id60f2f8fc3af33d3f7ae2fb4f1042356b60f6596 Reviewed-by: David Faure Reviewed-by: Wolfgang Bremer --- tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro index 1ff5546e5c..536a6b64de 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs SUBDIRS = qmimedatabase-xml -unix:!mac: SUBDIRS += qmimedatabase-cache +unix:!mac:!qnx: SUBDIRS += qmimedatabase-cache -- cgit v1.2.3 From 7c8131763de9e70ca56f16635716e7e00559b5d1 Mon Sep 17 00:00:00 2001 From: "Richard J. Moore" Date: Sun, 12 Jan 2014 16:59:27 +0000 Subject: Prevent spurious SSL errors from local certificates. Qt since approximately 4.4 has set the verify callback on both the SSL store and the SSL context. Only the latter is actually needed. This is normally not a problem, but openssl prior to 1.0.2 uses the verify code to find the intermediate certificates for any local certificate that has been set which can lead to verification errors for the local certificate to be emitted. Task-number: QTBUG-33228 Task-number: QTBUG-7200 Task-number: QTBUG-24234 Change-Id: Ie4115e7f7faa1267ea9b807c01b1ed6604c4a16c Reviewed-by: Peter Hartmann Reviewed-by: Thiago Macieira --- tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp index a15daf660a..d19e08178a 100644 --- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp @@ -1924,9 +1924,6 @@ void tst_QSslSocket::verifyMode() loop.exec(); QVERIFY(clientSocket.isEncrypted()); -#if (defined(UBUNTU_ONEIRIC) && defined(__x86_64__)) || defined(Q_OS_WIN) || defined(Q_OS_MAC) - QEXPECT_FAIL("", "QTBUG-24234", Abort); -#endif QVERIFY(server.socket->sslErrors().isEmpty()); } -- cgit v1.2.3 From 55659fb5a4efd3fee813627350287c0b45a6dc9c Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 25 Sep 2013 21:36:15 +0200 Subject: moc: Fix parsing of complex defines defined via command line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since now in Qt5 the moc does full macro substitution, it needs to handle the defines passed is command argument, even if they span over multiple tokens, or if they do not have any token. Example: moc '-DCOMPLEX=QVector' '-DEMPTY=' foo.h [ChangeLog][moc] Fixed passing -D of a macro defined to something more complex than a single identifier. Task-number: QTBUG-33668 Change-Id: Ie8131de215f1659a24af4778d52ee40cda19759f Reviewed-by: Oswald Buddenhagen Reviewed-by: Jędrzej Nowacki --- tests/auto/tools/moc/moc.pro | 3 +++ tests/auto/tools/moc/parse-defines.h | 12 +++++++++++- tests/auto/tools/moc/tst_moc.cpp | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro index 779e992881..9a3fee38f0 100644 --- a/tests/auto/tools/moc/moc.pro +++ b/tests/auto/tools/moc/moc.pro @@ -42,3 +42,6 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 # Ensure that plugin_metadata.h are moc-ed with some extra -M arguments: QMAKE_MOC_OPTIONS += -Muri=com.company.app -Muri=com.company.app.private +# Define macro on the command lines used in parse-defines.h +QMAKE_MOC_OPTIONS += "-DDEFINE_CMDLINE_EMPTY=" "\"-DDEFINE_CMDLINE_SIGNAL=void cmdlineSignal(const QMap &i)\"" + diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h index aaadcef601..35934853f0 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -79,9 +79,16 @@ #define PD_ADD_SUFFIX(x) PD_DEFINE1(x,_SUFFIX) #define PD_DEFINE_ITSELF PD_ADD_SUFFIX(PD_DEFINE_ITSELF) +#ifndef Q_MOC_RUN +// macro defined on the command line (in tst_moc.pro) +#define DEFINE_CMDLINE_EMPTY +#define DEFINE_CMDLINE_SIGNAL void cmdlineSignal(const QMap &i) +#endif + PD_BEGIN_NAMESPACE -class PD_CLASSNAME : public QObject +class DEFINE_CMDLINE_EMPTY PD_CLASSNAME DEFINE_CMDLINE_EMPTY + : public DEFINE_CMDLINE_EMPTY QObject DEFINE_CMDLINE_EMPTY { Q_OBJECT Q_CLASSINFO("TestString", PD_STRINGIFY(PD_CLASSNAME)) @@ -140,6 +147,9 @@ public slots: void PD_DEFINE_ITSELF(int) {} +signals: + DEFINE_CMDLINE_SIGNAL; + }; #undef QString diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 7fae29e5ca..8ce55cbdf5 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -3037,6 +3037,9 @@ void tst_Moc::parseDefines() index = mo->indexOfSlot("PD_DEFINE_ITSELF_SUFFIX(int)"); QVERIFY(index != -1); + + index = mo->indexOfSignal("cmdlineSignal(QMap)"); + QVERIFY(index != -1); } void tst_Moc::preprocessorOnly() -- cgit v1.2.3 From ec77f93b389d0a69af54f278a8bf7c4919fd696c Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 17 Jan 2014 13:28:37 +0100 Subject: Fix crash when constructing a QVector with an empty initializer list. Data::allocate(0) returns a pointer to read-only memory, updating d->size will segfault. The safety check for this exists in all other QVector ctors already. Change-Id: Ida0fe4182de56ee62c7f91e8652cfafbfd7b8410 Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qvector/tst_qvector.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 53caec4a64..59956e33cf 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -2042,6 +2042,9 @@ void tst_QVector::initializeList() QVector> v3; v3 << v1 << (QVector() << val4) << QVector() << v1; QCOMPARE(v3, v2); + + QVector v4({}); + QCOMPARE(v4.size(), 0); #endif } -- cgit v1.2.3 From 7ffce3fb0bb0bd42aa359467d66691ef8a4762df Mon Sep 17 00:00:00 2001 From: Bartosz Brachaczek Date: Sun, 29 Dec 2013 04:01:27 +0100 Subject: Fix cd(), cdUp() QDir member functions docs regarding nonreadable dirs The documentation implies that cd() and cdUp() functions return false if the new directory is not readable, but that is not the case. It is an obvious mistake in the documentation, because cd'ing into a nonreadable directory is perfectly valid. Provided also with a test to verify that cd() actually returns true with nonreadable directories. Change-Id: I4aa3e859b35c64266df510a203574e3701aea77c Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qdir/tst_qdir.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index fbb21e4e9a..96be5065d6 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -193,6 +193,8 @@ private slots: void isReadable(); + void cdNonreadable(); + void cdBelowRoot(); private: @@ -1990,6 +1992,23 @@ void tst_QDir::isReadable() #endif } +void tst_QDir::cdNonreadable() +{ +#ifdef Q_OS_UNIX + if (::getuid() == 0) + QSKIP("Running this test as root doesn't make sense"); + + QDir dir; + QVERIFY(dir.mkdir("nonreadabledir2")); + QVERIFY(0 == ::chmod("nonreadabledir2", S_IWUSR | S_IXUSR)); + QVERIFY(dir.cd("nonreadabledir2")); + QVERIFY(!dir.isReadable()); + QVERIFY(dir.cd("..")); + QVERIFY(0 == ::chmod("nonreadabledir2", S_IRUSR | S_IWUSR | S_IXUSR)); + QVERIFY(dir.rmdir("nonreadabledir2")); +#endif +} + void tst_QDir::cdBelowRoot() { #if defined (Q_OS_UNIX) -- cgit v1.2.3 From bbee8ca485acc6bad7021f4e1cb3e5b8cd32e8fc Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 14 Jan 2014 10:44:24 +0100 Subject: Fix warning in QVariant test. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Values from different enums were compared. Change-Id: I2faf73976e4b24abbdc915e8445256fe7a5be5bd Reviewed-by: Stephen Kelly Reviewed-by: Jędrzej Nowacki --- tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 42570751fc..7512829e09 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -640,7 +640,7 @@ void tst_QGuiVariant::writeToReadFromOldDataStream() dataFileStream.setVersion(QDataStream::Qt_4_9); QVariant readVariant; dataFileStream >> readVariant; - QVERIFY(readVariant.type() == QMetaType::QPolygonF); + QVERIFY(readVariant.userType() == QMetaType::QPolygonF); QCOMPARE(testVariant, readVariant); file.close(); } -- cgit v1.2.3