@@ -382,8 +382,14 @@ void TestQgsProcessingModel::testModel()
382
382
383
383
void TestQgsProcessingModel::testProxyModel ()
384
384
{
385
+ QgsSettings ().clear ();
385
386
QgsProcessingRegistry registry;
386
- QgsProcessingToolboxProxyModel model ( nullptr , ®istry );
387
+ QgsProcessingRecentAlgorithmLog recentLog;
388
+ QgsProcessingToolboxProxyModel model ( nullptr , ®istry, &recentLog );
389
+
390
+ #ifdef ENABLE_MODELTEST
391
+ new ModelTest ( &model, this ); // for model validity checking
392
+ #endif
387
393
388
394
// add a provider
389
395
DummyAlgorithm *a1 = new DummyAlgorithm ( " a1" , " group2" , QgsProcessingAlgorithm::FlagHideFromModeler );
@@ -510,6 +516,13 @@ void TestQgsProcessingModel::testProxyModel()
510
516
QCOMPARE ( model.data ( model.index ( 0 , 0 , group2Index ), QgsProcessingToolboxModel::RoleAlgorithmId ).toString (), QStringLiteral ( " p2:a1" ) );
511
517
512
518
model.setFilterString ( QString () );
519
+ QCOMPARE ( model.rowCount (), 4 );
520
+
521
+ // check sort order of recent algorithms
522
+ recentLog.push ( QStringLiteral ( " qgis:a1" ) );
523
+ QCOMPARE ( model.rowCount (), 5 );
524
+ QModelIndex recentIndex = model.index ( 0 , 0 , QModelIndex () );
525
+ QCOMPARE ( model.data ( recentIndex, Qt::DisplayRole ).toString (), QStringLiteral ( " Recently used" ) );
513
526
514
527
// inactive provider - should not be visible
515
528
QCOMPARE ( model.rowCount (), 4 );
0 commit comments