Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add test for storage of designer parameter values
  • Loading branch information
nyalldawson committed Mar 6, 2020
1 parent 0b3f7a5 commit 034b875
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/src/analysis/testqgsprocessing.cpp
Expand Up @@ -7841,6 +7841,12 @@ void TestQgsProcessing::modelerAlgorithm()
QCOMPARE( alg.shortDescription(), QStringLiteral( "short" ) );
QCOMPARE( alg.helpUrl(), QStringLiteral( "url" ) );

QVariantMap lastParams;
lastParams.insert( QStringLiteral( "a" ), 2 );
lastParams.insert( QStringLiteral( "b" ), 4 );
alg.setDesignerParameterValues( lastParams );
QCOMPARE( alg.designerParameterValues(), lastParams );

// child algorithms
QMap<QString, QgsProcessingModelChildAlgorithm> algs;
QgsProcessingModelChildAlgorithm a1;
Expand Down Expand Up @@ -8185,6 +8191,7 @@ void TestQgsProcessing::modelerAlgorithm()
alg5pc1.setPosition( QPointF( 11, 12 ) );
alg5pc1.setSize( QSizeF( 21, 22 ) );
alg5.addModelParameter( new QgsProcessingParameterBoolean( QStringLiteral( "my_param" ) ), alg5pc1 );
alg5.setDesignerParameterValues( lastParams );

QDomDocument doc = QDomDocument( "model" );
QDomElement elem = QgsXmlUtils::writeVariant( alg5.toVariant(), doc );
Expand All @@ -8196,6 +8203,7 @@ void TestQgsProcessing::modelerAlgorithm()
QCOMPARE( alg6.group(), QStringLiteral( "testGroup" ) );
QCOMPARE( alg6.helpContent(), alg5.helpContent() );
QCOMPARE( alg6.variables(), variables );
QCOMPARE( alg6.designerParameterValues(), lastParams );
QgsProcessingModelChildAlgorithm alg6c1 = alg6.childAlgorithm( "cx1" );
QCOMPARE( alg6c1.childId(), QStringLiteral( "cx1" ) );
QCOMPARE( alg6c1.algorithmId(), QStringLiteral( "buffer" ) );
Expand Down

0 comments on commit 034b875

Please sign in to comment.