tst_QFileSystemModel::specialFiles(): Remove Windows parts
The test created a Windows shortcut (.lnk) and checked on its existence. It was not found in the first test since QFileSystemModel returned the resolved file name (linktarget.txt). When fixing this by querying QFileSystemModel::fileInfo()::fileName(), the 2nd test failed since shortcut files are not considered system files. Amends change 3b093034b638a69b4dc91212d1743638864a1337. Task-number: QTBUG-53890 Task-number: QTBUG-20968 Task-number: QTBUG-29403 Change-Id: Iec58b52532b44d12759eaa6c8d63a8a4dc8d1bc3 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
6bfe30a0bf
commit
d91bf00c43
@ -1097,6 +1097,10 @@ static QSet<QString> fileListUnderIndex(const QFileSystemModel *model, const QMo
|
||||
|
||||
void tst_QFileSystemModel::specialFiles()
|
||||
{
|
||||
#ifndef Q_OS_UNIX
|
||||
QSKIP("Not implemented");
|
||||
#endif
|
||||
|
||||
QFileSystemModel model;
|
||||
|
||||
model.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden);
|
||||
@ -1105,23 +1109,8 @@ void tst_QFileSystemModel::specialFiles()
|
||||
// as it will always return a valid index for existing files,
|
||||
// even if the file is not visible with the given filter.
|
||||
|
||||
#if defined(Q_OS_UNIX)
|
||||
const QModelIndex rootIndex = model.setRootPath(QStringLiteral("/dev/"));
|
||||
const QString testFileName = QStringLiteral("null");
|
||||
#elif defined(Q_OS_WIN)
|
||||
const QModelIndex rootIndex = model.setRootPath(flatDirTestPath);
|
||||
|
||||
const QString testFileName = QStringLiteral("linkSource.lnk");
|
||||
|
||||
QFile file(flatDirTestPath + QLatin1String("/linkTarget.txt"));
|
||||
QVERIFY(file.open(QIODevice::WriteOnly));
|
||||
file.close();
|
||||
QVERIFY(file.link(flatDirTestPath + '/' + testFileName));
|
||||
#else
|
||||
QSKIP("Not implemented");
|
||||
QModelIndex rootIndex;
|
||||
QString testFileName;
|
||||
#endif
|
||||
|
||||
QTRY_VERIFY(fileListUnderIndex(&model, rootIndex).contains(testFileName));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user