MCPcopy Create free account
hub / github.com/KDE/kdevelop / testProjectProxyModel

Method testProjectProxyModel

kdevplatform/project/tests/test_projectmodel.cpp:501–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

499}
500
501void 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
521void TestProjectModel::testProjectFileSet()
522{

Callers

nothing calls this directly

Calls 8

appendRowMethod · 0.80
PathClass · 0.50
mapFromSourceMethod · 0.45
indexMethod · 0.45
rowCountMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected