Skip to content
Permalink
Browse files

Fix test

  • Loading branch information
nyalldawson committed Feb 12, 2019
1 parent 69f45e3 commit 6648a955bcf0428cc23ec1b05d2ca5099533889e
Showing with 3 additions and 3 deletions.
  1. +1 −1 src/core/expression/qgsexpressioncontextutils.cpp
  2. +2 −2 tests/src/analysis/testqgsprocessing.cpp
@@ -767,7 +767,7 @@ QgsExpressionContextScope *QgsExpressionContextUtils::processingModelAlgorithmSc
modelPath = context.project()->projectStorage() ? context.project()->fileName() : context.project()->absoluteFilePath();
}

const QString modelFolder = QFileInfo( modelPath ).path();
const QString modelFolder = !modelPath.isEmpty() ? QFileInfo( modelPath ).path() : QString();
modelScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "model_path" ), QDir::toNativeSeparators( modelPath ), true ) );
modelScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "model_folder" ), QDir::toNativeSeparators( modelFolder ), true, true ) );
modelScope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "model_name" ), model->displayName(), true ) );
@@ -6014,8 +6014,8 @@ void TestQgsProcessing::modelScope()
QCOMPARE( scope->variable( QStringLiteral( "model_group" ) ).toString(), QStringLiteral( "testGroup" ) );
QVERIFY( scope->hasVariable( QStringLiteral( "model_path" ) ) );
QVERIFY( scope->hasVariable( QStringLiteral( "model_folder" ) ) );
QVERIFY( scope->variable( QStringLiteral( "model_path" ) ).toString().isEmpty() );
QVERIFY( scope->variable( QStringLiteral( "model_folder" ) ).toString().isEmpty() );
QCOMPARE( scope->variable( QStringLiteral( "model_path" ) ).toString(), QString() );
QCOMPARE( scope->variable( QStringLiteral( "model_folder" ) ).toString(), QString() );

QgsProject p;
pc.setProject( &p );

0 comments on commit 6648a95

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