Skip to content
Permalink
Browse files

test for update of parameterLayerList managing QgsProcessingOutputLay…

…erDefinition
  • Loading branch information
luipir authored and nyalldawson committed Sep 20, 2018
1 parent d641b30 commit 6e02f9f4fa31527996ff5a270984ad5d076c82f0
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/src/analysis/testqgsprocessing.cpp
@@ -3206,6 +3206,23 @@ void TestQgsProcessing::parameterLayerList()
QCOMPARE( fromCode->flags(), def->flags() );
QVERIFY( !fromCode->defaultValue().isValid() );
QCOMPARE( fromCode->layerType(), def->layerType() );

// manage QgsProcessingOutputLayerDefinition as parameter value

// optional with sink to a QgsMapLayer.id()
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeFile ) );
params.insert( QString( "optional" ), QgsProcessingOutputLayerDefinition( r1->publicSource() ) );
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << r1 );

// optional with sink to an empty string
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeFile ) );
params.insert( QString( "optional" ), QgsProcessingOutputLayerDefinition( QString() ) );
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() );

// optional with sink to an nonsense string
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeFile ) );
params.insert( QString( "optional" ), QgsProcessingOutputLayerDefinition( QString( "i'm not a layer, and nothing you can do will make me one" ) ) );
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() );
}

void TestQgsProcessing::parameterDistance()

0 comments on commit 6e02f9f

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