diff options
Diffstat (limited to 'tests/auto/corelib/io/qtemporaryfile')
-rw-r--r-- | tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro | 4 | ||||
-rw-r--r-- | tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp | 44 |
2 files changed, 21 insertions, 27 deletions
diff --git a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro index c16a729ad0..a89e5c66ff 100644 --- a/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro +++ b/tests/auto/corelib/io/qtemporaryfile/qtemporaryfile.pro @@ -1,12 +1,10 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtemporaryfile QT = core testlib SOURCES = tst_qtemporaryfile.cpp TESTDATA += tst_qtemporaryfile.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 RESOURCES += qtemporaryfile.qrc -android:!android-no-sdk { +android { 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 7fdc8fd44c..8ebde627df 100644 --- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp +++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** 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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company 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 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -102,7 +97,7 @@ void tst_QTemporaryFile::initTestCase() QVERIFY(QDir("test-XXXXXX").exists() || QDir().mkdir("test-XXXXXX")); QCoreApplication::setApplicationName("tst_qtemporaryfile"); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString sourceDir(":/android_testdata/"); QDirIterator it(sourceDir, QDirIterator::Subdirectories); while (it.hasNext()) { @@ -336,7 +331,7 @@ void tst_QTemporaryFile::nonWritableCurrentDir() ChdirOnReturn cor(QDir::currentPath()); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QDir::setCurrent("/data"); #else QDir::setCurrent("/home"); @@ -512,7 +507,7 @@ void tst_QTemporaryFile::renameFdLeak() { #ifdef Q_OS_UNIX -# if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +# if defined(Q_OS_ANDROID) ChdirOnReturn cor(QDir::currentPath()); QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); # endif @@ -586,15 +581,16 @@ void tst_QTemporaryFile::keepOpenMode() { QTemporaryFile file; QVERIFY(file.open()); + QCOMPARE(file.openMode(), QIODevice::ReadWrite); QCOMPARE(file.write(data), (qint64)data.size()); QVERIFY(file.rename("temporary-file.txt")); QVERIFY(((QFile &)file).open(QIODevice::ReadOnly)); - QVERIFY(QIODevice::ReadOnly == file.openMode()); + QCOMPARE(file.openMode(), QIODevice::ReadOnly); QCOMPARE(file.readAll(), data); QVERIFY(((QFile &)file).open(QIODevice::WriteOnly)); - QVERIFY(QIODevice::WriteOnly == file.openMode()); + QCOMPARE(file.openMode(), QIODevice::WriteOnly); } } @@ -720,7 +716,7 @@ void tst_QTemporaryFile::createNativeFile_data() QTest::addColumn<bool>("valid"); QTest::addColumn<QByteArray>("content"); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) const QString nativeFilePath = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + QStringLiteral("/resources/test.txt"); #else const QString nativeFilePath = QFINDTESTDATA("resources/test.txt"); @@ -748,7 +744,7 @@ void tst_QTemporaryFile::createNativeFile() f.seek(currentPos); } QTemporaryFile *tempFile = QTemporaryFile::createNativeFile(f); - QVERIFY(valid == (bool)tempFile); + QCOMPARE(valid, (bool)tempFile); if (currentPos != -1) QCOMPARE(currentPos, f.pos()); if (valid) { |