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

Method testChangeWithProxyModel

kdevplatform/project/tests/test_projectmodel.cpp:194–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void TestProjectModel::testChangeWithProxyModel()
195{
196 QString projectFolderPath = QDir::rootPath() + QStringLiteral("folder1");
197 QString projectFilePath = QDir::rootPath() + QStringLiteral("folder1/file1");
198 auto* proxy = new QSortFilterProxyModel( this );
199 proxy->setSourceModel( model );
200 auto* root = new ProjectFolderItem( nullptr, Path(QUrl::fromLocalFile(projectFolderPath)) );
201 root->appendRow( new ProjectFileItem( nullptr, Path(QUrl::fromLocalFile(projectFilePath)) ) );
202 model->appendRow( root );
203
204 QCOMPARE( model->rowCount(), 1 );
205 QCOMPARE( proxy->rowCount(), 1 );
206
207 model->removeRow( 0 );
208
209 QCOMPARE( model->rowCount(), 0 );
210 QCOMPARE( proxy->rowCount(), 0 );
211}
212
213void TestProjectModel::testCreateSimpleHierarchy()
214{

Callers

nothing calls this directly

Calls 5

setSourceModelMethod · 0.80
appendRowMethod · 0.80
removeRowMethod · 0.80
PathClass · 0.50
rowCountMethod · 0.45

Tested by

no test coverage detected