Skip to content

Commit 74e6e15

Browse files
committed
[processing] Add test to ensure that model child algorithm parameters
which are set to dynamic values are preserved across save/restore
1 parent 3572ea8 commit 74e6e15

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/src/analysis/testqgsprocessing.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -5840,7 +5840,8 @@ void TestQgsProcessing::modelerAlgorithm()
58405840
alg5c1.addParameterSources( "zm", QgsProcessingModelChildParameterSources() << QgsProcessingModelChildParameterSource::fromStaticValue( 6 )
58415841
<< QgsProcessingModelChildParameterSource::fromModelParameter( "p2" )
58425842
<< QgsProcessingModelChildParameterSource::fromChildOutput( "cx2", "out4" )
5843-
<< QgsProcessingModelChildParameterSource::fromExpression( "1+2" ) );
5843+
<< QgsProcessingModelChildParameterSource::fromExpression( "1+2" )
5844+
<< QgsProcessingModelChildParameterSource::fromStaticValue( QgsProperty::fromExpression( "1+8" ) ) );
58445845
alg5c1.setActive( true );
58455846
alg5c1.setOutputsCollapsed( true );
58465847
alg5c1.setParametersCollapsed( true );
@@ -5896,7 +5897,7 @@ void TestQgsProcessing::modelerAlgorithm()
58965897
QCOMPARE( alg6c1.parameterSources().value( "z" ).at( 0 ).staticValue().toInt(), 5 );
58975898
QCOMPARE( alg6c1.parameterSources().value( "a" ).at( 0 ).source(), QgsProcessingModelChildParameterSource::Expression );
58985899
QCOMPARE( alg6c1.parameterSources().value( "a" ).at( 0 ).expression(), QStringLiteral( "2*2" ) );
5899-
QCOMPARE( alg6c1.parameterSources().value( "zm" ).count(), 4 );
5900+
QCOMPARE( alg6c1.parameterSources().value( "zm" ).count(), 5 );
59005901
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 0 ).source(), QgsProcessingModelChildParameterSource::StaticValue );
59015902
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 0 ).staticValue().toInt(), 6 );
59025903
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 1 ).source(), QgsProcessingModelChildParameterSource::ModelParameter );
@@ -5906,6 +5907,9 @@ void TestQgsProcessing::modelerAlgorithm()
59065907
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 2 ).outputName(), QStringLiteral( "out4" ) );
59075908
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 3 ).source(), QgsProcessingModelChildParameterSource::Expression );
59085909
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 3 ).expression(), QStringLiteral( "1+2" ) );
5910+
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 4 ).source(), QgsProcessingModelChildParameterSource::StaticValue );
5911+
QVERIFY( alg6c1.parameterSources().value( "zm" ).at( 4 ).staticValue().canConvert< QgsProperty >() );
5912+
QCOMPARE( alg6c1.parameterSources().value( "zm" ).at( 4 ).staticValue().value< QgsProperty >().expressionString(), QStringLiteral( "1+8" ) );
59095913

59105914
QCOMPARE( alg6c1.modelOutputs().count(), 1 );
59115915
QCOMPARE( alg6c1.modelOutputs().value( QStringLiteral( "a" ) ).description(), QStringLiteral( "my output" ) );

0 commit comments

Comments
 (0)