tst_qtemporarydir: refactor a test
Instead of using ~/Downloads, which we have no control over (OK for the CI, but not locally), create a parent temp dir, then another temp dir inside it. Also rename it to nestedTempDirs, the issue from the bug report wasn't tested because it relied on a dir being created, then failing to set permissions on it. The code has changed a lot since then. Pick-to: 6.6 6.5 6.2 Change-Id: I2b03d5d761117aaf436041c13c0dc394b106bf89 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 56ef55eda0b197e975de155815885f310dc2e661) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
b7dd49682b
commit
11b2047d4c
@ -53,7 +53,7 @@ private slots:
|
||||
void QTBUG_4796_data();
|
||||
void QTBUG_4796();
|
||||
|
||||
void QTBUG43352_failedSetPermissions();
|
||||
void nestedTempDirs();
|
||||
|
||||
private:
|
||||
QString m_previousCurrent;
|
||||
@ -555,16 +555,18 @@ void tst_QTemporaryDir::QTBUG_4796() // unicode support
|
||||
cleaner.reset();
|
||||
}
|
||||
|
||||
void tst_QTemporaryDir::QTBUG43352_failedSetPermissions()
|
||||
void tst_QTemporaryDir::nestedTempDirs()
|
||||
{
|
||||
QString path = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + QStringLiteral("/");
|
||||
int count = QDir(path).entryList().size();
|
||||
QTemporaryDir parentDir;
|
||||
const QString &parentPath = parentDir.path();
|
||||
|
||||
{
|
||||
QTemporaryDir dir(path);
|
||||
QTemporaryDir tempdir(parentPath);
|
||||
}
|
||||
|
||||
QCOMPARE(QDir(path).entryList().size(), count);
|
||||
QDir dir(parentPath);
|
||||
dir.setFilter(QDir::NoDotAndDotDot);
|
||||
QCOMPARE(dir.count(), 0);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QTemporaryDir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user