| 499 | } |
| 500 | |
| 501 | void TestProjectModel::testProjectProxyModel() |
| 502 | { |
| 503 | auto* root = new ProjectFolderItem(nullptr, Path(QUrl::fromLocalFile(QDir::tempPath()))); |
| 504 | new ProjectFileItem(QStringLiteral("b1"), root); |
| 505 | new ProjectFileItem(QStringLiteral("a1"), root); |
| 506 | new ProjectFileItem(QStringLiteral("d1"), root); |
| 507 | new ProjectFileItem(QStringLiteral("c1"), root); |
| 508 | model->appendRow(root); |
| 509 | |
| 510 | QModelIndex proxyRoot = proxy->mapFromSource(root->index()); |
| 511 | QCOMPARE(model->rowCount(root->index()), 4); |
| 512 | QCOMPARE(proxy->rowCount(proxyRoot), 4); |
| 513 | QCOMPARE(proxy->index(0, 0, proxy->index(0, 0)).data().toString(), QStringLiteral("a1")); |
| 514 | QCOMPARE(proxy->index(1, 0, proxy->index(0, 0)).data().toString(), QStringLiteral("b1")); |
| 515 | QCOMPARE(proxy->index(2, 0, proxy->index(0, 0)).data().toString(), QStringLiteral("c1")); |
| 516 | QCOMPARE(proxy->index(3, 0, proxy->index(0, 0)).data().toString(), QStringLiteral("d1")); |
| 517 | |
| 518 | model->clear(); |
| 519 | } |
| 520 | |
| 521 | void TestProjectModel::testProjectFileSet() |
| 522 | { |