Skip to content

Commit 6a4d605

Browse files
committedJan 17, 2017
Fix some test failures
1 parent 4896569 commit 6a4d605

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed
 

‎src/server/qgswmsconfigparser.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ QgsComposition* QgsWmsConfigParser::createPrintComposition( const QString& compo
7979
continue;
8080
}
8181

82+
// Change CRS of map to match requested CRS
83+
if ( mapSettings.destinationCrs().isValid() )
84+
currentMap->setCrs( mapSettings.destinationCrs() );
85+
8286
QStringList coordList = extent.split( QStringLiteral( "," ) );
8387
if ( coordList.size() < 4 )
8488
{

‎tests/src/core/testqgsatlascomposition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void TestQgsAtlasComposition::init()
146146
// select epsg:2154
147147
QgsCoordinateReferenceSystem crs;
148148
crs.createFromSrid( 2154 );
149-
mMapSettings->setDestinationCrs( crs );
149+
QgsProject::instance()->setCrs( crs );
150150
mComposition = new QgsComposition( *mMapSettings, QgsProject::instance() );
151151
mComposition->setPaperSize( 297, 210 ); //A4 landscape
152152

‎tests/src/core/testqgscomposerscalebar.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ void TestQgsComposerScaleBar::initTestCase()
7575
// so we enforce C locale to make sure we get expected result
7676
QLocale::setDefault( QLocale::c() );
7777

78+
//reproject to WGS84
79+
QgsCoordinateReferenceSystem destCRS;
80+
destCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
81+
QgsProject::instance()->setCrs( destCRS );
7882
QgsProject::instance()->setEllipsoid( QStringLiteral( "WGS84" ) );
7983

8084
mMapSettings = new QgsMapSettings();
@@ -89,12 +93,6 @@ void TestQgsComposerScaleBar::initTestCase()
8993
//create composition with composer map
9094
mMapSettings->setLayers( QList<QgsMapLayer*>() << mRasterLayer );
9195

92-
//reproject to WGS84
93-
QgsCoordinateReferenceSystem destCRS;
94-
destCRS.createFromId( 4326, QgsCoordinateReferenceSystem::EpsgCrsId );
95-
mMapSettings->setDestinationCrs( destCRS );
96-
mMapSettings->setCrsTransformEnabled( true );
97-
9896
mComposition = new QgsComposition( *mMapSettings, QgsProject::instance() );
9997
mComposition->setPaperSize( 297, 210 ); //A4 landscape
10098
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 150, 150 );

‎tests/src/core/testqgscomposition.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ void TestQgsComposition::itemVariablesFunction()
618618
QgsComposerMap* map = new QgsComposerMap( composition );
619619
map->setNewExtent( extent );
620620
map->setSceneRect( QRectF( 30, 60, 200, 100 ) );
621+
map->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) );
621622
composition->addComposerMap( map );
622623
map->setId( "map_id" );
623624

‎tests/src/python/test_qgsatlascomposition.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ def testCase(self):
4646
self.mapSettings = QgsMapSettings()
4747
layerStringList = [mVectorLayer]
4848
self.mapSettings.setLayers(layerStringList)
49-
self.mapSettings.setCrsTransformEnabled(True)
50-
self.mapSettings.setMapUnits(QgsUnitTypes.DistanceMeters)
5149

5250
# select epsg:2154
5351
crs = QgsCoordinateReferenceSystem()
5452
crs.createFromSrid(2154)
55-
self.mapSettings.setDestinationCrs(crs)
53+
QgsProject.instance().setCrs(crs)
5654

5755
self.mComposition = QgsComposition(self.mapSettings, QgsProject.instance())
5856
self.mComposition.setPaperSize(297, 210)

‎tests/src/python/test_qgscomposerpicture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ def testTrueNorth(self):
119119
"""Test syncing picture to true north"""
120120

121121
mapSettings = QgsMapSettings()
122-
mapSettings.setDestinationCrs(QgsCoordinateReferenceSystem.fromEpsgId(3575))
123122
composition = QgsComposition(mapSettings, QgsProject.instance())
124123

125124
composerMap = QgsComposerMap(composition)
125+
composerMap.setCrs(QgsCoordinateReferenceSystem.fromEpsgId(3575))
126126
composerMap.setNewExtent(QgsRectangle(-2126029.962, -2200807.749, -119078.102, -757031.156))
127127
composition.addComposerMap(composerMap)
128128

0 commit comments

Comments
 (0)
Please sign in to comment.