@@ -425,17 +425,13 @@ void TestQgsProcessingModel::testProxyModel()
425
425
QModelIndex alg2Index = model.index ( 0 , 0 , group1Index );
426
426
QCOMPARE ( model.data ( alg2Index, Qt::DisplayRole ).toString (), QStringLiteral ( " a2" ) );
427
427
428
+ // empty providers/groups should not be shown
428
429
model.setFilters ( QgsProcessingToolboxProxyModel::FilterModeler );
429
430
group1Index = model.index ( 0 , 0 , QModelIndex () );
430
- QCOMPARE ( model.rowCount (), 3 );
431
+ QCOMPARE ( model.rowCount (), 1 );
431
432
QCOMPARE ( model.rowCount ( group1Index ), 1 );
432
433
QCOMPARE ( model.data ( group1Index, Qt::DisplayRole ).toString (), QStringLiteral ( " group1" ) );
433
434
QCOMPARE ( model.data ( model.index ( 0 , 0 , group1Index ), Qt::DisplayRole ).toString (), QStringLiteral ( " a2" ) );
434
- // no filter string, so empty providers should be shown
435
- QCOMPARE ( model.data ( model.index ( 1 , 0 , QModelIndex () ), Qt::DisplayRole ).toString (), QStringLiteral ( " provider1" ) );
436
- QCOMPARE ( model.rowCount ( model.index ( 1 , 0 , QModelIndex () ) ), 0 );
437
- QCOMPARE ( model.data ( model.index ( 2 , 0 , QModelIndex () ), Qt::DisplayRole ).toString (), QStringLiteral ( " provider2" ) );
438
- QCOMPARE ( model.rowCount ( model.index ( 2 , 0 , QModelIndex () ) ), 0 );
439
435
model.setFilters ( QgsProcessingToolboxProxyModel::FilterToolbox );
440
436
group2Index = model.index ( 0 , 0 , QModelIndex () );
441
437
QCOMPARE ( model.rowCount (), 3 );
@@ -590,23 +586,20 @@ void TestQgsProcessingModel::testView()
590
586
QModelIndex alg1Index = view.model ()->index ( 0 , 0 , group2Index );
591
587
QCOMPARE ( view.algorithmForIndex ( alg1Index )->id (), QStringLiteral ( " p2:a1" ) );
592
588
589
+ // empty providers/groups should not be shown
593
590
view.setFilters ( QgsProcessingToolboxProxyModel::FilterModeler );
594
- QCOMPARE ( view.model ()->rowCount (), 2 );
595
- QCOMPARE ( view.model ()->data ( view.model ()->index ( 0 , 0 , QModelIndex () ), Qt::DisplayRole ).toString (), QStringLiteral ( " provider1" ) );
596
- QCOMPARE ( view.model ()->rowCount ( view.model ()->index ( 0 , 0 , QModelIndex () ) ), 0 );
597
- provider2Index = view.model ()->index ( 1 , 0 , QModelIndex () );
591
+ QCOMPARE ( view.model ()->rowCount (), 1 );
592
+ provider2Index = view.model ()->index ( 0 , 0 , QModelIndex () );
598
593
QCOMPARE ( view.model ()->data ( provider2Index, Qt::DisplayRole ).toString (), QStringLiteral ( " provider2" ) );
599
594
QCOMPARE ( view.model ()->rowCount ( provider2Index ), 1 );
600
595
group2Index = view.model ()->index ( 0 , 0 , provider2Index );
601
596
QCOMPARE ( view.model ()->rowCount ( group2Index ), 1 );
602
597
QCOMPARE ( view.algorithmForIndex ( view.model ()->index ( 0 , 0 , group2Index ) )->id (), QStringLiteral ( " p2:a1" ) );
603
598
view.setFilters ( QgsProcessingToolboxProxyModel::FilterToolbox );
604
- QCOMPARE ( view.model ()->rowCount (), 2 );
599
+ QCOMPARE ( view.model ()->rowCount (), 1 );
605
600
provider1Index = view.model ()->index ( 0 , 0 , QModelIndex () );
606
601
QCOMPARE ( view.model ()->data ( provider1Index, Qt::DisplayRole ).toString (), QStringLiteral ( " provider1" ) );
607
602
QCOMPARE ( view.model ()->rowCount ( provider1Index ), 1 );
608
- QCOMPARE ( view.model ()->data ( view.model ()->index ( 1 , 0 , QModelIndex () ), Qt::DisplayRole ).toString (), QStringLiteral ( " provider2" ) );
609
- QCOMPARE ( view.model ()->rowCount ( view.model ()->index ( 1 , 0 , QModelIndex () ) ), 0 );
610
603
group2Index = view.model ()->index ( 0 , 0 , provider1Index );
611
604
QCOMPARE ( view.model ()->rowCount ( group2Index ), 1 );
612
605
QCOMPARE ( view.algorithmForIndex ( view.model ()->index ( 0 , 0 , group2Index ) )->id (), QStringLiteral ( " p1:a2" ) );
0 commit comments