Skip to content

Commit

Permalink
Update dxf unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 27, 2019
1 parent 66d4de6 commit b702c30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/src/server/wms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 19 additions & 2 deletions tests/src/server/wms/test_qgsserver_wms_dxf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgsserverinterfaceimpl.h"
#include "qgswmsparameters.h"
#include "qgswmsrenderer.h"
#include "qgswmsrendercontext.h"

/**
* \ingroup UnitTests
Expand Down Expand Up @@ -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" ) );

Expand Down Expand Up @@ -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" ) );

Expand Down

0 comments on commit b702c30

Please sign in to comment.