Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 4b2334b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/processing/qgsprocessingparameters.cpp
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/src/analysis/testqgsprocessing.cpp
Expand Up @@ -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'" ) );
Expand Down

0 comments on commit 4b2334b

Please sign in to comment.