Changeset View
Changeset View
Standalone View
Standalone View
autotests/kfileitemtest.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 284 | { | |||
---|---|---|---|---|---|
289 | fileItem.setDelayedMimeTypes(true); | 289 | fileItem.setDelayedMimeTypes(true); | ||
290 | KFileItem fileItem2(QUrl::fromLocalFile(file.fileName())); | 290 | KFileItem fileItem2(QUrl::fromLocalFile(file.fileName())); | ||
291 | QVERIFY(fileItem == fileItem2); // created independently, but still 'equal' | 291 | QVERIFY(fileItem == fileItem2); // created independently, but still 'equal' | ||
292 | QVERIFY(fileItem.d != fileItem2.d); | 292 | QVERIFY(fileItem.d != fileItem2.d); | ||
293 | QVERIFY(!(fileItem != fileItem2)); | 293 | QVERIFY(!(fileItem != fileItem2)); | ||
294 | QVERIFY(fileItem.cmp(fileItem2)); | 294 | QVERIFY(fileItem.cmp(fileItem2)); | ||
295 | } | 295 | } | ||
296 | 296 | | |||
297 | void KFileItemTest::testCmpByUrl() | ||||
298 | { | ||||
299 | KFileItem nulFileItem; | ||||
300 | KFileItem fileItem(QUrl::fromLocalFile(QStringLiteral("1foo"))); | ||||
301 | KFileItem fileItem2(QUrl::fromLocalFile(QStringLiteral("fo1"))); | ||||
302 | KFileItem fileItem3(QUrl::fromLocalFile(QStringLiteral("foo"))); | ||||
303 | | ||||
304 | // a KFileItem without url is considered < than anything. | ||||
305 | QVERIFY(nulFileItem < nulFileItem); | ||||
dfaure: I wonder if that should be true, though ;-)
I guess it should rather be false, so that a… | |||||
306 | QVERIFY(nulFileItem < fileItem); | ||||
307 | | ||||
308 | QVERIFY(!(fileItem < nulFileItem)); | ||||
309 | QVERIFY(fileItem < fileItem2); | ||||
310 | QVERIFY(!(fileItem2 < fileItem)); | ||||
311 | QVERIFY(fileItem2 < fileItem3); | ||||
312 | QVERIFY(!(fileItem3 < fileItem2)); | ||||
313 | QVERIFY(!(fileItem3 < fileItem)); | ||||
314 | // This should be false as they are equal | ||||
dfaure: ... exactly. I think the same reasoning applies to a null item. | |||||
315 | QVERIFY(!(fileItem < fileItem)); | ||||
316 | } | ||||
317 | | ||||
297 | void KFileItemTest::testRename() | 318 | void KFileItemTest::testRename() | ||
298 | { | 319 | { | ||
299 | KIO::UDSEntry entry; | 320 | KIO::UDSEntry entry; | ||
300 | const QString origName = QStringLiteral("foo"); | 321 | const QString origName = QStringLiteral("foo"); | ||
301 | entry.insert(KIO::UDSEntry::UDS_NAME, origName); | 322 | entry.insert(KIO::UDSEntry::UDS_NAME, origName); | ||
302 | entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); | 323 | entry.insert(KIO::UDSEntry::UDS_FILE_TYPE, S_IFDIR); | ||
303 | KFileItem fileItem(entry, QUrl::fromLocalFile(QStringLiteral("/dir/foo"))); | 324 | KFileItem fileItem(entry, QUrl::fromLocalFile(QStringLiteral("/dir/foo"))); | ||
304 | QCOMPARE(fileItem.name(), origName); | 325 | QCOMPARE(fileItem.name(), origName); | ||
▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines |
I wonder if that should be true, though ;-)
I guess it should rather be false, so that a binary search (based on < only) can deduce that a null item is *equal* to another null item, rather than both being lower than the other, which would be nonsense.