Skip to content
Permalink
Browse files

fix typo which caused issues with temporary file outputs also fix

related tests
  • Loading branch information
alexbruy committed Jan 29, 2019
1 parent fc3d5c8 commit 4b2334ba6913d85da1d27bf0579678672960d574
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/core/processing/qgsprocessingparameters.cpp
  2. +2 −2 tests/src/analysis/testqgsprocessing.cpp
@@ -701,7 +701,7 @@ QString QgsProcessingParameters::parameterAsFileOutput( const QgsProcessingParam
if ( dest == QgsProcessing::TEMPORARY_OUTPUT )
{
if ( const QgsProcessingDestinationParameter *destParam = dynamic_cast< const QgsProcessingDestinationParameter * >( definition ) )
val = destParam->generateTemporaryDestination();
dest = destParam->generateTemporaryDestination();
}
return dest;
}
@@ -5301,12 +5301,12 @@ void TestQgsProcessing::parameterFileOut()
QCOMPARE( QgsProcessingParameters::parameterAsFileOutput( def.get(), params, context ), QStringLiteral( "test.txt" ) );

params.insert( QStringLiteral( "non_optional" ), QgsProcessing::TEMPORARY_OUTPUT );
QCOMPARE( QgsProcessingParameters::parameterAsFileOutput( def.get(), params, context ).right( 7 ), QStringLiteral( "_OUTPUT" ) );
QCOMPARE( QgsProcessingParameters::parameterAsFileOutput( def.get(), params, context ).right( 18 ), QStringLiteral( "/non_optional.file" ) );

QgsProcessingOutputLayerDefinition fs;
fs.sink = QgsProperty::fromValue( QgsProcessing::TEMPORARY_OUTPUT );
params.insert( QStringLiteral( "non_optional" ), QVariant::fromValue( fs ) );
QCOMPARE( QgsProcessingParameters::parameterAsFileOutput( def.get(), params, context ).right( 7 ), QStringLiteral( "_OUTPUT" ) );
QCOMPARE( QgsProcessingParameters::parameterAsFileOutput( def.get(), params, context ).right( 18 ), QStringLiteral( "/non_optional.file" ) );

QCOMPARE( def->valueAsPythonString( QVariant(), context ), QStringLiteral( "None" ) );
QCOMPARE( def->valueAsPythonString( QStringLiteral( "abc" ), context ), QStringLiteral( "'abc'" ) );

0 comments on commit 4b2334b

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