Skip to content
Permalink
Browse files

tests for parameterAsLayers() call

  • Loading branch information
alexbruy committed Nov 2, 2020
1 parent 24f2c62 commit 3feb0ad447f39c38c275ac5532d3e21e190bc218
Showing with 12 additions and 0 deletions.
  1. +12 −0 tests/src/analysis/testqgsprocessing.cpp
@@ -52,6 +52,7 @@
#include "qgsprocessingparameteraggregate.h"
#include "qgsprocessingparametertininputlayers.h"
#include "qgsprocessingparameterdxflayers.h"
#include "qgsdxfexport.h"

class DummyAlgorithm : public QgsProcessingAlgorithm
{
@@ -8416,6 +8417,17 @@ void TestQgsProcessing::parameterDxfLayers()

QString pythonCode = def->asPythonString();
QCOMPARE( pythonCode, QStringLiteral( "QgsProcessingParameterDxfLayers('dxf input layer', '')" ) );

QgsDxfExport::DxfLayer dxfLayer( vectorLayer );
QList<QgsDxfExport::DxfLayer> dxfList = def->parameterAsLayers( QVariant( vectorLayer->source() ), context );
QCOMPARE( dxfList.at( 0 ).layer()->source(), dxfLayer.layer()->source() );
QCOMPARE( dxfList.at( 0 ).layerOutputAttributeIndex(), dxfLayer.layerOutputAttributeIndex() );
dxfList = def->parameterAsLayers( QVariant( QStringList() << vectorLayer->source() ), context );
QCOMPARE( dxfList.at( 0 ).layer()->source(), dxfLayer.layer()->source() );
QCOMPARE( dxfList.at( 0 ).layerOutputAttributeIndex(), dxfLayer.layerOutputAttributeIndex() );
dxfList = def->parameterAsLayers( layerList, context );
QCOMPARE( dxfList.at( 0 ).layer()->source(), dxfLayer.layer()->source() );
QCOMPARE( dxfList.at( 0 ).layerOutputAttributeIndex(), dxfLayer.layerOutputAttributeIndex() );
}

void TestQgsProcessing::checkParamValues()

0 comments on commit 3feb0ad

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