@@ -1314,6 +1314,7 @@ void TestQgsProcessing::parameterGeneral()
13141314 QCOMPARE ( param.description (), QString ( " desc" ) );
13151315 QCOMPARE ( param.defaultValue (), QVariant ( true ) );
13161316 QVERIFY ( param.flags () & QgsProcessingParameterDefinition::FlagOptional );
1317+ QVERIFY ( param.dependsOnOtherParameters ().isEmpty () );
13171318
13181319 // test getters and setters
13191320 param.setDescription ( " p2" );
@@ -2951,6 +2952,10 @@ void TestQgsProcessing::parameterExpression()
29512952 def.reset ( dynamic_cast < QgsProcessingParameterExpression *>( QgsProcessingParameters::parameterFromVariantMap ( map ) ) );
29522953 QVERIFY ( dynamic_cast < QgsProcessingParameterExpression *>( def.get () ) );
29532954
2955+ QVERIFY ( def->dependsOnOtherParameters ().isEmpty () );
2956+ def->setParentLayerParameter ( QStringLiteral ( " test_layer" ) );
2957+ QCOMPARE ( def->dependsOnOtherParameters (), QStringList () << QStringLiteral ( " test_layer" ) );
2958+
29542959 // optional
29552960 def.reset ( new QgsProcessingParameterExpression ( " optional" , QString (), QString ( " default" ), QString (), true ) );
29562961 QVERIFY ( def->checkValueIsAcceptable ( 1 ) );
@@ -3011,7 +3016,10 @@ void TestQgsProcessing::parameterField()
30113016 QCOMPARE ( fromCode->dataType (), def->dataType () );
30123017 QCOMPARE ( fromCode->allowMultiple (), def->allowMultiple () );
30133018
3019+ QVERIFY ( def->dependsOnOtherParameters ().isEmpty () );
30143020 def->setParentLayerParameter ( " my_parent" );
3021+ QCOMPARE ( def->dependsOnOtherParameters (), QStringList () << QStringLiteral ( " my_parent" ) );
3022+
30153023 code = def->asScriptCode ();
30163024 fromCode.reset ( dynamic_cast < QgsProcessingParameterField * >( QgsProcessingParameters::parameterFromScriptCode ( code ) ) );
30173025 QVERIFY ( fromCode.get () );
@@ -4450,6 +4458,16 @@ void TestQgsProcessing::modelerAlgorithm()
44504458 alg4.setChildAlgorithm ( c10 );
44514459 QVERIFY ( alg4.childAlgorithmsDependOnParameter ( " p1" ) );
44524460
4461+ QgsProcessingModelAlgorithm::ModelParameter vlP;
4462+ alg4.addModelParameter ( new QgsProcessingParameterVectorLayer ( " layer" ), vlP );
4463+ QgsProcessingModelAlgorithm::ModelParameter field;
4464+ alg4.addModelParameter ( new QgsProcessingParameterField ( " field" , QString (), QVariant (), QStringLiteral ( " layer" ) ), field );
4465+ QVERIFY ( !alg4.otherParametersDependOnParameter ( " p1" ) );
4466+ QVERIFY ( !alg4.otherParametersDependOnParameter ( " field" ) );
4467+ QVERIFY ( alg4.otherParametersDependOnParameter ( " layer" ) );
4468+
4469+
4470+
44534471
44544472
44554473 // to/from XML
0 commit comments