Skip to content
Permalink
Browse files

Add test for storage of designer parameter values

  • Loading branch information
nyalldawson committed Mar 6, 2020
1 parent 0b3f7a5 commit 034b8754a008279a6f888d853afaf443bd81bc95
Showing with 8 additions and 0 deletions.
  1. +8 −0 tests/src/analysis/testqgsprocessing.cpp
@@ -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;
@@ -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 );
@@ -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" ) );

0 comments on commit 034b875

Please sign in to comment.
You can’t perform that action at this time.