@@ -6156,7 +6156,7 @@ void TestQgsProcessing::modelerAlgorithm()
6156
6156
QgsStringMap extraParams;
6157
6157
extraParams[QStringLiteral( "SOMETHING" )] = QStringLiteral( "SOMETHING_ELSE" );
6158
6158
extraParams[QStringLiteral( "SOMETHING2" )] = QStringLiteral( "SOMETHING_ELSE2" );
6159
- QCOMPARE( child.asPythonCode( QgsProcessing::PythonQgsProcessingAlgorithmSubclass, extraParams, 4, 2 ).join( '\n' ), QStringLiteral( " alg_params = {\n 'SOMETHING':SOMETHING_ELSE,\n 'SOMETHING2':SOMETHING_ELSE2, \n }\n outputs[''] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)" ) );
6159
+ QCOMPARE( child.asPythonCode( QgsProcessing::PythonQgsProcessingAlgorithmSubclass, extraParams, 4, 2 ).join( '\n' ), QStringLiteral( " alg_params = {\n 'SOMETHING': SOMETHING_ELSE,\n 'SOMETHING2': SOMETHING_ELSE2\n }\n outputs[''] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)" ) );
6160
6160
// bit of a hack -- but try to simulate an algorithm not originally available!
6161
6161
child.mAlgorithm.reset();
6162
6162
QVERIFY( !child.algorithm() );
@@ -6199,7 +6199,7 @@ void TestQgsProcessing::modelerAlgorithm()
6199
6199
QCOMPARE( child.parameterSources().value( QStringLiteral( "b" ) ).at( 0 ).staticValue().toInt(), 7 );
6200
6200
QCOMPARE( child.parameterSources().value( QStringLiteral( "b" ) ).at( 1 ).staticValue().toInt(), 9 );
6201
6201
6202
- QCOMPARE( child.asPythonCode( QgsProcessing::PythonQgsProcessingAlgorithmSubclass, extraParams, 4, 2 ).join( '\n' ), QStringLiteral( " alg_params = {\n 'a':5,\n 'b':[7,9],\n 'SOMETHING':SOMETHING_ELSE,\n 'SOMETHING2':SOMETHING_ELSE2, \n }\n outputs['my_id'] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)" ) );
6202
+ QCOMPARE( child.asPythonCode( QgsProcessing::PythonQgsProcessingAlgorithmSubclass, extraParams, 4, 2 ).join( '\n' ), QStringLiteral( " alg_params = {\n 'a': 5,\n 'b': [7,9],\n 'SOMETHING': SOMETHING_ELSE,\n 'SOMETHING2': SOMETHING_ELSE2\n }\n outputs['my_id'] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)" ) );
6203
6203
6204
6204
QgsProcessingModelOutput testModelOut;
6205
6205
testModelOut.setChildId( QStringLiteral( "my_id" ) );
@@ -6235,7 +6235,7 @@ void TestQgsProcessing::modelerAlgorithm()
6235
6235
QCOMPARE( child.modelOutput( "a" ).description(), QStringLiteral( "my output" ) );
6236
6236
child.modelOutput( "a" ).setDescription( QStringLiteral( "my output 2" ) );
6237
6237
QCOMPARE( child.modelOutput( "a" ).description(), QStringLiteral( "my output 2" ) );
6238
- QCOMPARE( child.asPythonCode( QgsProcessing::PythonQgsProcessingAlgorithmSubclass, extraParams, 4, 2 ).join( '\n' ), QStringLiteral( " alg_params = {\n 'a':5,\n 'b':[7,9],\n 'SOMETHING':SOMETHING_ELSE,\n 'SOMETHING2':SOMETHING_ELSE2, \n }\n outputs['my_id'] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)\n results['my_id:a'] = outputs['my_id']['']" ) );
6238
+ QCOMPARE( child.asPythonCode( QgsProcessing::PythonQgsProcessingAlgorithmSubclass, extraParams, 4, 2 ).join( '\n' ), QStringLiteral( " alg_params = {\n 'a': 5,\n 'b': [7,9],\n 'SOMETHING': SOMETHING_ELSE,\n 'SOMETHING2': SOMETHING_ELSE2\n }\n outputs['my_id'] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)\n results['my_id:a'] = outputs['my_id']['']" ) );
6239
6239
6240
6240
// no existent
6241
6241
child.modelOutput( "b" ).setDescription( QStringLiteral( "my output 3" ) );
@@ -6983,26 +6983,26 @@ void TestQgsProcessing::modelExecution()
6983
6983
" results = {}\n"
6984
6984
" outputs = {}\n"
6985
6985
" alg_params = {\n"
6986
- " 'DISSOLVE':False,\n"
6987
- " 'DISTANCE':parameters['DIST'],\n"
6988
- " 'END_CAP_STYLE':1,\n"
6989
- " 'INPUT':parameters['SOURCE_LAYER'],\n"
6990
- " 'JOIN_STYLE':2,\n"
6991
- " 'SEGMENTS':QgsExpression('@myvar*2').evaluate(),\n"
6992
- " 'OUTPUT':parameters['cx1:MODEL_OUT_LAYER'], \n"
6986
+ " 'DISSOLVE': False,\n"
6987
+ " 'DISTANCE': parameters['DIST'],\n"
6988
+ " 'END_CAP_STYLE': 1,\n"
6989
+ " 'INPUT': parameters['SOURCE_LAYER'],\n"
6990
+ " 'JOIN_STYLE': 2,\n"
6991
+ " 'SEGMENTS': QgsExpression('@myvar*2').evaluate(),\n"
6992
+ " 'OUTPUT': parameters['cx1:MODEL_OUT_LAYER']\n"
6993
6993
" }\n"
6994
6994
" outputs['cx1'] = processing.run('native:buffer', alg_params, context=context, feedback=feedback, is_child_algorithm=True)\n"
6995
6995
" results['cx1:MODEL_OUT_LAYER'] = outputs['cx1']['OUTPUT']\n"
6996
6996
" alg_params = {\n"
6997
- " 'INPUT':outputs['cx1']['OUTPUT'],\n"
6998
- " 'OUTPUT':QgsProcessing.TEMPORARY_OUTPUT, \n"
6997
+ " 'INPUT': outputs['cx1']['OUTPUT'],\n"
6998
+ " 'OUTPUT': QgsProcessing.TEMPORARY_OUTPUT\n"
6999
6999
" }\n"
7000
7000
" outputs['cx2'] = processing.run('native:centroids', alg_params, context=context, feedback=feedback, is_child_algorithm=True)\n"
7001
7001
" alg_params = {\n"
7002
- " 'EXPRESSION':'true',\n"
7003
- " 'INPUT':outputs['cx1']['OUTPUT'],\n"
7004
- " 'OUTPUT':parameters['MY_OUT'],\n"
7005
- " 'OUTPUT':parameters['cx3:MY_OUT'], \n"
7002
+ " 'EXPRESSION': 'true',\n"
7003
+ " 'INPUT': outputs['cx1']['OUTPUT'],\n"
7004
+ " 'OUTPUT': parameters['MY_OUT'],\n"
7005
+ " 'OUTPUT': parameters['cx3:MY_OUT']\n"
7006
7006
" }\n"
7007
7007
" outputs['cx3'] = processing.run('native:extractbyexpression', alg_params, context=context, feedback=feedback, is_child_algorithm=True)\n"
7008
7008
" results['cx3:MY_OUT'] = outputs['cx3']['OUTPUT']\n"
0 commit comments