Skip to content
Permalink
Browse files

[layout] Add map rendering to tests

  • Loading branch information
elpaso committed Jan 3, 2018
1 parent 7062f90 commit 858a71f86321b7e487cad663a804e7c9dcbedd03
@@ -26,6 +26,8 @@
#include "qgsmultirenderchecker.h"
#include "qgssettings.h"

#include "qgsmultibandcolorrenderer.h"
#include "qgsrasterlayer.h"

#include "qgslayoutpagecollection.h"
#include "qgslayoutitemlabel.h"
@@ -113,6 +115,8 @@ class TestQgsCompositionConverter: public QObject

void TestQgsCompositionConverter::initTestCase()
{
QgsApplication::init();
QgsApplication::initQgis();
mReport = QStringLiteral( "<h1>Layout Tests</h1>\n" );
QgsSettings settings;
settings.setValue( QStringLiteral( "svg/searchPathsForSVG" ), QStringLiteral( TEST_DATA_DIR ) ) ;
@@ -337,9 +341,18 @@ void TestQgsCompositionConverter::importComposerTemplateMap()
QgsLayoutItemMap *item = items.at( 0 );
QVERIFY( item->isVisible() );

item->setLayers( project.mapLayers().values() );

for ( auto const &l : project.mapLayers().values() )
{
QVERIFY( l->isValid() );
}

QgsLayoutItemMap *item1 = items.at( 1 );
QVERIFY( item1->isVisible() );
QCOMPARE( item1->opacity(), 0.78 );
item1->setLayers( project.mapLayers().values() );
item1->setExtent( QgsRectangle( -126.5731570061082038, -4.69162199770811128, -88.56641716083402116, 69.08616711370645191 ) );

// Check map ids
QStringList mapUuids;
@@ -370,6 +383,7 @@ void TestQgsCompositionConverter::importComposerTemplateMap()
QVERIFY( count > 0 );
}


checkRenderedImage( layout.get(), QTest::currentTestFunction(), 0 );

qDeleteAll( items );
@@ -437,6 +451,7 @@ void TestQgsCompositionConverter::importComposerTemplate()

QVERIFY( layout.get() );
QCOMPARE( layout->pageCollection()->pageCount(), 2 );
QCOMPARE( layout->name(), QStringLiteral( "composer title" ) );

// Check map ids
QStringList mapUuids;
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,13 +5,13 @@
<evaluateDefaultValues active="0"/>
<layer-tree-group expanded="1" checked="Qt::Checked" name="">
<customproperties/>
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="lines20171212162314640" source="C:/dev/QGIS/tests/testdata/lines.shp" name="lines">
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="lines20171212162314640" source="../lines.shp" name="lines">
<customproperties/>
</layer-tree-layer>
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="points20171212162310546" source="C:/dev/QGIS/tests/testdata/points.shp" name="points">
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="points20171212162310546" source="../points.shp" name="points">
<customproperties/>
</layer-tree-layer>
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="polys20171212162309844" source="C:/dev/QGIS/tests/testdata/polys.shp" name="polys">
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="polys20171212162309844" source="../polys.shp" name="polys">
<customproperties/>
</layer-tree-layer>
</layer-tree-group>
@@ -388,10 +388,10 @@
</styles>
<layer-tree-group expanded="1" checked="Qt::Checked" name="">
<customproperties/>
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="points20171212162310546" source="C:/dev/QGIS/tests/testdata/points.shp" name="points">
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="points20171212162310546" source="../points.shp" name="points">
<customproperties/>
</layer-tree-layer>
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="polys20171212162309844" source="C:/dev/QGIS/tests/testdata/polys.shp" name="polys">
<layer-tree-layer expanded="1" providerKey="ogr" checked="Qt::Checked" id="polys20171212162309844" source="../polys.shp" name="polys">
<customproperties/>
</layer-tree-layer>
</layer-tree-group>
@@ -529,7 +529,7 @@
</ComposerFrame>
<customproperties/>
</ComposerHtml>
<ComposerAttributeTableV2 vectorLayerName="points" source="0" showGrid="1" maxFeatures="30" resizeMode="0" filterFeatures="false" featureFilter="" emptyTableMode="1" wrapString="" wrapBehaviour="0" headerMode="1" backgroundColor="240,33,33,255" showEmptyRows="0" emptyTableMessage="" showOnlyVisibleFeatures="1" vectorLayer="points20171212162310546" vectorLayerSource="C:/dev/QGIS/tests/testdata/points.shp" composerMap="0" headerHAlignment="2" contentFontColor="115,115,115,255" headerFontColor="194,143,12,255" cellMargin="1.2" filterToAtlasIntersection="0" relationId="" gridStrokeWidth="0.7" gridColor="245,57,220,255" showUniqueRowsOnly="1" vectorLayerProvider="ogr">
<ComposerAttributeTableV2 vectorLayerName="points" source="0" showGrid="1" maxFeatures="30" resizeMode="0" filterFeatures="false" featureFilter="" emptyTableMode="1" wrapString="" wrapBehaviour="0" headerMode="1" backgroundColor="240,33,33,255" showEmptyRows="0" emptyTableMessage="" showOnlyVisibleFeatures="1" vectorLayer="points20171212162310546" vectorLayerSource="../points.shp" composerMap="0" headerHAlignment="2" contentFontColor="115,115,115,255" headerFontColor="194,143,12,255" cellMargin="1.2" filterToAtlasIntersection="0" relationId="" gridStrokeWidth="0.7" gridColor="245,57,220,255" showUniqueRowsOnly="1" vectorLayerProvider="ogr">
<headerFontProperties description="MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0" style=""/>
<contentFontProperties description="MS Shell Dlg 2,8.25,-1,5,50,0,0,0,0,0" style=""/>
<displayColumns>

0 comments on commit 858a71f

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