Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 16, 2020
1 parent 281356a commit a198e30
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/src/analysis/testqgsprocessing.cpp
Expand Up @@ -9432,8 +9432,9 @@ void TestQgsProcessing::modelExecution()
// Check variables for child algorithm
// without values
QMap<QString, QgsProcessingModelAlgorithm::VariableDefinition> variables = model2.variablesForChildAlgorithm( "cx1", context );
QCOMPARE( variables.count(), 6 );
QCOMPARE( variables.count(), 7 );
QCOMPARE( variables.value( "DIST" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "CRS" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER_minx" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER_miny" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
Expand All @@ -9442,7 +9443,7 @@ void TestQgsProcessing::modelExecution()

// with values
variables = model2.variablesForChildAlgorithm( "cx1", context, modelInputs, childResults );
QCOMPARE( variables.count(), 6 );
QCOMPARE( variables.count(), 7 );
QCOMPARE( variables.value( "DIST" ).value.toInt(), 271 );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.parameterName(), QString( "SOURCE_LAYER" ) );
QGSCOMPARENEAR( variables.value( "SOURCE_LAYER_minx" ).value.toDouble(), -118.8888, 0.001 );
Expand All @@ -9452,7 +9453,7 @@ void TestQgsProcessing::modelExecution()

std::unique_ptr< QgsExpressionContextScope > childScope( model2.createExpressionContextScopeForChildAlgorithm( "cx1", context, modelInputs, childResults ) );
QCOMPARE( childScope->name(), QStringLiteral( "algorithm_inputs" ) );
QCOMPARE( childScope->variableCount(), 6 );
QCOMPARE( childScope->variableCount(), 7 );
QCOMPARE( childScope->variable( "DIST" ).toInt(), 271 );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.parameterName(), QString( "SOURCE_LAYER" ) );
QGSCOMPARENEAR( childScope->variable( "SOURCE_LAYER_minx" ).toDouble(), -118.8888, 0.001 );
Expand All @@ -9477,7 +9478,7 @@ void TestQgsProcessing::modelExecution()
QCOMPARE( params.count(), 2 );

variables = model2.variablesForChildAlgorithm( "cx2", context );
QCOMPARE( variables.count(), 11 );
QCOMPARE( variables.count(), 12 );
QCOMPARE( variables.value( "DIST" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER_minx" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
Expand All @@ -9497,7 +9498,7 @@ void TestQgsProcessing::modelExecution()

// with values
variables = model2.variablesForChildAlgorithm( "cx2", context, modelInputs, childResults );
QCOMPARE( variables.count(), 11 );
QCOMPARE( variables.count(), 12 );
QCOMPARE( variables.value( "DIST" ).value.toInt(), 271 );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.parameterName(), QString( "SOURCE_LAYER" ) );
QCOMPARE( variables.value( "cx1_OUTPUT" ).source.outputChildId(), QString( "cx1" ) );
Expand Down Expand Up @@ -9549,7 +9550,7 @@ void TestQgsProcessing::modelExecution()


variables = model2.variablesForChildAlgorithm( "cx3", context );
QCOMPARE( variables.count(), 16 );
QCOMPARE( variables.count(), 17 );
QCOMPARE( variables.value( "DIST" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
QCOMPARE( variables.value( "SOURCE_LAYER_minx" ).source.source(), QgsProcessingModelChildParameterSource::ModelParameter );
Expand Down Expand Up @@ -9578,7 +9579,7 @@ void TestQgsProcessing::modelExecution()
QCOMPARE( variables.value( "cx2_OUTPUT_maxy" ).source.outputChildId(), QStringLiteral( "cx2" ) );
// with values
variables = model2.variablesForChildAlgorithm( "cx3", context, modelInputs, childResults );
QCOMPARE( variables.count(), 16 );
QCOMPARE( variables.count(), 17 );
QCOMPARE( variables.value( "DIST" ).value.toInt(), 271 );
QCOMPARE( variables.value( "SOURCE_LAYER" ).source.parameterName(), QString( "SOURCE_LAYER" ) );
QCOMPARE( variables.value( "cx1_OUTPUT" ).source.outputChildId(), QString( "cx1" ) );
Expand Down

0 comments on commit a198e30

Please sign in to comment.