diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-01-21 17:57:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-21 17:57:54 +0100 |
commit | 46791c08e17740418cc701b8862a980c0f711b87 (patch) | |
tree | bedba63fc48b80c2a2df54ea91c3f35398953aac /tests/auto/corelib | |
parent | b8a38a6737acd670d92197ca5b009590d9fd8a9c (diff) | |
parent | 9033977d3971db5352a2bb51052a723a2ac57a8f (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'tests/auto/corelib')
7 files changed, 42 insertions, 8 deletions
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/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) diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index d19f4379c7..20a31fc98f 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -52,7 +52,7 @@ #include <sys/types.h> #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 and WinRT are an exception to this case, owing to the fact that + // Blackberry OS, Android and WinRT are an exception to this case, owing to the fact that // applications are sandboxed. -#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_WINRT) +#if !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_ANDROID) && !defined(Q_OS_WINRT) const QString base = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); QCOMPARE(QStandardPaths::writableLocation(QStandardPaths::DataLocation), base + "/tst_qstandardpaths"); QCoreApplication::instance()->setOrganizationName("Qt"); 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 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") diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 0e7ac54a86..3bd8a7526e 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2787,6 +2787,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 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<QVector<T>> v3; v3 << v1 << (QVector<T>() << val4) << QVector<T>() << v1; QCOMPARE(v3, v2); + + QVector<T> v4({}); + QCOMPARE(v4.size(), 0); #endif } |