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

Method testCreateTargetItems

kdevplatform/project/tests/test_projectmodel.cpp:139–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void TestProjectModel::testCreateTargetItems()
140{
141 QFETCH( int, itemType );
142 QFETCH( QString, itemText );
143 QFETCH( QString, expectedItemText );
144 QFETCH( QStringList, expectedItemPath );
145 QFETCH( int, expectedItemRow );
146
147 ProjectBaseItem* newitem = nullptr;
148 switch( itemType ) {
149 case ProjectBaseItem::Target:
150 newitem = new ProjectTargetItem( nullptr, itemText );
151 break;
152 case ProjectBaseItem::LibraryTarget:
153 newitem = new ProjectLibraryTargetItem( nullptr, itemText );
154 break;
155 }
156 int origRowCount = model->rowCount();
157 model->appendRow( newitem );
158 QCOMPARE( model->rowCount(), origRowCount+1 );
159 QCOMPARE( newitem->row(), expectedItemRow );
160 QModelIndex idx = model->index( expectedItemRow, 0, QModelIndex() );
161 QVERIFY( model->itemFromIndex( idx ) );
162 QCOMPARE( model->itemFromIndex( idx ), newitem );
163 QCOMPARE( newitem->text(), expectedItemText );
164 QCOMPARE( newitem->type(), itemType );
165 QCOMPARE( model->data( idx ).toString(), expectedItemText );
166 QCOMPARE( model->indexFromItem( newitem ), idx );
167 QCOMPARE( model->pathFromIndex( idx ), expectedItemPath );
168 QCOMPARE( model->pathToIndex( expectedItemPath ), idx );
169}
170
171void TestProjectModel::testCreateTargetItems_data()
172{

Callers

nothing calls this directly

Calls 13

appendRowMethod · 0.80
indexFromItemMethod · 0.80
pathToIndexMethod · 0.80
QModelIndexClass · 0.50
rowCountMethod · 0.45
rowMethod · 0.45
indexMethod · 0.45
itemFromIndexMethod · 0.45
textMethod · 0.45
typeMethod · 0.45
toStringMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected