mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-19 00:04:52 -04:00
[processing] Fix dependency calculation for model child algs
This commit is contained in:
parent
76c21ea369
commit
f8c3f39670
@ -1045,7 +1045,7 @@ void QgsProcessingModelAlgorithm::dependentChildAlgorithmsRecursive( const QStri
|
|||||||
&& source.outputChildId() == childId )
|
&& source.outputChildId() == childId )
|
||||||
{
|
{
|
||||||
depends.insert( childIt->childId() );
|
depends.insert( childIt->childId() );
|
||||||
dependsOnChildAlgorithmsRecursive( childIt->childId(), depends );
|
dependentChildAlgorithmsRecursive( childIt->childId(), depends );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5095,6 +5095,34 @@ void TestQgsProcessing::modelerAlgorithm()
|
|||||||
QVERIFY( alg3.dependsOnChildAlgorithms( "c9" ).contains( "c7" ) );
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9" ).contains( "c7" ) );
|
||||||
QVERIFY( alg3.dependsOnChildAlgorithms( "c9" ).contains( "c8" ) );
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9" ).contains( "c8" ) );
|
||||||
|
|
||||||
|
QgsProcessingModelChildAlgorithm c9b;
|
||||||
|
c9b.setChildId( "c9b" );
|
||||||
|
c9b.addParameterSources( "x", QgsProcessingModelChildParameterSources() << QgsProcessingModelChildParameterSource::fromChildOutput( "c9", "x" ) );
|
||||||
|
alg3.addChildAlgorithm( c9b );
|
||||||
|
|
||||||
|
QCOMPARE( alg3.dependentChildAlgorithms( "c9" ).count(), 1 );
|
||||||
|
QCOMPARE( alg3.dependentChildAlgorithms( "c8" ).count(), 2 );
|
||||||
|
QVERIFY( alg3.dependentChildAlgorithms( "c8" ).contains( "c9" ) );
|
||||||
|
QVERIFY( alg3.dependentChildAlgorithms( "c8" ).contains( "c9b" ) );
|
||||||
|
QCOMPARE( alg3.dependentChildAlgorithms( "c7" ).count(), 3 );
|
||||||
|
QVERIFY( alg3.dependentChildAlgorithms( "c7" ).contains( "c8" ) );
|
||||||
|
QVERIFY( alg3.dependentChildAlgorithms( "c7" ).contains( "c9" ) );
|
||||||
|
QVERIFY( alg3.dependentChildAlgorithms( "c7" ).contains( "c9b" ) );
|
||||||
|
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c7" ).isEmpty() );
|
||||||
|
QCOMPARE( alg3.dependsOnChildAlgorithms( "c8" ).count(), 1 );
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c8" ).contains( "c7" ) );
|
||||||
|
QCOMPARE( alg3.dependsOnChildAlgorithms( "c9" ).count(), 2 );
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9" ).contains( "c7" ) );
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9" ).contains( "c8" ) );
|
||||||
|
QCOMPARE( alg3.dependsOnChildAlgorithms( "c9b" ).count(), 3 );
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9b" ).contains( "c7" ) );
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9b" ).contains( "c8" ) );
|
||||||
|
QVERIFY( alg3.dependsOnChildAlgorithms( "c9b" ).contains( "c9" ) );
|
||||||
|
|
||||||
|
alg3.removeChildAlgorithm( "c9b" );
|
||||||
|
|
||||||
|
|
||||||
// (de)activate child algorithm
|
// (de)activate child algorithm
|
||||||
alg3.deactivateChildAlgorithm( "c9" );
|
alg3.deactivateChildAlgorithm( "c9" );
|
||||||
QVERIFY( !alg3.childAlgorithm( "c9" ).isActive() );
|
QVERIFY( !alg3.childAlgorithm( "c9" ).isActive() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user