Skip to content
Permalink
Browse files
Fix TestQgsProcessing
  • Loading branch information
domi4484 committed Apr 27, 2021
1 parent 929bf6c commit 68460231ce035a434da9488ad594023f785a107e
Showing with 2 additions and 4 deletions.
  1. +0 −2 src/core/processing/qgsprocessingprovider.cpp
  2. +2 −2 tests/src/analysis/testqgsprocessing.cpp
@@ -193,7 +193,6 @@ bool QgsProcessingProvider::isSupportedOutputValue( const QVariant &outputValue,

QString QgsProcessingProvider::defaultVectorFileExtension( bool hasGeometry ) const
{
QgsSettings settings;
const QString userDefault = QgsProcessingUtils::defaultVectorExtension();

const QStringList supportedExtensions = supportedOutputVectorLayerExtensions();
@@ -216,7 +215,6 @@ QString QgsProcessingProvider::defaultVectorFileExtension( bool hasGeometry ) co

QString QgsProcessingProvider::defaultRasterFileExtension() const
{
QgsSettings settings;
const QString userDefault = QgsProcessingUtils::defaultRasterExtension();

const QStringList supportedExtensions = supportedOutputRasterLayerExtensions();

// unless the user has set a default format, which IS supported by that provider
QgsProcessing::settingsDefaultOutputVectorLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "tab" ) ) );
QgsProcessing::settingsDefaultOutputRasterLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "sdat" ) ) );
QgsProcessing::settingsDefaultOutputRasterLayerExt.setValue( QgsRasterFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "sdat" ) ) );

QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "tab" ) );
QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "sdat" ) );

// but if default is not supported by provider, we use a supported format
QgsProcessing::settingsDefaultOutputVectorLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "gpkg" ) ) );
QgsProcessing::settingsDefaultOutputRasterLayerExt.setValue( QgsVectorFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "ecw" ) ) );
QgsProcessing::settingsDefaultOutputRasterLayerExt.setValue( QgsRasterFileWriter::supportedFormatExtensions().indexOf( QLatin1String( "ecw" ) ) );
QCOMPARE( provider.defaultVectorFileExtension( true ), QStringLiteral( "mif" ) );
QCOMPARE( provider.defaultRasterFileExtension(), QStringLiteral( "mig" ) );
}

0 comments on commit 6846023

Please sign in to comment.