Changeset View
Changeset View
Standalone View
Standalone View
autotests/kfileitemtest.cpp
Show First 20 Lines • Show All 288 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::testCmpAndInit() | ||||
298 | { | ||||
299 | QTemporaryDir tempDir; | ||||
300 | KFileItem dirItem(QUrl::fromLocalFile(tempDir.path())); | ||||
301 | QVERIFY(dirItem.isDir()); // this calls init() | ||||
302 | | ||||
303 | KFileItem dirItem2(QUrl::fromLocalFile(tempDir.path())); | ||||
304 | // not yet init() called on dirItem2, but must be equal | ||||
305 | // compare init()ialized to un-init()ialized KFileItem | ||||
306 | QVERIFY(dirItem.cmp(dirItem2)); | ||||
307 | QVERIFY(dirItem2.isDir()); | ||||
308 | QVERIFY(dirItem.cmp(dirItem2)); | ||||
309 | QVERIFY(dirItem == dirItem2); | ||||
310 | QVERIFY(dirItem.d != dirItem2.d); | ||||
311 | QVERIFY(!(dirItem != dirItem2)); | ||||
312 | | ||||
313 | // now the other way around, compare un-init()ialized to init()ialized KFileItem | ||||
314 | KFileItem dirItem3(QUrl::fromLocalFile(tempDir.path())); | ||||
315 | // not yet init() called on dirItem3, but must be equal | ||||
316 | QVERIFY(dirItem3.cmp(dirItem)); | ||||
317 | QVERIFY(dirItem3.isDir()); | ||||
318 | QVERIFY(dirItem3.cmp(dirItem)); | ||||
319 | QVERIFY(dirItem == dirItem3); | ||||
320 | QVERIFY(dirItem.d != dirItem3.d); | ||||
321 | QVERIFY(!(dirItem != dirItem3)); | ||||
322 | } | ||||
323 | | ||||
297 | void KFileItemTest::testCmpByUrl() | 324 | void KFileItemTest::testCmpByUrl() | ||
298 | { | 325 | { | ||
299 | const QUrl nulUrl; | 326 | const QUrl nulUrl; | ||
300 | const QUrl url = QUrl::fromLocalFile(QStringLiteral("1foo")); | 327 | const QUrl url = QUrl::fromLocalFile(QStringLiteral("1foo")); | ||
301 | const QUrl url2 = QUrl::fromLocalFile(QStringLiteral("fo1")); | 328 | const QUrl url2 = QUrl::fromLocalFile(QStringLiteral("fo1")); | ||
302 | const QUrl url3 = QUrl::fromLocalFile(QStringLiteral("foo")); | 329 | const QUrl url3 = QUrl::fromLocalFile(QStringLiteral("foo")); | ||
303 | KFileItem nulFileItem; | 330 | KFileItem nulFileItem; | ||
304 | KFileItem nulFileItem2(nulUrl); | 331 | KFileItem nulFileItem2(nulUrl); | ||
▲ Show 20 Lines • Show All 451 Lines • Show Last 20 Lines |