Skip to content

Commit

Permalink
Extend tests
Browse files Browse the repository at this point in the history
(cherry picked from commit 9ca5eb9)
  • Loading branch information
nyalldawson authored and github-actions[bot] committed Aug 2, 2021
1 parent 74adc0a commit 908f11a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/src/analysis/testqgsprocessing.cpp
Expand Up @@ -3652,6 +3652,22 @@ void TestQgsProcessing::parameterFile()
params.insert( "non_optional", QString( "def.bmp" ) );
QCOMPARE( QgsProcessingParameters::parameterAsFile( def.get(), params, context ), QString( "def.bmp" ) );

// no extension
def.reset( new QgsProcessingParameterFile( "non_optional", QString(), QgsProcessingParameterFile::File, QString(), QVariant(), false ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.bmp" ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.BMP" ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.pcx" ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.PCX" ) );
QVERIFY( !def->checkValueIsAcceptable( QVariant() ) );
QVERIFY( !def->checkValueIsAcceptable( QString( "" ) ) );
def.reset( new QgsProcessingParameterFile( "non_optional", QString(), QgsProcessingParameterFile::File, QString(), QVariant(), true ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.bmp" ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.BMP" ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.pcx" ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.PCX" ) );
QVERIFY( def->checkValueIsAcceptable( QVariant() ) );
QVERIFY( def->checkValueIsAcceptable( QString( "" ) ) );

// with extension
def.reset( new QgsProcessingParameterFile( "non_optional", QString(), QgsProcessingParameterFile::File, QStringLiteral( ".bmp" ), QString( "abc.bmp" ), false ) );
QVERIFY( def->checkValueIsAcceptable( "bricks.bmp" ) );
Expand Down

0 comments on commit 908f11a

Please sign in to comment.