QDir: fix int overflow
This caused reverse order of session items in qt creator. Introduced
in ba287c55ef.
Change-Id: I5c37ca6a1ef4753b6449eb9e87b4def5ea858677
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
bb10
parent
280084cf96
commit
ad03511256
|
|
@ -219,7 +219,7 @@ bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortIt
|
|||
if ((qt_cmp_si_sort_flags & QDir::DirsLast) && (f1->item.isDir() != f2->item.isDir()))
|
||||
return !f1->item.isDir();
|
||||
|
||||
int r = 0;
|
||||
qint64 r = 0;
|
||||
int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask)
|
||||
| (qt_cmp_si_sort_flags & QDir::Type);
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,8 @@ private slots:
|
|||
void entryList_data();
|
||||
void entryList();
|
||||
|
||||
void entryListTimedSort();
|
||||
|
||||
void entryListSimple_data();
|
||||
void entryListSimple();
|
||||
|
||||
|
|
@ -831,6 +833,45 @@ void tst_QDir::entryList()
|
|||
QFile::remove(entrylistPath + "brokenlink");
|
||||
}
|
||||
|
||||
void tst_QDir::entryListTimedSort()
|
||||
{
|
||||
#ifndef QT_NO_PROCESS
|
||||
const QString touchBinary = "/bin/touch";
|
||||
if (!QFile::exists(touchBinary))
|
||||
QSKIP("/bin/touch not found");
|
||||
|
||||
const QString entrylistPath = m_dataPath + "/entrylist/";
|
||||
QTemporaryFile aFile(entrylistPath + "A-XXXXXX.qws");
|
||||
QTemporaryFile bFile(entrylistPath + "B-XXXXXX.qws");
|
||||
|
||||
QVERIFY(aFile.open());
|
||||
QVERIFY(bFile.open());
|
||||
{
|
||||
QProcess p;
|
||||
p.start(touchBinary, QStringList() << "-t" << "201306021513" << aFile.fileName());
|
||||
QVERIFY(p.waitForFinished(1000));
|
||||
}
|
||||
{
|
||||
QProcess p;
|
||||
p.start(touchBinary, QStringList() << "-t" << "201504131513" << bFile.fileName());
|
||||
QVERIFY(p.waitForFinished(1000));
|
||||
}
|
||||
|
||||
QStringList actual = QDir(entrylistPath).entryList(QStringList() << "*.qws", QDir::NoFilter,
|
||||
QDir::Time);
|
||||
|
||||
QFileInfo aFileInfo(aFile);
|
||||
QFileInfo bFileInfo(bFile);
|
||||
QVERIFY(bFileInfo.lastModified().msecsTo(aFileInfo.lastModified()) < 0);
|
||||
|
||||
QCOMPARE(actual.size(), 2);
|
||||
QCOMPARE(actual.first(), bFileInfo.fileName());
|
||||
QCOMPARE(actual.last(), aFileInfo.fileName());
|
||||
#else
|
||||
QSKIP("This test requires QProcess support.");
|
||||
#endif // QT_NO_PROCESS
|
||||
}
|
||||
|
||||
void tst_QDir::entryListSimple_data()
|
||||
{
|
||||
QTest::addColumn<QString>("dirName");
|
||||
|
|
|
|||
Loading…
Reference in New Issue