Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[processing] Don't try to load algorithms for disabled providers
- Loading branch information
|
@@ -60,8 +60,11 @@ void QgsProcessingProvider::refreshAlgorithms() |
|
|
{ |
|
|
qDeleteAll( mAlgorithms ); |
|
|
mAlgorithms.clear(); |
|
|
loadAlgorithms(); |
|
|
emit algorithmsLoaded(); |
|
|
if ( isActive() ) |
|
|
{ |
|
|
loadAlgorithms(); |
|
|
emit algorithmsLoaded(); |
|
|
} |
|
|
} |
|
|
|
|
|
QList<const QgsProcessingAlgorithm *> QgsProcessingProvider::algorithms() const |
|
|
|
@@ -323,6 +323,12 @@ class DummyProvider : public QgsProcessingProvider |
|
|
return supportsNonFileOutputs; |
|
|
} |
|
|
|
|
|
bool isActive() const override |
|
|
{ |
|
|
return active; |
|
|
} |
|
|
|
|
|
bool active = true; |
|
|
bool *unloaded = nullptr; |
|
|
bool supportsNonFileOutputs = false; |
|
|
|
|
@@ -1079,6 +1085,16 @@ void TestQgsProcessing::algorithm() |
|
|
QCOMPARE( providerRefreshed.count(), 2 + i ); |
|
|
} |
|
|
|
|
|
// inactive provider, should not load algorithms |
|
|
p->active = false; |
|
|
p->refreshAlgorithms(); |
|
|
QCOMPARE( providerRefreshed.count(), 3 ); |
|
|
QVERIFY( p->algorithms().empty() ); |
|
|
p->active = true; |
|
|
p->refreshAlgorithms(); |
|
|
QCOMPARE( providerRefreshed.count(), 4 ); |
|
|
QVERIFY( !p->algorithms().empty() ); |
|
|
|
|
|
QgsProcessingRegistry r; |
|
|
r.addProvider( p ); |
|
|
QCOMPARE( r.algorithms().size(), 2 ); |
|
|