From b60773934dc0231b53e1fde3e5927d969bbf6298 Mon Sep 17 00:00:00 2001 From: Israel Lins Date: Mon, 15 Dec 2014 12:24:42 -0300 Subject: [QDateTime] ISO Time zone designators can be [+-]HH Added support on QDateTime::fromString to read correctly dates on ISO format with Time zone designators at format [+-]HH Change-Id: Ied5c3b7950aee3d0879af0e05398081395c18df5 Reviewed-by: Thiago Macieira Reviewed-by: Mark Brand --- tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 51c3a19d63..ae812bef0e 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -1901,6 +1901,14 @@ void tst_QDateTime::fromStringDateFormat_data() << Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC); QTest::newRow("ISO +00:00") << QString::fromLatin1("1970-01-01T00:12:34+00:00") << Qt::ISODate << QDateTime(QDate(1970, 1, 1), QTime(0, 12, 34), Qt::UTC); + QTest::newRow("ISO -03") << QString::fromLatin1("2014-12-15T12:37:09-03") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC); + QTest::newRow("ISO zzz-03") << QString::fromLatin1("2014-12-15T12:37:09.745-03") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC); + QTest::newRow("ISO -3") << QString::fromLatin1("2014-12-15T12:37:09-3") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9), Qt::UTC); + QTest::newRow("ISO zzz-3") << QString::fromLatin1("2014-12-15T12:37:09.745-3") + << Qt::ISODate << QDateTime(QDate(2014, 12, 15), QTime(15, 37, 9, 745), Qt::UTC); // No time specified - defaults to Qt::LocalTime. QTest::newRow("ISO data3") << QString::fromLatin1("2002-10-01") << Qt::ISODate << QDateTime(QDate(2002, 10, 1), QTime(0, 0, 0, 0), Qt::LocalTime); -- cgit v1.2.3 From 4560ce4ec6196d356810e24c4c76c92a5934c304 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 16 Oct 2014 23:40:34 +0200 Subject: tst_QLockFile: simulate a crash better Instead of leaking the QLockFile instance, which causes leak-checkers to emit false positives, simply call exit(), which doesn't run the destructors, yet doesn't lead to leak-checker warnings. Change-Id: Ia61010671e5218ae412e2bcf873e66255a2c5a99 Reviewed-by: David Faure Reviewed-by: Thiago Macieira --- .../io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp index e4b5d9ab8f..5d1a743dd9 100644 --- a/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp +++ b/tests/auto/corelib/io/qlockfile/qlockfiletesthelper/qlockfile_test_helper.cpp @@ -50,10 +50,10 @@ int main(int argc, char *argv[]) option = QString::fromLocal8Bit(argv[2]); if (option == "-crash") { - QLockFile *lockFile = new QLockFile(lockName); - lockFile->lock(); - // leak the lockFile on purpose, so that the lock remains! - return 0; + QLockFile lockFile(lockName); + lockFile.lock(); + // exit on purpose, so that the lock remains! + exit(0); } else if (option == "-busy") { QLockFile lockFile(lockName); lockFile.lock(); -- cgit v1.2.3 From 75f05781240671f3dcf3ae49a547e72e4282d2f0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 19 Dec 2014 15:01:38 +0100 Subject: Android: Fix QTranslator tests Bundle test data in qrc on Android. Extract it, as the tests expect to find it in the file system. Change-Id: I251eca3c23141a608b1cbac5ee0b7164c068f9b4 Reviewed-by: BogDan Vatra --- .../corelib/kernel/qtranslator/android_testdata.qrc | 7 +++++++ .../auto/corelib/kernel/qtranslator/qtranslator.pro | 4 +++- .../corelib/kernel/qtranslator/tst_qtranslator.cpp | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 tests/auto/corelib/kernel/qtranslator/android_testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc new file mode 100644 index 0000000000..b33995ef21 --- /dev/null +++ b/tests/auto/corelib/kernel/qtranslator/android_testdata.qrc @@ -0,0 +1,7 @@ + + + hellotr_la.qm + msgfmt_from_po.qm + dependencies_la.qm + + diff --git a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro index 41c3dea924..e588f44370 100644 --- a/tests/auto/corelib/kernel/qtranslator/qtranslator.pro +++ b/tests/auto/corelib/kernel/qtranslator/qtranslator.pro @@ -4,4 +4,6 @@ QT = core testlib SOURCES = tst_qtranslator.cpp RESOURCES += qtranslator.qrc -TESTDATA += hellotr_la.qm msgfmt_from_po.qm +android:!android-no-sdk: RESOURCES += android_testdata.qrc +else: TESTDATA += hellotr_la.qm msgfmt_from_po.qm + diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp index 802d649496..077da6fce8 100644 --- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp +++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp @@ -68,6 +68,26 @@ tst_QTranslator::tst_QTranslator() void tst_QTranslator::initTestCase() { +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString sourceDir(":/android_testdata/"); + QDirIterator it(sourceDir, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo sourceFileInfo = it.fileInfo(); + if (!sourceFileInfo.isDir()) { + QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length())); + + if (!destinationFileInfo.exists()) { + QVERIFY(QDir().mkpath(destinationFileInfo.path())); + QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath())); + } + } + } + + QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); +#endif + // chdir into the directory containing our testdata, // to make the code simpler (load testdata via relative paths) QString testdata_dir = QFileInfo(QFINDTESTDATA("hellotr_la.qm")).absolutePath(); -- cgit v1.2.3 From 6a4704cc64648896e556bc385eba995b59fcd6ca Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 10:25:27 +0100 Subject: Android: Fix QByteArray test Include test data in qrc so it can be found on Android. Change-Id: Iaca8422120f1ef842aafeb0cc209cb9fdd70f05f Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qbytearray/android_testdata.qrc | 5 +++++ tests/auto/corelib/tools/qbytearray/qbytearray.pro | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/tools/qbytearray/android_testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qbytearray/android_testdata.qrc b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc new file mode 100644 index 0000000000..5d42f0f627 --- /dev/null +++ b/tests/auto/corelib/tools/qbytearray/android_testdata.qrc @@ -0,0 +1,5 @@ + + + rfc3252.txt + + diff --git a/tests/auto/corelib/tools/qbytearray/qbytearray.pro b/tests/auto/corelib/tools/qbytearray/qbytearray.pro index 8d2efce0be..22104f817f 100644 --- a/tests/auto/corelib/tools/qbytearray/qbytearray.pro +++ b/tests/auto/corelib/tools/qbytearray/qbytearray.pro @@ -10,3 +10,8 @@ mac { OBJECTIVE_SOURCES += tst_qbytearray_mac.mm LIBS += -framework Foundation } + +android: !android-no-sdk { + RESOURCES += \ + android_testdata.qrc +} -- cgit v1.2.3 From 463835b3067594ff2ad3f10a3909ae1a1dec3d13 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 10:46:36 +0100 Subject: Android: Fix QChar test Include test data in qrc when building on Android. Change-Id: Id80623324788dac21bd5ddbeef8108f54d6bc8f7 Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qchar/qchar.pro | 5 +++++ tests/auto/corelib/tools/qchar/testdata.qrc | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/tools/qchar/testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qchar/qchar.pro b/tests/auto/corelib/tools/qchar/qchar.pro index 0738abad3a..a72f16fa49 100644 --- a/tests/auto/corelib/tools/qchar/qchar.pro +++ b/tests/auto/corelib/tools/qchar/qchar.pro @@ -5,3 +5,8 @@ SOURCES = tst_qchar.cpp TESTDATA += data/NormalizationTest.txt DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qchar/testdata.qrc b/tests/auto/corelib/tools/qchar/testdata.qrc new file mode 100644 index 0000000000..7b3fb2461c --- /dev/null +++ b/tests/auto/corelib/tools/qchar/testdata.qrc @@ -0,0 +1,5 @@ + + + data/NormalizationTest.txt + + -- cgit v1.2.3 From 4613e1d2c13025beadf0fd3acaa0a05842307b36 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 11:03:46 +0100 Subject: Android: Fix QCollator test On Android the POSIX implementation of QCollator is used, and this does not support setting other locales than the default. Change-Id: I25d23949341fc555e8be4f6836ae68cc8813cc46 Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qcollator/tst_qcollator.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index f55e2eac42..96c7064d23 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -170,6 +170,11 @@ void tst_QCollator::compare() QCollator collator(locale); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + if (collator.locale() != QLocale()) + QSKIP("Posix implementation of collation only supports default locale"); +#endif + if (numericMode) collator.setNumericMode(true); -- cgit v1.2.3 From 8057ce61d0b2015d47985db50b959ef0a8a2e2c0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 12:02:29 +0100 Subject: Android: Fix QCommandLineParser test Skip the tests that require building and deploying an external command line application, since that's not how we do things on Android, and it's really not very relevant for that platform. Change-Id: I2c1985687e25fb0cf124b1d57c8ba60e37d2ff96 Reviewed-by: BogDan Vatra --- .../corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index 7062d4cad9..ff9b63703c 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -472,6 +472,10 @@ void tst_QCommandLineParser::testVersionOption() #ifdef Q_OS_WINCE QSKIP("Reading and writing to a process is not supported on Qt/CE"); #endif +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Deploying executable applications to file system on Android not supported."); +#endif + QCoreApplication app(empty_argc, empty_argv); QProcess process; process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "--version"); @@ -537,6 +541,9 @@ void tst_QCommandLineParser::testHelpOption() #ifdef Q_OS_WINCE QSKIP("Reading and writing to a process is not supported on Qt/CE"); #endif +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Deploying executable applications to file system on Android not supported."); +#endif QFETCH(QCommandLineParser::SingleDashWordOptionMode, parsingMode); QFETCH(QString, expectedHelpOutput); @@ -581,6 +588,8 @@ void tst_QCommandLineParser::testQuoteEscaping() { #ifdef QT_NO_PROCESS QSKIP("This test requires QProcess support"); +#elif defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QSKIP("Deploying executable applications to file system on Android not supported."); #else QCoreApplication app(empty_argc, empty_argv); QProcess process; -- cgit v1.2.3 From ce40b8b7ef1c7b3c8355233825265f2d49dc4ddd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 5 Jan 2015 12:15:24 +0100 Subject: Android: Fix QCryptographicHash test Include test data in qrc when building on Android. Change-Id: I611ca24fe8764eb709b6ce27e814840ea919d4f1 Reviewed-by: BogDan Vatra --- tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro | 5 +++++ tests/auto/corelib/tools/qcryptographichash/testdata.qrc | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 tests/auto/corelib/tools/qcryptographichash/testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro index f7725ab188..941a068f8e 100644 --- a/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro +++ b/tests/auto/corelib/tools/qcryptographichash/qcryptographichash.pro @@ -5,3 +5,8 @@ SOURCES = tst_qcryptographichash.cpp TESTDATA += data/* DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qcryptographichash/testdata.qrc b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc new file mode 100644 index 0000000000..8f7bcea63c --- /dev/null +++ b/tests/auto/corelib/tools/qcryptographichash/testdata.qrc @@ -0,0 +1,6 @@ + + + data/2c1517dad3678f03917f15849b052fd5.md5 + data/d41d8cd98f00b204e9800998ecf8427e.md5 + + -- cgit v1.2.3 From d511aa906cf4174dc0f551cbd6b2e798c082d7a5 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 15 Oct 2014 12:10:57 +0200 Subject: QVersionNumber: test more version numbers QVersionNumber will gain a small-version-number optimization, which stores sequences of less than 4 (32bit) or 8 (64bit) 8-bit signed segments inside the class instead of a QVector. Make sure the tests cover those cases, too. Change-Id: If1d875c75d284908756b305f767a7218cab5226f Reviewed-by: Keith Gardner Reviewed-by: Thiago Macieira --- .../tools/qversionnumber/tst_qversionnumber.cpp | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index f97b8a4df8..0f7c42c122 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -109,14 +109,35 @@ void tst_QVersionNumber::singleInstanceData() QTest::newRow("0.1.2alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2alpha") << 5 << false; QTest::newRow("0.1.2-alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2-alpha") << 5 << false; QTest::newRow("0.1.2.alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2.alpha") << 5 << false; + QTest::newRow("0.1.2.3alpha") << (QVector() << 0 << 1 << 2 << 3) << QVersionNumber(QVector() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3alpha") << 7 << false; + QTest::newRow("0.1.2.3.alpha") << (QVector() << 0 << 1 << 2 << 3) << QVersionNumber(QVector() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3.alpha") << 7 << false; QTest::newRow("0.1.2.3.4.alpha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4.alpha") << 9 << false; QTest::newRow("0.1.2.3.4 alpha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alpha") << 9 << false; QTest::newRow("0.1.2.3.4 alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alp ha") << 9 << false; QTest::newRow("0.1.2.3.4alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alp ha") << 9 << false; QTest::newRow("0.1.2.3.4alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alpha ") << 9 << false; + QTest::newRow("0.1.2.3.4.5alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5) << QStringLiteral("0.1.2.3.4.5") << QStringLiteral("0.1.2.3.4.5alpha ") << 11 << false; + QTest::newRow("0.1.2.3.4.5.6alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QStringLiteral("0.1.2.3.4.5.6") << QStringLiteral("0.1.2.3.4.5.6alpha ") << 13 << false; + QTest::newRow("0.1.2.3.4.5.6.7alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QStringLiteral("0.1.2.3.4.5.6.7") << QStringLiteral("0.1.2.3.4.5.6.7alpha ") << 15 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alpha ") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8.alpha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8.alpha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8 alpha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alpha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8 alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alp ha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alp ha") << 17 << false; QTest::newRow("10.09") << (QVector() << 10 << 9) << QVersionNumber(QVector() << 10 << 9) << QStringLiteral("10.9") << QStringLiteral("10.09") << 5 << false; QTest::newRow("10.0x") << (QVector() << 10 << 0) << QVersionNumber(QVector() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0x") << 4 << false; QTest::newRow("10.0xTest") << (QVector() << 10 << 0) << QVersionNumber(QVector() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0xTest") << 4 << false; + QTest::newRow("127.09") << (QVector() << 127 << 9) << QVersionNumber(QVector() << 127 << 9) << QStringLiteral("127.9") << QStringLiteral("127.09") << 6 << false; + QTest::newRow("127.0x") << (QVector() << 127 << 0) << QVersionNumber(QVector() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0x") << 5 << false; + QTest::newRow("127.0xTest") << (QVector() << 127 << 0) << QVersionNumber(QVector() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0xTest") << 5 << false; + QTest::newRow("128.09") << (QVector() << 128 << 9) << QVersionNumber(QVector() << 128 << 9) << QStringLiteral("128.9") << QStringLiteral("128.09") << 6 << false; + QTest::newRow("128.0x") << (QVector() << 128 << 0) << QVersionNumber(QVector() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0x") << 5 << false; + QTest::newRow("128.0xTest") << (QVector() << 128 << 0) << QVersionNumber(QVector() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0xTest") << 5 << false; +} + +namespace UglyOperator { +// ugh, but the alternative (operator <<) is even worse... +static inline QVector operator+(QVector v, int i) { v.push_back(i); return qMove(v); } } void tst_QVersionNumber::comparisonData() @@ -141,6 +162,7 @@ void tst_QVersionNumber::comparisonData() QTest::newRow("1.0, 1.0") << QVersionNumber(1, 0) << QVersionNumber(1, 0) << true << false << false << true << false << true << 0 << true << QVersionNumber(1, 0); QTest::newRow("1, 1.0") << QVersionNumber(1) << QVersionNumber(1, 0) << false << true << true << true << false << false << -1 << true << QVersionNumber(1); QTest::newRow("1.0, 1") << QVersionNumber(1, 0) << QVersionNumber(1) << false << true << false << false << true << true << 1 << false << QVersionNumber(1); + QTest::newRow("0.1.2, 0.1") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 1); QTest::newRow("0.1, 0.1.2") << QVersionNumber(0, 1) << QVersionNumber(0, 1, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 1); QTest::newRow("0.1.2, 0.1.2") << QVersionNumber(0, 1, 2) << QVersionNumber(0, 1, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 1, 2); @@ -152,6 +174,44 @@ void tst_QVersionNumber::comparisonData() QTest::newRow("0.-1, 0.1") << QVersionNumber(0, -1) << QVersionNumber(0, 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(0); QTest::newRow("0.-1, 0") << QVersionNumber(0, -1) << QVersionNumber(0) << false << true << true << true << false << false << -1 << false << QVersionNumber(0); QTest::newRow("0, 0.-1") << QVersionNumber(0) << QVersionNumber(0, -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(0); + + QTest::newRow("0.127.2, 0.127") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 127); + QTest::newRow("0.127, 0.127.2") << QVersionNumber(0, 127) << QVersionNumber(0, 127, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 127); + QTest::newRow("0.127.2, 0.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(0, 127, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 127, 2); + QTest::newRow("0.127.2, 127.127.2") << QVersionNumber(0, 127, 2) << QVersionNumber(127, 127, 2) << false << true << true << true << false << false << -127 << false << QVersionNumber(); + QTest::newRow("127.127.2, 0.127.2") << QVersionNumber(127, 127, 2) << QVersionNumber(0, 127, 2) << false << true << false << false << true << true << 127 << false << QVersionNumber(); + QTest::newRow("127, -128") << QVersionNumber(127) << QVersionNumber(-128) << false << true << false << false << true << true << 255 << false << QVersionNumber(); + QTest::newRow("-128, 127") << QVersionNumber(-128) << QVersionNumber(127) << false << true << true << true << false << false << -255 << false << QVersionNumber(); + QTest::newRow("0.127, 0.-128") << QVersionNumber(0, 127) << QVersionNumber(0, -128) << false << true << false << false << true << true << 255 << false << QVersionNumber(0); + QTest::newRow("0.-128, 0.127") << QVersionNumber(0, -128) << QVersionNumber(0, 127) << false << true << true << true << false << false << -255 << false << QVersionNumber(0); + QTest::newRow("0.-128, 0") << QVersionNumber(0, -128) << QVersionNumber(0) << false << true << true << true << false << false << -128 << false << QVersionNumber(0); + QTest::newRow("0, 0.-128") << QVersionNumber(0) << QVersionNumber(0, -128) << false << true << false << false << true << true << 128 << true << QVersionNumber(0); + + QTest::newRow("0.128.2, 0.128") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128) << false << true << false << false << true << true << 2 << false << QVersionNumber(0, 128); + QTest::newRow("0.128, 0.128.2") << QVersionNumber(0, 128) << QVersionNumber(0, 128, 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(0, 128); + QTest::newRow("0.128.2, 0.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(0, 128, 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(0, 128, 2); + QTest::newRow("0.128.2, 128.128.2") << QVersionNumber(0, 128, 2) << QVersionNumber(128, 128, 2) << false << true << true << true << false << false << -128 << false << QVersionNumber(); + QTest::newRow("128.128.2, 0.128.2") << QVersionNumber(128, 128, 2) << QVersionNumber(0, 128, 2) << false << true << false << false << true << true << 128 << false << QVersionNumber(); + QTest::newRow("128, -129") << QVersionNumber(128) << QVersionNumber(-129) << false << true << false << false << true << true << 257 << false << QVersionNumber(); + QTest::newRow("-129, 128") << QVersionNumber(-129) << QVersionNumber(128) << false << true << true << true << false << false << -257 << false << QVersionNumber(); + QTest::newRow("0.128, 0.-129") << QVersionNumber(0, 128) << QVersionNumber(0, -129) << false << true << false << false << true << true << 257 << false << QVersionNumber(0); + QTest::newRow("0.-129, 0.128") << QVersionNumber(0, -129) << QVersionNumber(0, 128) << false << true << true << true << false << false << -257 << false << QVersionNumber(0); + QTest::newRow("0.-129, 0") << QVersionNumber(0, -129) << QVersionNumber(0) << false << true << true << true << false << false << -129 << false << QVersionNumber(0); + QTest::newRow("0, 0.-129") << QVersionNumber(0) << QVersionNumber(0, -129) << false << true << false << false << true << true << 129 << true << QVersionNumber(0); + + const QVector common = QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6; + using namespace UglyOperator; + QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0 + 1); + QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + 1 + 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(common + 0 + 1); + QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << true << false << false << true << false << true << 0 << true << QVersionNumber(common + 0 + 1 + 2); + QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.1.1.2") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 1 + 1 + 2) << false << true << true << true << false << false << -1 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.1.1.2, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 1 + 1 + 2) << QVersionNumber(common + 0 + 1 + 2) << false << true << false << false << true << true << 1 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.1, 0.1.2.3.4.5.6.-1") << QVersionNumber(common + 1) << QVersionNumber(common + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.-1, 0.1.2.3.4.5.6.1") << QVersionNumber(common + -1) << QVersionNumber(common + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common); + QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0); + QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0 + 1) << false << true << true << true << false << false << -2 << false << QVersionNumber(common + 0); + QTest::newRow("0.1.2.3.4.5.6.0.-1, 0.1.2.3.4.5.6.0") << QVersionNumber(common + 0 + -1) << QVersionNumber(common + 0) << false << true << true << true << false << false << -1 << false << QVersionNumber(common + 0); + QTest::newRow("0.1.2.3.4.5.6.0, 0.1.2.3.4.5.6.0.-1") << QVersionNumber(common + 0) << QVersionNumber(common + 0 + -1) << false << true << false << false << true << true << 1 << true << QVersionNumber(common + 0); } void tst_QVersionNumber::initTestCase() -- cgit v1.2.3 From 7ad75cd8ef7e95bba3cfc694b7baffbc445bd2b0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 19 Dec 2014 14:34:46 +0100 Subject: Android: Fix QTemporaryFile tests Fixed a few instances of files that should be deployed to the file system. The way we do this on Android is via qrc. We also need a special case for the resources/test.txt, because QFINDTESTDATA will find this in qrc, but that's not the one we are looking for. Change-Id: I7097e8b7795b3a8fd483adad090208f295478412 Reviewed-by: BogDan Vatra --- .../corelib/io/qtemporaryfile/android_testdata.qrc | 6 +++ .../corelib/io/qtemporaryfile/qtemporaryfile.pro | 6 ++- .../io/qtemporaryfile/tst_qtemporaryfile.cpp | 45 ++++++++++++++++++---- 3 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc new file mode 100644 index 0000000000..f30290c262 --- /dev/null +++ b/tests/auto/corelib/io/qtemporaryfile/android_testdata.qrc @@ -0,0 +1,6 @@ + + + tst_qtemporaryfile.cpp + resources/test.txt + + diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index 8a91340e5f..c16a729ad0 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -5,4 +5,8 @@ QT = core testlib SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -RESOURCES += qtemporaryfile.qrc \ No newline at end of file +RESOURCES += qtemporaryfile.qrc + +android:!android-no-sdk { + RESOURCES += android_testdata.qrc +} diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp index a08a0ae777..29a3c4e18a 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -92,6 +92,24 @@ void tst_QTemporaryFile::initTestCase() // For QTBUG_4796 QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); + +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + QString sourceDir(":/android_testdata/"); + QDirIterator it(sourceDir, QDirIterator::Subdirectories); + while (it.hasNext()) { + it.next(); + + QFileInfo sourceFileInfo = it.fileInfo(); + if (!sourceFileInfo.isDir()) { + QFileInfo destinationFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QLatin1Char('/') + sourceFileInfo.filePath().mid(sourceDir.length())); + + if (!destinationFileInfo.exists()) { + QVERIFY(QDir().mkpath(destinationFileInfo.path())); + QVERIFY(QFile::copy(sourceFileInfo.filePath(), destinationFileInfo.filePath())); + } + } + } +#endif } void tst_QTemporaryFile::cleanupTestCase() @@ -253,20 +271,21 @@ void tst_QTemporaryFile::autoRemove() QVERIFY(!QFile::exists(fileName)); } +struct ChdirOnReturn +{ + ChdirOnReturn(const QString& d) : dir(d) {} + ~ChdirOnReturn() { + QDir::setCurrent(dir); + } + QString dir; +}; + void tst_QTemporaryFile::nonWritableCurrentDir() { #ifdef Q_OS_UNIX if (::geteuid() == 0) QSKIP("not valid running this test as root"); - struct ChdirOnReturn - { - ChdirOnReturn(const QString& d) : dir(d) {} - ~ChdirOnReturn() { - QDir::setCurrent(dir); - } - QString dir; - }; ChdirOnReturn cor(QDir::currentPath()); #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) @@ -443,6 +462,12 @@ void tst_QTemporaryFile::rename() void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX + +# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + ChdirOnReturn cor(QDir::currentPath()); + QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); +# endif + const QByteArray sourceFile = QFile::encodeName(QFINDTESTDATA(__FILE__)); QVERIFY(!sourceFile.isEmpty()); // Test this on Unix only @@ -646,7 +671,11 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn("valid"); QTest::addColumn("content"); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) + const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); +#else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); +#endif QTest::newRow("nativeFile") << nativeFilePath << (qint64)-1 << false << QByteArray(); QTest::newRow("nativeFileWithPos") << nativeFilePath << (qint64)5 << false << QByteArray(); -- cgit v1.2.3 From 099db090d5772439f13e7c0bfd8268923db5a87f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 13:39:54 +0100 Subject: Android: Fix QTextBoundaryFinder test Include test data on Android. Change-Id: I35c17618d84822df126fe3462a00d3d49b1377c8 Reviewed-by: BogDan Vatra --- .../corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro | 5 +++++ tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc | 8 ++++++++ 2 files changed, 13 insertions(+) create mode 100644 tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro index 498d8f9c40..29b9854ebb 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro +++ b/tests/auto/corelib/tools/qtextboundaryfinder/qtextboundaryfinder.pro @@ -5,3 +5,8 @@ SOURCES = tst_qtextboundaryfinder.cpp TESTDATA += data DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc new file mode 100644 index 0000000000..0cc4ccaa57 --- /dev/null +++ b/tests/auto/corelib/tools/qtextboundaryfinder/testdata.qrc @@ -0,0 +1,8 @@ + + + data/GraphemeBreakTest.txt + data/LineBreakTest.txt + data/SentenceBreakTest.txt + data/WordBreakTest.txt + + -- cgit v1.2.3 From d30c446d35ae404f5a67421ac59e6f0997123321 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 9 Jan 2015 13:26:06 +0100 Subject: Android: Fix QDataStream test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include test data on Android. Change-Id: Ic0890495c0bf8d2e38595585226a03073b043d57 Reviewed-by: Tony Sarajärvi Reviewed-by: BogDan Vatra --- tests/auto/corelib/io/qdatastream/qdatastream.pro | 5 +++++ tests/auto/corelib/io/qdatastream/testdata.qrc | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 tests/auto/corelib/io/qdatastream/testdata.qrc (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qdatastream/qdatastream.pro b/tests/auto/corelib/io/qdatastream/qdatastream.pro index 25c29b83ee..9ab2b0948d 100644 --- a/tests/auto/corelib/io/qdatastream/qdatastream.pro +++ b/tests/auto/corelib/io/qdatastream/qdatastream.pro @@ -5,3 +5,8 @@ SOURCES = tst_qdatastream.cpp TESTDATA += datastream.q42 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +android: !android-no-sdk { + RESOURCES += \ + testdata.qrc +} diff --git a/tests/auto/corelib/io/qdatastream/testdata.qrc b/tests/auto/corelib/io/qdatastream/testdata.qrc new file mode 100644 index 0000000000..fb63cb3438 --- /dev/null +++ b/tests/auto/corelib/io/qdatastream/testdata.qrc @@ -0,0 +1,5 @@ + + + datastream.q42 + + -- cgit v1.2.3