@@ -427,10 +427,15 @@ void TestQgsProcessingModel::testProxyModel()
427
427
428
428
model.setFilters ( QgsProcessingToolboxProxyModel::FilterModeler );
429
429
group1Index = model.index ( 0 , 0 , QModelIndex () );
430
- QCOMPARE ( model.rowCount (), 1 );
430
+ QCOMPARE ( model.rowCount (), 3 );
431
431
QCOMPARE ( model.rowCount ( group1Index ), 1 );
432
432
QCOMPARE ( model.data ( group1Index, Qt::DisplayRole ).toString (), QStringLiteral ( " group1" ) );
433
433
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 );
434
439
model.setFilters ( QgsProcessingToolboxProxyModel::FilterToolbox );
435
440
group2Index = model.index ( 0 , 0 , QModelIndex () );
436
441
QCOMPARE ( model.rowCount (), 3 );
@@ -586,18 +591,22 @@ void TestQgsProcessingModel::testView()
586
591
QCOMPARE ( view.algorithmForIndex ( alg1Index )->id (), QStringLiteral ( " p2:a1" ) );
587
592
588
593
view.setFilters ( QgsProcessingToolboxProxyModel::FilterModeler );
589
- provider2Index = view.model ()->index ( 0 , 0 , QModelIndex () );
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 () );
590
598
QCOMPARE ( view.model ()->data ( provider2Index, Qt::DisplayRole ).toString (), QStringLiteral ( " provider2" ) );
591
- QCOMPARE ( view.model ()->rowCount (), 1 );
592
599
QCOMPARE ( view.model ()->rowCount ( provider2Index ), 1 );
593
600
group2Index = view.model ()->index ( 0 , 0 , provider2Index );
594
601
QCOMPARE ( view.model ()->rowCount ( group2Index ), 1 );
595
602
QCOMPARE ( view.algorithmForIndex ( view.model ()->index ( 0 , 0 , group2Index ) )->id (), QStringLiteral ( " p2:a1" ) );
596
603
view.setFilters ( QgsProcessingToolboxProxyModel::FilterToolbox );
604
+ QCOMPARE ( view.model ()->rowCount (), 2 );
597
605
provider1Index = view.model ()->index ( 0 , 0 , QModelIndex () );
598
606
QCOMPARE ( view.model ()->data ( provider1Index, Qt::DisplayRole ).toString (), QStringLiteral ( " provider1" ) );
599
- QCOMPARE ( view.model ()->rowCount (), 1 );
600
607
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 );
601
610
group2Index = view.model ()->index ( 0 , 0 , provider1Index );
602
611
QCOMPARE ( view.model ()->rowCount ( group2Index ), 1 );
603
612
QCOMPARE ( view.algorithmForIndex ( view.model ()->index ( 0 , 0 , group2Index ) )->id (), QStringLiteral ( " p1:a2" ) );
0 commit comments