Skip to content
Permalink
Browse files

Update dxf unit tests

  • Loading branch information
pblottiere committed Mar 25, 2019
1 parent 66d4de6 commit b702c30eb7ec02982ee2fc4aead2b3196911f35c
Showing with 20 additions and 2 deletions.
  1. +1 −0 tests/src/server/wms/CMakeLists.txt
  2. +19 −2 tests/src/server/wms/test_qgsserver_wms_dxf.cpp
@@ -34,6 +34,7 @@ SET(MODULE_WMS_SRCS
${CMAKE_SOURCE_DIR}/src/server/services/wms/qgslayerrestorer.cpp
${CMAKE_SOURCE_DIR}/src/server/services/wms/qgsmaprendererjobproxy.cpp
${CMAKE_SOURCE_DIR}/src/server/services/wms/qgswmsparameters.cpp
${CMAKE_SOURCE_DIR}/src/server/services/wms/qgswmsrendercontext.cpp
)

MACRO (ADD_QGIS_TEST TESTSRC)
@@ -19,6 +19,7 @@
#include "qgsserverinterfaceimpl.h"
#include "qgswmsparameters.h"
#include "qgswmsrenderer.h"
#include "qgswmsrendercontext.h"

/**
* \ingroup UnitTests
@@ -76,9 +77,17 @@ void TestQgsServerWmsDxf::use_title_as_layername_true()
QgsServiceRegistry registry;
QgsServerSettings settings;
QgsServerInterfaceImpl interface( &cache, &registry, &settings );
QgsWms::QgsRenderer renderer( &interface, &project, parameters );

QgsWms::QgsWmsRenderContext context( &project, &interface );
context.setFlag( QgsWms::QgsWmsRenderContext::UseWfsLayersOnly );
context.setFlag( QgsWms::QgsWmsRenderContext::UseOpacity );
context.setFlag( QgsWms::QgsWmsRenderContext::UseFilter );
context.setFlag( QgsWms::QgsWmsRenderContext::SetAccessControl );
context.setParameters( parameters );

QgsWms::QgsRenderer renderer( context );
QgsDxfExport exporter = renderer.getDxf();

const QString name = exporter.layerName( vl );
QCOMPARE( exporter.layerName( vl ), QString( "testlayer \u00E8\u00E9" ) );

@@ -117,9 +126,17 @@ void TestQgsServerWmsDxf::use_title_as_layername_false()
QgsServiceRegistry registry;
QgsServerSettings settings;
QgsServerInterfaceImpl interface( &cache, &registry, &settings );
QgsWms::QgsRenderer renderer( &interface, &project, parameters );

QgsWms::QgsWmsRenderContext context( &project, &interface );
context.setFlag( QgsWms::QgsWmsRenderContext::UseWfsLayersOnly );
context.setFlag( QgsWms::QgsWmsRenderContext::UseOpacity );
context.setFlag( QgsWms::QgsWmsRenderContext::UseFilter );
context.setFlag( QgsWms::QgsWmsRenderContext::SetAccessControl );
context.setParameters( parameters );

QgsWms::QgsRenderer renderer( context );
QgsDxfExport exporter = renderer.getDxf();

const QString name = exporter.layerName( vl );
QCOMPARE( exporter.layerName( vl ), QString( "A test vector layer" ) );

0 comments on commit b702c30

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