Tests: Always verify whether QTemporaryDir/File creation succeeded.
Use QVERIFY2() with QTemporaryDir/File::errorString() consistently. Attempt to catch issues like the below warning and follow-up issues. QSYSTEM: tst_QFiledialog::clearLineEdit() QFileSystemWatcher: FindNextChangeNotification failed for "C:\Users\qt\_____aaaaaaaaaaaaaaaaaaaaaa" (Access is denied.) Task-number: QTBUG-47370 Change-Id: I58a6e87c502627e976efa62ad73c912f3b2d49fa Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
This commit is contained in:
parent
4accd865c2
commit
9facf1be9b
tests/auto
corelib
io
qdir
qfile
qfileinfo
qfilesystemwatcher
qlockfile
qsavefile
qsettings
qstandardpaths
qstorageinfo
qtextstream
mimetypes/qmimedatabase
dbus/qdbusmarshall
gui
image
painting/qpdfwriter
network/access
qabstractnetworkcache
qnetworkdiskcache
qnetworkreply
other/languagechange
testlib/selftests
tools/uic
widgets/dialogs
qfiledialog
qfiledialog2
qfilesystemmodel
@ -845,8 +845,8 @@ void tst_QDir::entryListTimedSort()
|
||||
QTemporaryFile aFile(entrylistPath + "A-XXXXXX.qws");
|
||||
QTemporaryFile bFile(entrylistPath + "B-XXXXXX.qws");
|
||||
|
||||
QVERIFY(aFile.open());
|
||||
QVERIFY(bFile.open());
|
||||
QVERIFY2(aFile.open(), qPrintable(aFile.errorString()));
|
||||
QVERIFY2(bFile.open(), qPrintable(bFile.errorString()));
|
||||
{
|
||||
QProcess p;
|
||||
p.start(touchBinary, QStringList() << "-t" << "201306021513" << aFile.fileName());
|
||||
|
@ -392,7 +392,7 @@ tst_QFile::tst_QFile() : m_oldDir(QDir::currentPath())
|
||||
|
||||
void tst_QFile::initTestCase()
|
||||
{
|
||||
QVERIFY(m_temporaryDir.isValid());
|
||||
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
|
||||
m_stdinProcessDir = QFINDTESTDATA("stdinprocess");
|
||||
QVERIFY(!m_stdinProcessDir.isEmpty());
|
||||
m_testSourceFile = QFINDTESTDATA("tst_qfile.cpp");
|
||||
|
@ -317,7 +317,7 @@ static QFileInfoPrivate* getPrivate(QFileInfo &info)
|
||||
void tst_QFileInfo::copy()
|
||||
{
|
||||
QTemporaryFile t;
|
||||
t.open();
|
||||
QVERIFY2(t.open(), qPrintable(t.errorString()));
|
||||
QFileInfo info(t.fileName());
|
||||
QVERIFY(info.exists());
|
||||
|
||||
@ -612,7 +612,7 @@ void tst_QFileInfo::canonicalPath()
|
||||
{
|
||||
QTemporaryFile tempFile;
|
||||
tempFile.setAutoRemove(true);
|
||||
tempFile.open();
|
||||
QVERIFY2(tempFile.open(), qPrintable(tempFile.errorString()));
|
||||
QFileInfo fi(tempFile.fileName());
|
||||
QCOMPARE(fi.canonicalPath(), QFileInfo(QDir::tempPath()).canonicalFilePath());
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ void tst_QFileSystemWatcher::basicTest()
|
||||
|
||||
// create test file
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY(temporaryDirectory.isValid());
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
QFile testFile(temporaryDirectory.path() + QLatin1Char('/') + testFileName);
|
||||
QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Truncate));
|
||||
testFile.write(QByteArray("hello"));
|
||||
@ -263,7 +263,7 @@ void tst_QFileSystemWatcher::watchDirectory()
|
||||
QFETCH(QString, backend);
|
||||
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY(temporaryDirectory.isValid());
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
|
||||
QDir temporaryDir(temporaryDirectory.path());
|
||||
const QString testDirName = QStringLiteral("testDir");
|
||||
@ -498,7 +498,7 @@ void tst_QFileSystemWatcher::watchFileAndItsDirectory()
|
||||
QFETCH(QString, backend);
|
||||
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY(temporaryDirectory.isValid());
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
|
||||
QDir temporaryDir(temporaryDirectory.path());
|
||||
const QString testDirName = QStringLiteral("testDir");
|
||||
@ -605,7 +605,7 @@ void tst_QFileSystemWatcher::nonExistingFile()
|
||||
void tst_QFileSystemWatcher::removeFileAndUnWatch()
|
||||
{
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY(temporaryDirectory.isValid());
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
|
||||
const QString filename = temporaryDirectory.path() + QStringLiteral("/foo.txt");
|
||||
|
||||
@ -664,7 +664,7 @@ void tst_QFileSystemWatcher::QTBUG2331()
|
||||
QFETCH(QString, backend);
|
||||
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY(temporaryDirectory.isValid());
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
QFileSystemWatcher watcher;
|
||||
watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend);
|
||||
QVERIFY(watcher.addPath(temporaryDirectory.path()));
|
||||
@ -724,7 +724,8 @@ void tst_QFileSystemWatcher::signalsEmittedAfterFileMoved()
|
||||
{
|
||||
const int fileCount = 10;
|
||||
QTemporaryDir temporaryDirectory(m_tempDirPattern);
|
||||
QVERIFY(temporaryDirectory.isValid());
|
||||
QVERIFY2(temporaryDirectory.isValid(), qPrintable(temporaryDirectory.errorString()));
|
||||
|
||||
QDir testDir(temporaryDirectory.path());
|
||||
QVERIFY(testDir.mkdir("movehere"));
|
||||
QString movePath = testDir.filePath("movehere");
|
||||
|
@ -80,6 +80,7 @@ void tst_QLockFile::initTestCase()
|
||||
#elif defined(QT_NO_PROCESS)
|
||||
QSKIP("This test requires QProcess support");
|
||||
#else
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
// chdir to our testdata path and execute helper apps relative to that.
|
||||
QString testdata_dir = QFileInfo(QFINDTESTDATA("qlockfiletesthelper")).absolutePath();
|
||||
QVERIFY2(QDir::setCurrent(testdata_dir), qPrintable("Could not chdir to " + testdata_dir));
|
||||
|
@ -99,7 +99,7 @@ static inline QByteArray msgCannotOpen(const QFileDevice &f)
|
||||
void tst_QSaveFile::transactionalWrite()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QFile::remove(targetFile);
|
||||
QSaveFile file(targetFile);
|
||||
@ -134,7 +134,7 @@ void tst_QSaveFile::saveTwice()
|
||||
// Check that we can reuse a QSaveFile object
|
||||
// (and test the case of an existing target file)
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QSaveFile file(targetFile);
|
||||
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
|
||||
@ -153,7 +153,7 @@ void tst_QSaveFile::saveTwice()
|
||||
void tst_QSaveFile::textStreamManualFlush()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QSaveFile file(targetFile);
|
||||
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
|
||||
@ -174,7 +174,7 @@ void tst_QSaveFile::textStreamManualFlush()
|
||||
void tst_QSaveFile::textStreamAutoFlush()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QSaveFile file(targetFile);
|
||||
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
|
||||
@ -206,7 +206,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnDir()
|
||||
#endif
|
||||
QFETCH(bool, directWriteFallback);
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
QVERIFY(QFile(dir.path()).setPermissions(QFile::ReadOwner | QFile::ExeOwner));
|
||||
PermissionRestorer permissionRestorer(dir.path());
|
||||
|
||||
@ -264,7 +264,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
|
||||
#endif
|
||||
// Setup an existing but readonly file
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QFile file(targetFile);
|
||||
PermissionRestorer permissionRestorer(targetFile);
|
||||
@ -285,7 +285,7 @@ void tst_QSaveFile::transactionalWriteNoPermissionsOnFile()
|
||||
void tst_QSaveFile::transactionalWriteCanceled()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QFile::remove(targetFile);
|
||||
QSaveFile file(targetFile);
|
||||
@ -313,7 +313,7 @@ void tst_QSaveFile::transactionalWriteErrorRenaming()
|
||||
QSKIP("Test is not applicable with root privileges");
|
||||
#endif
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
const QString targetFile = dir.path() + QString::fromLatin1("/outfile");
|
||||
QSaveFile file(targetFile);
|
||||
QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
|
||||
@ -347,7 +347,7 @@ void tst_QSaveFile::symlink()
|
||||
#ifdef Q_OS_UNIX
|
||||
QByteArray someData = "some data";
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
|
||||
const QString targetFile = dir.path() + QLatin1String("/outfile");
|
||||
const QString linkFile = dir.path() + QLatin1String("/linkfile");
|
||||
@ -400,7 +400,7 @@ void tst_QSaveFile::symlink()
|
||||
|
||||
// link to a link in another directory
|
||||
QTemporaryDir dir2;
|
||||
QVERIFY(dir2.isValid());
|
||||
QVERIFY2(dir2.isValid(), qPrintable(dir2.errorString()));
|
||||
|
||||
const QString linkFile2 = dir2.path() + QLatin1String("/linkfile");
|
||||
QVERIFY(QFile::link(linkFile, linkFile2));
|
||||
@ -458,7 +458,7 @@ void tst_QSaveFile::symlink()
|
||||
void tst_QSaveFile::directory()
|
||||
{
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
|
||||
const QString subdir = dir.path() + QLatin1String("/subdir");
|
||||
QVERIFY(QDir(dir.path()).mkdir(QStringLiteral("subdir")));
|
||||
|
@ -3331,7 +3331,7 @@ void tst_QSettings::dontReorderIniKeysNeedlessly()
|
||||
QString outFileName2;
|
||||
|
||||
QTemporaryFile outFile;
|
||||
outFile.open();
|
||||
QVERIFY2(outFile.open(), qPrintable(outFile.errorString()));
|
||||
outFile.write(contentsBefore);
|
||||
outFileName = outFile.fileName();
|
||||
outFile.close();
|
||||
|
@ -56,6 +56,7 @@ class tst_qstandardpaths : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void dump();
|
||||
void testDefaultLocations();
|
||||
void testCustomLocations();
|
||||
@ -128,6 +129,14 @@ static const char * const enumNames[MaxStandardLocation + 1 - int(QStandardPaths
|
||||
"AppConfigLocation"
|
||||
};
|
||||
|
||||
void tst_qstandardpaths::initTestCase()
|
||||
{
|
||||
QVERIFY2(m_localConfigTempDir.isValid(), qPrintable(m_localConfigTempDir.errorString()));
|
||||
QVERIFY2(m_globalConfigTempDir.isValid(), qPrintable(m_globalConfigTempDir.errorString()));
|
||||
QVERIFY2(m_localAppTempDir.isValid(), qPrintable(m_localAppTempDir.errorString()));
|
||||
QVERIFY2(m_globalAppTempDir.isValid(), qPrintable(m_globalAppTempDir.errorString()));
|
||||
}
|
||||
|
||||
void tst_qstandardpaths::dump()
|
||||
{
|
||||
#ifdef Q_XDG_PLATFORM
|
||||
|
@ -153,7 +153,7 @@ void tst_QStorageInfo::storageList()
|
||||
void tst_QStorageInfo::tempFile()
|
||||
{
|
||||
QTemporaryFile file;
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
|
||||
QStorageInfo storage1(file.fileName());
|
||||
#ifdef Q_OS_LINUX
|
||||
@ -174,7 +174,7 @@ void tst_QStorageInfo::tempFile()
|
||||
void tst_QStorageInfo::caching()
|
||||
{
|
||||
QTemporaryFile file;
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
|
||||
QStorageInfo storage1(file.fileName());
|
||||
#ifdef Q_OS_LINUX
|
||||
|
@ -258,6 +258,7 @@ tst_QTextStream::tst_QTextStream()
|
||||
|
||||
void tst_QTextStream::initTestCase()
|
||||
{
|
||||
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
|
||||
QVERIFY(!m_rfc3261FilePath.isEmpty());
|
||||
QVERIFY(!m_shiftJisFilePath.isEmpty());
|
||||
|
||||
|
@ -120,6 +120,7 @@ tst_QMimeDatabase::tst_QMimeDatabase()
|
||||
|
||||
void tst_QMimeDatabase::initTestCase()
|
||||
{
|
||||
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
m_localMimeDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/mime";
|
||||
if (QDir(m_localMimeDir).exists()) {
|
||||
|
@ -150,7 +150,11 @@ int tst_QDBusMarshall::fileDescriptorForTest()
|
||||
{
|
||||
if (!tempFile.isOpen()) {
|
||||
tempFile.setFileTemplate(QDir::tempPath() + "/qdbusmarshalltestXXXXXX.tmp");
|
||||
tempFile.open();
|
||||
if (!tempFile.open()) {
|
||||
qWarning("%s: Cannot create temporary file: %s", Q_FUNC_INFO,
|
||||
qPrintable(tempFile.errorString()));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return tempFile.handle();
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ void tst_QImageReader::initTestCase()
|
||||
prefix = QFINDTESTDATA("images/");
|
||||
if (prefix.isEmpty())
|
||||
QFAIL("Can't find images directory!");
|
||||
QVERIFY(m_temporaryDir.isValid());
|
||||
QVERIFY2(m_temporaryDir.isValid(), qPrintable(m_temporaryDir.errorString()));
|
||||
}
|
||||
|
||||
void tst_QImageReader::cleanupTestCase()
|
||||
|
@ -416,7 +416,7 @@ void tst_QImageWriter::testCanWrite()
|
||||
{
|
||||
// check if canWrite won't leave an empty file
|
||||
QTemporaryDir dir;
|
||||
QVERIFY(dir.isValid());
|
||||
QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
|
||||
QString fileName(dir.path() + QLatin1String("/001.garble"));
|
||||
QVERIFY(!QFileInfo(fileName).exists());
|
||||
QImageWriter writer(fileName);
|
||||
@ -524,7 +524,7 @@ void tst_QImageWriter::saveToTemporaryFile()
|
||||
{
|
||||
// 1) Via QImageWriter's API, with a standard temp file name
|
||||
QTemporaryFile file;
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QImageWriter writer(&file, "PNG");
|
||||
if (writer.canWrite())
|
||||
QVERIFY(writer.write(image));
|
||||
@ -538,7 +538,7 @@ void tst_QImageWriter::saveToTemporaryFile()
|
||||
{
|
||||
// 2) Via QImage's API, with a standard temp file name
|
||||
QTemporaryFile file;
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QVERIFY(image.save(&file, "PNG"));
|
||||
file.reset();
|
||||
QImage tmp;
|
||||
@ -548,7 +548,7 @@ void tst_QImageWriter::saveToTemporaryFile()
|
||||
{
|
||||
// 3) Via QImageWriter's API, with a named temp file
|
||||
QTemporaryFile file("tempXXXXXX");
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QImageWriter writer(&file, "PNG");
|
||||
QVERIFY(writer.write(image));
|
||||
#if defined(Q_OS_WINCE)
|
||||
@ -559,7 +559,7 @@ void tst_QImageWriter::saveToTemporaryFile()
|
||||
{
|
||||
// 4) Via QImage's API, with a named temp file
|
||||
QTemporaryFile file("tempXXXXXX");
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QVERIFY(image.save(&file, "PNG"));
|
||||
file.reset();
|
||||
QImage tmp;
|
||||
|
@ -50,8 +50,7 @@ private slots:
|
||||
void tst_QPdfWriter::basics()
|
||||
{
|
||||
QTemporaryFile file;
|
||||
if (!file.open())
|
||||
QSKIP("Couldn't open temp file!");
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QPdfWriter writer(file.fileName());
|
||||
|
||||
QCOMPARE(writer.title(), QString());
|
||||
@ -150,8 +149,7 @@ void tst_QPdfWriter::testPageMetrics()
|
||||
QSizeF sizeMMf = QSizeF(widthMMf, heightMMf);
|
||||
|
||||
QTemporaryFile file;
|
||||
if (!file.open())
|
||||
QSKIP("Couldn't open temp file!");
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QPdfWriter writer(file.fileName());
|
||||
QCOMPARE(writer.pageLayout().orientation(), QPageLayout::Portrait);
|
||||
|
||||
|
@ -294,6 +294,7 @@ void tst_QAbstractNetworkCache::runTest()
|
||||
|
||||
QNetworkAccessManager manager;
|
||||
NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
|
||||
QVERIFY2(diskCache->tempDir.isValid(), qPrintable(diskCache->tempDir.errorString()));
|
||||
manager.setCache(diskCache);
|
||||
QCOMPARE(diskCache->gotData, false);
|
||||
|
||||
@ -344,6 +345,7 @@ void tst_QAbstractNetworkCache::checkSynchronous()
|
||||
|
||||
QNetworkAccessManager manager;
|
||||
NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
|
||||
QVERIFY2(diskCache->tempDir.isValid(), qPrintable(diskCache->tempDir.errorString()));
|
||||
manager.setCache(diskCache);
|
||||
QCOMPARE(diskCache->gotData, false);
|
||||
|
||||
@ -392,6 +394,7 @@ void tst_QAbstractNetworkCache::deleteCache()
|
||||
{
|
||||
QNetworkAccessManager manager;
|
||||
NetworkDiskCache *diskCache = new NetworkDiskCache(&manager);
|
||||
QVERIFY2(diskCache->tempDir.isValid(), qPrintable(diskCache->tempDir.errorString()));
|
||||
manager.setCache(diskCache);
|
||||
|
||||
QString url = "httpcachetest_cachecontrol.cgi?max-age=1000";
|
||||
|
@ -563,7 +563,7 @@ void tst_QNetworkDiskCache::oldCacheVersionFile()
|
||||
{
|
||||
QTemporaryFile file(cache.cacheDirectory() + "/XXXXXX.d");
|
||||
file.setAutoRemove(false);
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QDataStream out(&file);
|
||||
out << qint32(0xe8);
|
||||
out << qint32(2);
|
||||
|
@ -1679,7 +1679,7 @@ void tst_QNetworkReply::getFromFile()
|
||||
// create the file:
|
||||
QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX");
|
||||
file.setAutoRemove(true);
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
|
||||
QNetworkRequest request(QUrl::fromLocalFile(file.fileName()));
|
||||
QNetworkReplyPtr reply;
|
||||
@ -3065,7 +3065,7 @@ void tst_QNetworkReply::ioGetFromFile()
|
||||
{
|
||||
QTemporaryFile file(QDir::currentPath() + "/temp-XXXXXX");
|
||||
file.setAutoRemove(true);
|
||||
QVERIFY(file.open());
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
|
||||
QFETCH(QByteArray, data);
|
||||
QCOMPARE(file.write(data), data.size());
|
||||
@ -5353,7 +5353,7 @@ void tst_QNetworkReply::chaining()
|
||||
{
|
||||
QTemporaryFile sourceFile(QDir::currentPath() + "/temp-XXXXXX");
|
||||
sourceFile.setAutoRemove(true);
|
||||
QVERIFY(sourceFile.open());
|
||||
QVERIFY2(sourceFile.open(), qPrintable(sourceFile.errorString()));
|
||||
|
||||
QFETCH(QByteArray, data);
|
||||
QCOMPARE(sourceFile.write(data), data.size());
|
||||
@ -7194,6 +7194,7 @@ void tst_QNetworkReply::qtbug28035browserDoesNotLoadQtProjectOrgCorrectly() {
|
||||
QByteArray postData = "ACT=100";
|
||||
|
||||
QTemporaryDir tempDir(QDir::tempPath() + "/tmp_cache_28035");
|
||||
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
|
||||
tempDir.setAutoRemove(true);
|
||||
|
||||
QNetworkDiskCache *diskCache = new QNetworkDiskCache();
|
||||
|
@ -276,7 +276,7 @@ void tst_languageChange::retranslatability()
|
||||
tempDirPattern += QStringLiteral("languagechangetestdirXXXXXX");
|
||||
QTemporaryDir temporaryDir(tempDirPattern);
|
||||
temporaryDir.setAutoRemove(true);
|
||||
QVERIFY(temporaryDir.isValid());
|
||||
QVERIFY2(temporaryDir.isValid(), qPrintable(temporaryDir.errorString()));
|
||||
const QString finalDir = temporaryDir.path() + QStringLiteral("/finaldir");
|
||||
const QString fooName = temporaryDir.path() + QStringLiteral("/foo");
|
||||
QDir dir;
|
||||
|
@ -316,6 +316,7 @@ tst_Selftests::tst_Selftests()
|
||||
|
||||
void tst_Selftests::initTestCase()
|
||||
{
|
||||
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
|
||||
//Detect the location of the sub programs
|
||||
QString subProgram = QLatin1String("float/float");
|
||||
#if defined(Q_OS_WIN)
|
||||
|
@ -86,6 +86,7 @@ static QByteArray msgProcessStartFailed(const QString &command, const QString &w
|
||||
|
||||
void tst_uic::initTestCase()
|
||||
{
|
||||
QVERIFY2(m_generated.isValid(), qPrintable(m_generated.errorString()));
|
||||
QVERIFY(m_versionRegexp.isValid());
|
||||
m_baseline = QFINDTESTDATA("baseline");
|
||||
QVERIFY2(!m_baseline.isEmpty(), "Could not find 'baseline'.");
|
||||
|
@ -483,11 +483,11 @@ void tst_QFiledialog::completer()
|
||||
|
||||
if (startPath.isEmpty()) {
|
||||
tempDir.reset(new QTemporaryDir);
|
||||
QVERIFY(tempDir->isValid());
|
||||
QVERIFY2(tempDir->isValid(), qPrintable(tempDir->errorString()));
|
||||
startPath = tempDir->path();
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
TemporaryFilePtr file(new QTemporaryFile(startPath + QStringLiteral("/rXXXXXX")));
|
||||
QVERIFY(file->open());
|
||||
QVERIFY2(file->open(), qPrintable(file->errorString()));
|
||||
files.append(file);
|
||||
}
|
||||
}
|
||||
@ -889,7 +889,7 @@ void tst_QFiledialog::selectFile()
|
||||
QScopedPointer<QTemporaryFile> tempFile;
|
||||
if (file == QLatin1String("temp")) {
|
||||
tempFile.reset(new QTemporaryFile(QDir::tempPath() + QStringLiteral("/aXXXXXX")));
|
||||
QVERIFY(tempFile->open());
|
||||
QVERIFY2(tempFile->open(), qPrintable(tempFile->errorString()));
|
||||
file = tempFile->fileName();
|
||||
}
|
||||
|
||||
@ -927,7 +927,7 @@ void tst_QFiledialog::selectFileWrongCaseSaveAs()
|
||||
void tst_QFiledialog::selectFiles()
|
||||
{
|
||||
QTemporaryDir tempDir;
|
||||
QVERIFY(tempDir.isValid());
|
||||
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
|
||||
const QString tempPath = tempDir.path();
|
||||
{
|
||||
QNonNativeFileDialog fd;
|
||||
|
@ -171,7 +171,7 @@ void tst_QFileDialog2::cleanupSettingsFile()
|
||||
|
||||
void tst_QFileDialog2::initTestCase()
|
||||
{
|
||||
QVERIFY(tempDir.isValid());
|
||||
QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString()));
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
cleanupSettingsFile();
|
||||
}
|
||||
@ -243,13 +243,13 @@ void tst_QFileDialog2::deleteDirAndFiles()
|
||||
QTemporaryFile *t;
|
||||
t = new QTemporaryFile(tempPath + "/foo/aXXXXXX");
|
||||
t->setAutoRemove(false);
|
||||
t->open();
|
||||
QVERIFY2(t->open(), qPrintable(t->errorString()));
|
||||
t->close();
|
||||
delete t;
|
||||
|
||||
t = new QTemporaryFile(tempPath + "/foo/B/yXXXXXX");
|
||||
t->setAutoRemove(false);
|
||||
t->open();
|
||||
QVERIFY2(t->open(), qPrintable(t->errorString()));
|
||||
t->close();
|
||||
delete t;
|
||||
FriendlyQFileDialog fd;
|
||||
@ -849,7 +849,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting()
|
||||
current.mkdir("f");
|
||||
current.mkdir("g");
|
||||
QTemporaryFile *tempFile = new QTemporaryFile(current.absolutePath() + "/rXXXXXX");
|
||||
tempFile->open();
|
||||
QVERIFY2(tempFile->open(), qPrintable(tempFile->errorString()));
|
||||
current.cdUp();
|
||||
|
||||
QNonNativeFileDialog fd;
|
||||
@ -1108,6 +1108,7 @@ void tst_QFileDialog2::task254490_selectFileMultipleTimes()
|
||||
QString tempPath = tempDir.path();
|
||||
QTemporaryFile *t;
|
||||
t = new QTemporaryFile;
|
||||
QVERIFY2(t->open(), qPrintable(t->errorString()));
|
||||
t->open();
|
||||
QNonNativeFileDialog fd(0, "TestFileDialog");
|
||||
|
||||
@ -1209,7 +1210,7 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll()
|
||||
{
|
||||
QString tempPath = tempDir.path();
|
||||
QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX");
|
||||
QVERIFY(temporaryFile.open());
|
||||
QVERIFY2(temporaryFile.open(), qPrintable(temporaryFile.errorString()));
|
||||
QNonNativeFileDialog fd(0, "TestFileDialog", temporaryFile.fileName());
|
||||
|
||||
fd.setDirectory(tempPath);
|
||||
|
@ -173,7 +173,7 @@ void tst_QFileSystemModel::cleanup()
|
||||
|
||||
void tst_QFileSystemModel::initTestCase()
|
||||
{
|
||||
QVERIFY(m_tempDir.isValid());
|
||||
QVERIFY2(m_tempDir.isValid(), qPrintable(m_tempDir.errorString()));
|
||||
flatDirTestPath = m_tempDir.path();
|
||||
}
|
||||
|
||||
@ -318,7 +318,7 @@ void tst_QFileSystemModel::readOnly()
|
||||
{
|
||||
QCOMPARE(model->isReadOnly(), true);
|
||||
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
|
||||
file.open();
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QModelIndex root = model->setRootPath(flatDirTestPath);
|
||||
|
||||
QTRY_VERIFY(model->rowCount(root) > 0);
|
||||
@ -819,7 +819,7 @@ void tst_QFileSystemModel::setData()
|
||||
void tst_QFileSystemModel::sortPersistentIndex()
|
||||
{
|
||||
QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat"));
|
||||
file.open();
|
||||
QVERIFY2(file.open(), qPrintable(file.errorString()));
|
||||
QModelIndex root = model->setRootPath(flatDirTestPath);
|
||||
QTRY_VERIFY(model->rowCount(root) > 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user